gdxdump2.gms : GDXDUMP - Testing the dumping Functionality on several GDX Files

Description

Several models from the GAMS Model Library are specified and solved iteratively.
The original GDX file containing all data of the solved model is compared with
the GDX file generated from the dumped GDX contents for each model to check if
GDXDUMP writes out the data correctly. In addition, the UelTable option will be
checked for all models.

Contributor: Jan-Erik Justkowiak, September 2018


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gdxdump2.gms

$title GDXDUMP - Testing the dumping Functionality on several GDX Files (GDXDUMP2,SEQ=784)

$onText
Several models from the GAMS Model Library are specified and solved iteratively.
The original GDX file containing all data of the solved model is compared with
the GDX file generated from the dumped GDX contents for each model to check if
GDXDUMP writes out the data correctly. In addition, the UelTable option will be
checked for all models.

Contributor: Jan-Erik Justkowiak, September 2018
$offText

$onEcho > makeTestRun.gms
Set modelName
/
trnsport, blend, prodmix, whouse, jobt, diet, aircraft, prodsch, pdi
uimp, magic, mexss, weapons, bid, process, chem, ship, linear, least
/;

File executeTestRun / executeTestRun.gms /;
put  executeTestRun;

loop(modelName,
   put '$onEcho > getData.gms'/;
   put '$call gamslib -q ' modelName.tl/;
   put '$include ' modelName.tl/;
   put '$gdxOut dumpMe.gdx'/;
   put '$unLoad'/ /;
   put 'Alias (*, allSetElements);'/;
   put '$gdxOut controlData.gdx'/;
   put '$unLoad'/;
   put '$offEcho'/ /;
   put '$call gams getData.gms lo=%gams.lo%'/;
   put '$ifE errorLevel<>0 $abort Error running ' modelName.tl/ /;

   put '$call gdxdump dumpMe.gdx UelTable=allSetElements > dumpedGDX.gms'/;
   put '$ifE errorLevel<>0 $abort Error dumping data from model ' modelName.tl/ /;

   put '$call gams dumpedGDX.gms gdx=dumpedGDX lo=%GAMS.lo%'/;
   put '$ifE errorLevel<>0 $abort Error running dumpedGDX.gms of model ' modelName.tl/ /;

   put '* Check the data'/;
   put '$call gdxdiff controlData.gdx dumpedGDX.gdx eps=1E-06 > %system.nullfile%'/;
   put '$ifE errorLevel<>0 $abort Data is not correct for dumping ' modelName.tl/ / /;
);
$offEcho

$call gams makeTestRun.gms lo=%gams.lo%
$ifE errorLevel<>0 $abort Error generating test run!

$call gams executeTestRun.gms lo=%gams.lo%
$ifE errorLevel<>0 $abort Error executing test run!