gmstest.gms : Test sript for library models

Description

This program tests return and status codes of all models
in the GAMS model library. This generates a large number of files
and may use some 20Mb of disk space and therefore should be
executed in a separate directory. Return and status codes are
collected in the 'Trace File' which can be further analyzed
by using 'A=GT', the gtrace option of GAMS.


Small Model of Type : GAMS


Category : GAMS Model library


Main file : gmstest.gms   includes :  gamsmod.inc  gamsref.inc

$title Makes a Trace of all Models in the Library (GMSTEST,SEQ=195)

$onText
This program tests return and status codes of all models
in the GAMS model library. This generates a large number of files
and may use some 20Mb of disk space and therefore should be
executed in a separate directory. Return and status codes are
collected in the 'Trace File' which can be further analyzed
by using 'A=GT', the gtrace option of GAMS.


GAMS Development Corporation, Modeling Tool Box.

By default, all models in the library will be executed.
You can override this with a U1 or USER1 command line
parameter. For example

 > gams gmstest                           will run all models

 > gams gmstest u1=small                  will run small models only

 > gams gmstest u1=big                    will run big models only

 > gams gmstest u1="ord(s) < 5"           runs first 5 models

 > gams gmstest --solver conopt"          will run all models and sets CONOPT
                                          as default whereever possible

 > gams gmstest --solver conopt --pure 1" will run all models that can be solved
                                          by CONOPT alone. No other solver will be
                                          called.

Keywords: GAMS language features, GAMS model library
$offText

$eolCom //

$set trace     gmstest.txt    // trace file  (will be appended to)
$set tracerep  gmstest.rep    // Gtrace report file
$set pf        gmstest.prm    // temporary input file
$set setup     gmstest.set    // gams program to generate new source
$set setupout  gmstest.out    // listing file for setup
$set drive     gmstest.inc    // new gams source generated by setup
$set tl        %gams.tracelevel%
$set xsolver   0              // specific solver testing
$set xpure     0              // run model that have solver capable model types only

$set cond %gams.u1%
$if  '%cond%' == ''      $set cond 'ord(s) <= card(s)'
$ifI '%cond%' == 'demo'  $set cond 'not big(s)'
$ifI '%cond%' == 'small' $set cond 'not big(s)'
$ifI '%cond%' == 'big'   $set cond 'big(s)'
$ifI '%cond%' == 'test'  $set cond 'ord(s) <= 2'

$set gsolver ''
$if not '%gams.lp%'     == '' $set gsolver %gsolver% lp=%gams.lp%
$if not '%gams.rmip%'   == '' $set gsolver %gsolver% rmip=%gams.rmip%
$if not '%gams.mip%'    == '' $set gsolver %gsolver% mip=%gams.mip%
$if not '%gams.nlp%'    == '' $set gsolver %gsolver% nlp=%gams.nlp%
$if not '%gams.dnlp%'   == '' $set gsolver %gsolver% dnlp=%gams.dnlp%
$if not '%gams.cns%'    == '' $set gsolver %gsolver% cns=%gams.cns%
$if not '%gams.mcp%'    == '' $set gsolver %gsolver% mcp=%gams.mcp%
$if not '%gams.rminlp%' == '' $set gsolver %gsolver% rminlp=%gams.rminlp%
$if not '%gams.minlp%'  == '' $set gsolver %gsolver% minlp=%gams.minlp%
$if not '%gams.qcp%'    == '' $set gsolver %gsolver% qcp=%gams.qcp%
$if not '%gams.rmiqcp%' == '' $set gsolver %gsolver% rmiqcp=%gams.rmiqcp%
$if not '%gams.miqcp%'  == '' $set gsolver %gsolver% miqcp=%gams.miqcp%

$onEcho >> %trace%
* %system.gstring%
* %system.date% %system.time% Condition = %cond%
* %solver% U1=%gams.u1%
$offEcho

$echo trace %trace% lo 2 threads %gams.threads% %gsolver% optfile 1 > %pf%

$if set solver $set xsolver 1       // set defaults to specified solver
$if set pure   $set xpure   %pure%  // run model with model types not handled by specific solver
$onEcho > %setup%
$include gamsmod.inc
Set
   SolverNames                  / system.SolverNames           /
   Platforms                    / system.Platforms             /
   SMP(SolverNames,t,Platforms) / system.SolverTypePlatformMap /
   mySM(t) 'model types available for tested solver';

mySM(t) = yes;

$if %xsolver% == 0 $goTo nosolver
$if %xpure%   == 1 mySM(t) = SMP('%solver%',t,'%system.platform%');
* Append
File fpf / %pf% /; fpf.ap = 1;
loop(SMP('%solver%',t,'%system.platform%'), put fpf ' ' t.tl:0 '=%solver%';);
putClose fpf;

$label nosolver
File drive / %drive% /; drive.lcase = 1;
put  drive '*   GAMSLib Start';
loop(sm(s,m)$((%cond%) and (not notest(s))),
   if(sum(ts(t,s),1) = sum(ts(mySM,s),1),
      put / '$call gamslib -q ' m.tl
          / '$log  ===> executing  ' m.tl:0'.gms';
      put / '$echo JobStart ' m.tl:0 ' >> %trace%'
          / '$call gams ' m.tl ' jt=' m.tl ' pf=%pf%';
   );
);
putClose /'*   GAMSLib End';
$offEcho

$echo $error gmssetup failed - look at %setupout% > %drive%
$if not errorfree $exit

$log  // start new log line
$call gams %setup% o %setupout% lo=0 // generate %drive% file

$include %drive%                     // run all models
$if not errorfree $exit
$call gams %trace% a=gt ps=0 pw=255 o=%tracerep% tl=%tl% lo=0 // produce report
$log ===>  Look for report in file %tracerep%