unload16.gms : Test command line parameter gdxSymbols

Description

This test checks the expected behavior for command line parameter gdxSymbols.

Contributor: Lutz Westermann, December 2023


Small Model of Type : GAMS


Category : GAMS Test library


Main file : unload16.gms

$title 'Test command line parameter gdxSymbols' (unload16,SEQ=946)

$onText
This test checks the expected behavior for command line parameter gdxSymbols.

Contributor: Lutz Westermann, December 2023
$offText


$onEcho > test.gms
Set i /i1*i3/;
Alias (i, iAlias);
Parameter p1(i) / #i 1 /
          p2(i)
          p3(i);
          
p2(i) = 2;

Variable z;
Binary Variable x(i);

Equation e;

e.. z =e= sum(i,x(i));

Model m /e/;
solve m max z use mip;

execute_unload 'all.gdx';
execute_unload 'assigned.gdx', p2, z, x, e;
execute_unload 'newOrChanged.gdx', i, iAlias, p1, p2, p3, z, x, e;
$offEcho

$call.checkErrorLevel gams test.gms lo=%GAMS.lo% gdx=CLPall s=1
$call.checkErrorLevel gdxdiff all.gdx CLPall.gdx > %system.NullFile%

$call.checkErrorLevel gams test.gms lo=%GAMS.lo% gdx=CLPassigned gdxSymbols=assigned
$call.checkErrorLevel gdxdiff assigned.gdx CLPassigned.gdx > %system.NullFile%

$call.checkErrorLevel gams test.gms lo=%GAMS.lo% gdx=CLPnewOrChanged gdxSymbols=newOrChanged
$call.checkErrorLevel gdxdiff newOrChanged.gdx CLPnewOrChanged.gdx > %system.NullFile%

* Check Alias explicity - gdxdiff does not care if that is a set or an Alias, ref devel/products#6944
$call.checkErrorLevel gdxdump newOrChanged.gdx > newOrChanged.txt
$call.checkErrorLevel gdxdump CLPnewOrChanged.gdx > CLPnewOrChanged.txt
$call.checkErrorLevel diff newOrChanged.txt CLPnewOrChanged.txt > %system.NullFile%

$onEcho > continue.gms
p3(i) = 3;

Parameter p4(i) / #i 4 /;

execute_unload 'all.gdx';
execute_unload 'assigned.gdx', p3;
execute_unload 'newOrChanged.gdx', p3, p4;
$offEcho

$call.checkErrorLevel gams continue.gms lo=%GAMS.lo% gdx=CLPall r=1 s=2
$call.checkErrorLevel gdxdiff all.gdx CLPall.gdx > %system.NullFile%

$call.checkErrorLevel gams continue.gms lo=%GAMS.lo% gdx=CLPassigned gdxSymbols=assigned r=1
$call.checkErrorLevel gdxdiff assigned.gdx CLPassigned.gdx > %system.NullFile%

$call.checkErrorLevel gams continue.gms lo=%GAMS.lo% gdx=CLPnewOrChanged gdxSymbols=newOrChanged r=1
$call.checkErrorLevel gdxdiff newOrChanged.gdx CLPnewOrChanged.gdx > %system.NullFile%

$onEcho > continue.gms
solve m max z use mip;

execute_unload 'all.gdx';
execute_unload 'assigned.gdx', z, x, e;
execute_unload 'newOrChanged.gdx', z, x, e;
$offEcho

$call.checkErrorLevel gams continue.gms lo=%GAMS.lo% gdx=CLPall r=2 s=3
$call.checkErrorLevel gdxdiff all.gdx CLPall.gdx > %system.NullFile%

$call.checkErrorLevel gams continue.gms lo=%GAMS.lo% gdx=CLPassigned gdxSymbols=assigned r=2
$call.checkErrorLevel gdxdiff assigned.gdx CLPassigned.gdx > %system.NullFile%

$call.checkErrorLevel gams continue.gms lo=%GAMS.lo% gdx=CLPnewOrChanged gdxSymbols=newOrChanged r=2
$call.checkErrorLevel gdxdiff newOrChanged.gdx CLPnewOrChanged.gdx > %system.NullFile%

$onEcho > continue.gms
execute_unload 'all.gdx';
$offEcho

$call.checkErrorLevel gams continue.gms lo=%GAMS.lo% gdx=CLPall r=3
$call.checkErrorLevel gdxdiff all.gdx CLPall.gdx > %system.NullFile%

$echo * > e.gms
$call.checkErrorLevel gams e.gms lo=%GAMS.lo% gdx=empty

$call.checkErrorLevel gams continue.gms lo=%GAMS.lo% gdx=CLPassigned gdxSymbols=assigned r=3
$call.checkErrorLevel gdxdiff empty.gdx CLPassigned.gdx > %system.NullFile%

$call.checkErrorLevel gams continue.gms lo=%GAMS.lo% gdx=CLPnewOrChanged gdxSymbols=newOrChanged r=3
$call.checkErrorLevel gdxdiff empty.gdx CLPnewOrChanged.gdx > %system.NullFile%

$onEcho > a.gms
Variable z;
$offEcho

$onEcho > b.gms
Equation e; e.. z=e=0;
execute_unload 'newOrChanged.gdx', e, z;
$offEcho

$call.checkErrorLevel gams a.gms s=0 lo=%GAMS.lo%
$call.checkErrorLevel gams b.gms r=0 lo=%GAMS.lo% gdx=CLPnewOrChanged gdxSymbols=newOrChanged
$call.checkErrorLevel gdxdiff newOrChanged.gdx CLPnewOrChanged.gdx > %system.NullFile%