[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] CSV outputting MathProg for summary report mapulation
From: |
Meketon, Marc |
Subject: |
Re: [Help-glpk] CSV outputting MathProg for summary report mapulation |
Date: |
Thu, 1 Mar 2012 01:29:29 -0600 |
There is an alternative way in GMPL to write out CSV files. Use the printf
function to create the CSV file.
Something like:
printf " Period,ClearfellArea,TRV,P1P2,SLOG,PULP\n" > "filename.csv"
printf {(t,i,j) in HARVEST} ": t, sum {(t,i,j) in HARVEST} Y[t,i,j] >>
"filename.csv"
-Marc
-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Noli Sicad
Sent: Thursday, March 01, 2012 12:10 AM
To: address@hidden
Subject: [Help-glpk] CSV outputting MathProg for summary report mapulation
Hi,
I don't know how to exactly to convert this AMPL code to MathProg to get the
desired CSV table.
In AMPL
############
table tblWoodflowSummary OUT "ODBC" "Otago.mdb" "tblWoodflowSummary":
{t in PERIOD} -> [Period],sum {(t,i,j) in HARVEST} Y[t,i,j] ~
ClearfellArea,
{p in PRODUCT: Status[p] in YIELD} <sum {(t,i,j) in HARVEST}
Y[t,i,j]*Yield[p,i,j] ~ (p)>;
write table tblWoodflowSummary;
The desire tables in CSV outlooks like this:
Period ClearfellArea TRV P1P2 SLOG PULP
1 222 23 34 23 12
2 22 23 31 23 12
3 10 23 30 23 12
4 222 23 34 23 12
5 22 23 34 23 12
.
.
60
where TRV, P1P2 SLOG and PULP are the PRODUCT.
Now, how to we do write in MatProg?
Here are incomplete and working script.
table tab_WoodflowSummary{(t,i,j) in HARVEST} OUT "CSV" "WoodFlowSummary.csv" :
t ~ Period, sum {(t,i,j) in HARVEST} Y[t,i,j] ~ ClearfellArea
regards,
Noli
_______________________________________________
Help-glpk mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-glpk
This e-mail and any attachments may be confidential or legally privileged. If
you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein. Please inform us of the erroneous delivery by return e-mail.
Thank you for your cooperation.
Re: [Help-glpk] CSV outputting MathProg for summary report mapulation, Andrew Makhorin, 2012/03/01