Based on GAMS command line parameters

Top  Previous  Next

One can use a $If or $Ifi with or without the not modifier to test the characteristics of the GAMS command line parameter appearing on the GAMS call or in the GAMS parameters box in the upper right corner of the IDE.  Such items can be addressed as attributes of the keyword GAMS as follows

 

%Gams.commandlineparametername%

 

The parameter names are all listed in the Command Line Parameters chapter.

Example:

(Gamsparm.gms)

When I include the statements

 

$If NOT '%gams.lp%'     == '' $set lp     %gams.lp%

$If NOT '%gams.rmip%'   == '' $set rmip   %gams.rmip%

$If NOT '%gams.mip%'    == '' $set mip    %gams.mip%

$If NOT '%gams.nlp%'    == '' $set nlp    %gams.nlp%

$If NOT '%gams.dnlp%'   == '' $set dnlp   %gams.dnlp%

$If NOT '%gams.cns%'    == '' $set cns    %gams.cns%

$If NOT '%gams.mcp%'    == '' $set mcp    %gams.mcp%

$If NOT '%gams.rminlp%' == '' $set rminlp %gams.rminlp%

$If NOT '%gams.minlp%'  == '' $set minlp  %gams.minlp%

$If NOT '%gams.lp%'   == '' display 'lp     command argument used %gams.lp%';

$If NOT '%gams.rmip%' == '' display 'rmip   command argument used %gams.rmip%';

$If NOT '%gams.mip%'  == '' display 'mip    command argument used %gams.mip%';

$If NOT '%gams.nlp%'  == '' display 'nlp    command argument used %gams.nlp%';

$If NOT '%gams.dnlp%' == '' display 'dnlp   command argument used %gams.dnlp%';

$If NOT '%gams.cns%'  == '' display 'cns    command argument used %gams.cns%';

$If NOT '%gams.mcp%'  == '' display 'mcp    command argument used %gams.mcp%';

$If NOT '%gams.rminlp%'=='' display 'rminlp command argument used %gams.rminlp%';

$If NOT '%gams.minlp%'== '' display 'minlp  command argument used %gams.minlp%';

$If NOT '%gams.ps%' == '' display 'Page size command argument used %gams.ps%';

$If NOT '%gams.pw%' == '' display 'Page width command argument used %gams.pw%';

$show

 

and use the GAMS command line parameters

 

lp=bdmlp mip=osl nlp=conopt ps=60 pw=85

 

the resultant code in the compiler after resolving the above statements that is passed on to execution along with the report on the control variables becomes

 

   3  option lp=cplex;

  13  display 'lp     command line argument used bdmlp';

  15  display 'mip    command line argument used osl';

  16  display 'nlp    command line argument used conopt';

  22  display 'Page size  command line argument used 60';

  23  display 'Page width command line argument used 85';

  

---- Begin of Environment Report

LEVEL TYPE         LINE  FILE NAME

----------------------------------

    0 INPUT          23  C:\GAMS\GAMSPDF\GAMSPARM.GMS

 

LEVEL SETVAL                          TYPE        NUM TEXT

----------------------------------------------------------

    0 lp                              SCOPED        1 bdmlp

    0 mip                             SCOPED        1 osl

    0 nlp                             SCOPED        1 conopt

---- End of Environment Report

Notes:

The only non blank items that can be found within the Gams.commandlineparametername entries are those explicitly entered on the command line of the DOS level GAMS command or in the command line parameters box in the IDE.
Internal option statements addressing the same items have no effect on the Gams.commandlineparametername entries.
Default values for the parameters will not be reported.