help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] CSV outputting MathProg for summary report mapulation


From: Andrew Makhorin
Subject: Re: [Help-glpk] CSV outputting MathProg for summary report mapulation
Date: Thu, 01 Mar 2012 15:59:20 +0300

> 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,
> 

MathProg does not allow creating tables whose fields are unknown at the
compile time (i.e. like in your AMPL example). On the other hand, using
such a table structure is not a good idea (at least in MathProg context,
where data tables represent some relations between predefined sets). You
might use, for example, the following table structure:

Period  ClearfellArea  PRODUCT VALUE
...     ...            TRV     123.456
...     ...            P1P2    456.123
...     ...            SLOG    ...
...     ...            PULP    ...
etc.

that would resolve the issue.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]