Echo print of the input file

Top  Previous  Next

The echo print of the program is always the first part of the output file.  It is just a listing of the input with lines numbers added.  An echo print of the file shortmodel.gms follows:

 

   2  *Example of a comment

      Comments in $On/off text are not given line numbers

   6  SET PROCESS   PRODUCTION PROCESSES /makechair,maketable,makelamp/

   7      RESOURCE  TYPES OF RESOURCES   /plantcap,salecontrct/;

   8  PARAMETER PRICE(PROCESS)      PRODUCT PRICES BY PROCESS

   9                /makechair 6.5 ,maketable 3, makelamp 0.5/

  10            Yield(process)  yields per unit of the process

  11                /Makechair 2   ,maketable 6 ,makelamp 3/

  12          PRODCOST(PROCESS)     COST BY PROCESS

  13                /Makechair 10  ,Maketable 6, Makelamp 1/

  14          RESORAVAIL(RESOURCE)  RESOURCE AVAILABLITY

  15               /plantcap 10 ,salecontrct 3/;

  16  TABLE RESOURUSE(RESOURCE,PROCESS) RESOURCE USAGE

  17                     Makechair   Maketable  Makelamp

  18       plantcap         3          2          1.1

  19       salecontrct      1         -1;

  20  POSITIVE VARIABLES PRODUCTION(PROCESS) ITEMS PRODUCED BY PROCESS;

  21  VARIABLES          PROFIT              TOTALPROFIT;

  22  EQUATIONS          OBJT OBJECTIVE FUNCTION ( PROFIT )

  23                     AVAILABLE(RESOURCE) RESOURCES AVAILABLE ;

  24  OBJT.. PROFIT=E=   SUM(PROCESS,(PRICE(PROCESS)*yield(process)

  25                         -PRODCOST(PROCESS))*PRODUCTION(PROCESS)) ;

  26  AVAILABLE(RESOURCE).. SUM(PROCESS,RESOURUSE(RESOURCE,PROCESS)

  27                   *PRODUCTION(PROCESS))  =L= RESORAVAIL(RESOURCE);

  28  MODEL RESALLOC /ALL/;

  29  SOLVE RESALLOC USING LP MAXIMIZING PROFIT;

  34  display solprod;

Notes:

The line number refers to the input file physical line number of each statement starting with line 1.  However, this is not true if other files are incorporated using the commands for file inclusion or saves and restarts.  In those cases the line numbers are sequential starting from 1 in the first file with line numbers added at points of inclusion for the full file.
Some lines are left out of the LST file echo print.  In particular, any $directives inserted in the source file are not listed even though the line number count is advanced for their presence.  These will only be listed if a directive to list them is enabled ($Ondollar), or if they contain errors.  Thus, since in the shortmodel.gms example the source file has a $ command in line 1 then the above listing begins with line 2. $Offdollar stops echo print of dollar command options in LST file.
GAMS does not echo back line numbers for entries enclosed in $Ontext and $Offtext. Thus, since the shortmodel.gms example source file contains such commands in lines 3 and 5 with comments inserted between (line 4) the LST file contains the comment in the echo print output but the line numbers are suppressed and the dollar commands skipped resulting in the line numbering skipping from line 2 to line 6.
The $Offlisting directive will turn off the echo print of any lines appearing after it in the input file and $Onlisting will turn the echo print back on.  Thus, since shortmodel.gms has such commands in line 30 and 33, the line numbers skip from line 29 to  line 34 and the lines in between are not shown.
Lines in the echo print can be caused to be double spaced using $double and then reset to single spacing using $single.
Include files are ordinarily copied into the echo print but can be suppressed using $Offinclude.  They can be subsequently reactivated using $Oninclude.