|
Set element names via .tl |
Top Previous Next |
|
Sometimes one wishes output wherein the set element names are used in labeling the printed data. In the put file context this is done by putting an item in a put command which is setname.tl wherein the named set is varied by a loop command as discussed in the Control Structures chapter. The orange entries just below all involve instances where the text for set element names is used in putting outt information within the example putex1.gms.
loop(Destinaton, put 'Report for ' , Destinaton.tl:15 put @40 '------------ Scenario ------------' /; put @41; loop(scenarios,put scenarios.tl:10); put /; loop(source$sum(scenarios, abs(savtransport(Source,Destinaton,scenarios))), put 'Incoming From ' source.tl @35; loop(scenarios, put savtransport(Source,Destinaton,scenarios):10:0); put /; );
The resultant output file follows with the orange entries corresponding to set element names generated by the put commands above.
Report for New York ------------ Scenario ------------ base scen1 scen2 scen3 Incoming From Seattle 50 350 0 0 Incoming From San Diego 275 275 0 525
Report for Chicago ------------ Scenario ------------ base scen1 scen2 scen3 Incoming From Seattle 300 0 350 350 Incoming From San Diego 0 0 275 25
Report for Topeka ------------ Scenario ------------ base scen1 scen2 scen3 Incoming From San Diego 275 275 275 0 Notes:
|