|
Putting out set elements for parameters via .Tn |
Top Previous Next |
|
GAMS allows one to put out the fully write out the name and set definition of an indexed item like a parameter, variable, or equation. This is done using the suffix .tn in a put context. put parametername.tn(setdependency)
where the set deendency is controlled by loop statements.
Examples (putex1.gms): Suppose one wants to put out the full identiy of items in an array. One can do this in a transport context as follows
put / "example of .tn use" //; loop((scenarios,Source,Destinaton)$savtransport(Source,Destinaton,scenarios), put savtransport.tn(Source,Destinaton,scenarios):0:0 @50 " = " savtransport(Source,Destinaton,scenarios) /; );
This will produce
example of .tn use
savtransport('Seattle',"New York",'base') = 50.00 savtransport('Seattle','Chicago','base') = 300.00 savtransport("San Diego","New York",'base') = 275.00 savtransport("San Diego",'Topeka','base') = 275.00 savtransport('Seattle',"New York",'scen1') = 350.00 savtransport("San Diego","New York",'scen1') = 275.00
where note the parameter name and associated set elements are printed out for each nonzero item. |