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.


Reference

  • GAMS Development Corporation, Modeling Tool Box.

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.



$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 %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
Sets 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%