[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: |
Noli Sicad |
Subject: |
Re: [Help-glpk] CSV outputting MathProg for summary report mapulation |
Date: |
Thu, 1 Mar 2012 18:26:02 +1100 |
Hi,
This first part is working now.
table tab_WoodflowSummary{t in PERIOD} OUT "CSV" "WoodFlowSummary.csv" :
t ~ Period, (sum {(t,i,j) in HARVEST} Y[t,i,j]) ~ ClearfellArea;
Period,ClearfellArea
1,3086.19821682923
2,1268.43555053816
3,1414.81034598901
4,1050.01727432133
5,996.278617016041
6,1108.69319799071
7,1304.17092396292
8,1541.74787266007
However, I could not figure out how to do, this part.
{p in PRODUCT: Status[p] in YIELD} <sum {(t,i,j) in HARVEST}
Y[t,i,j]*Yield[p,i,j] ~ (p)>;
As you can see in the output, it involve transposing and summing.
> 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
Noli
> 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
>
Re: [Help-glpk] CSV outputting MathProg for summary report mapulation, Andrew Makhorin, 2012/03/01