|
Variable and equation attributes: .L and .M |
Top Previous Next |
|
The value of numerical results in attributes of variables, and equations may be included in a put employing the syntax
Put itemname.attribute(setdependency)
where any sets must be controlled in loop statements. The colored entries just below involves the .L and .M variable and equation attributes reporting optimal variable levels and equation shadow price marginals as used within the example putex11.gms.
loop(scenarios, Need(Destinaton)=demandscen(destinaton,scenarios); Solve tranport using lp minimizing totalcost ; report("total","cost",scenarios)=totalcost.l; report("demand shadow price",Destinaton,scenarios) = demandbal.m(Destinaton); report("supply shadow price",Source,scenarios) = Supplybal.m(Source); savtransport(Source,Destinaton,scenarios)=transport.l(Source,Destinaton); put 'Scenario name ' scenarios.te(scenarios):14 put @30 ' Optimality status ' tranport.modelstat:2:0 /; put @30 ' Optimality status text ' tranport.Tmodstat /; put @30 ' Solver status ' tranport.solvestat:2:0 /; put @30 ' Solver status text ' tranport.Tsolstat /; put //; loop(Destinaton, put 'Report for ' , Destinaton.tl:15 "demand location in " scenarios.te(scenarios):0 " scenario" //; loop(source$transport.l(Source,Destinaton), put 'Incoming From ' source.tl @35; put transport.l(Source,Destinaton):10:0; put /; ); put 'Quantity demanded ' @35 put Need(Destinaton):10:0; put /; put 'Marginal Cost of meeting demand ' @35 put demandbal.m(Destinaton):10:2; put / put /; ); put / );
Part of the resultant output file follows with the red entries corresponding to the variable level attribute data generated by the put commands above and the blue the equation marginal attribute data.
Report for New York demand location in Base Case scenario
Incoming From Seattle 50 Incoming From San Diego 275 Quantity demanded 325 Marginal Cost of meeting demand 250.00
Report for Chicago demand location in Base Case scenario
Incoming From Seattle 300 Quantity demanded 300 Marginal Cost of meeting demand 178.00 Notes:
|