Description
GDX stores two types of domain information: Regular or relaxed. Both types need to be preserved when doing a gdxcopy (only with v7 and up). In GAMS we have to work hard to get a trailing blank, in shell script this error is easily made.
Small Model of Type : GAMS
Category : GAMS Test library
Main file : gdxcopy6.gms
$title Test gdxcopy with relaxed domain information (GDXCOPY6,SEQ=933)
$onText
GDX stores two types of domain information: Regular or relaxed. Both types
need to be preserved when doing a gdxcopy (only with v7 and up).
In GAMS we have to work hard to get a trailing blank, in shell script
this error is easily made.
$offText
set i(i) /i1*i10/;
set j(j) /j1*j10/
parameter p(i,j);
p(i,j) = uniform(0,1);
* Regular domain info test
* p comes with regular domain information (and sets i and j)
execute_unloaddi "out.gdx", p;
$onEcho > expected_regular.txt
SyNr Type DomInf Symbol
1 Set Regular i(i)
2 Set Regular j(j)
3 Par Regular p(i, j)
$offEcho
execute.checkErrorLevel 'gdxdump out.gdx domaininfo > actual.txt';
execute.checkErrorLevel 'diff -q actual.txt expected_regular.txt > %system.nullFile%';
execute.checkErrorLevel 'gdxcopy -V7C -Replace out.gdx > %system.nullFile%';
execute.checkErrorLevel 'gdxdump out.gdx domaininfo > actual.txt';
execute.checkErrorLevel 'diff -q actual.txt expected_regular.txt > %system.nullFile%';
execute.checkErrorLevel 'gdxcopy -V7U -Replace out.gdx > %system.nullFile%';
execute.checkErrorLevel 'gdxdump out.gdx domaininfo > actual.txt';
execute.checkErrorLevel 'diff -q actual.txt expected_regular.txt > %system.nullFile%';
* Relaxed domain info test
* p comes with relaxed domain information
execute_unload "out.gdx", p;
$onEcho > expected_relaxed.txt
SyNr Type DomInf Symbol
1 Par Relaxed p(i, j)
$offEcho
execute.checkErrorLevel 'gdxdump out.gdx domaininfo > actual.txt';
execute.checkErrorLevel 'diff -q actual.txt expected_relaxed.txt > %system.nullFile%';
execute.checkErrorLevel 'gdxcopy -V7C -Replace out.gdx > %system.nullFile%';
execute.checkErrorLevel 'gdxdump out.gdx domaininfo > actual.txt';
execute.checkErrorLevel 'diff -q actual.txt expected_relaxed.txt > %system.nullFile%';
execute.checkErrorLevel 'gdxcopy -V7U -Replace out.gdx > %system.nullFile%';
execute.checkErrorLevel 'gdxdump out.gdx domaininfo > actual.txt';
execute.checkErrorLevel 'diff -q actual.txt expected_relaxed.txt > %system.nullFile%';