Parameter values

Top  Previous  Next

Numerical parameter data may be included in a put employing the syntax

 

Put parametername(setdependency)

 

where any sets must be controlled in loop statements.  The aquamarine entry just below involve instances where the data for a parameter are reported out within the example putex1.gms.  The red entries identify the loop command and the set under control.

 

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 aquamarine entries corresponding to parameter data 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:

All sets must be controlled in loop statements, GAMS will not automatically cover all cases.
Default field width is 12 characters but alternative widths may be used as discussed below.
Small or large numbers cause exponential format to be used.
GAMS will print zeros out here exhibiting different behavior than is exhibited in display statements.
Default number of decimal places is 2 but alternative specifications may be used as discussed below.
Default justification is right but alternative formatting may be used as discussed below.
One can suppress small numbers using the .nz specification as the example putex3.gms illustrates

 my1.nz=0.01;

 loop(j, put newnames.te(j):12,data(j) /);

 

 which would cause any entries with absolute value less than 0,01 to be reported as a zero.