epstozero1.gms : Test writing eps as zero to GDX

Description

With $onEpsToZero (compile time) and option epsToZero=on one can change the data writing
behavior, so that EPS values get written as 0.

Contributor: Lutz Westermann, September 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : epstozero1.gms

$title Test writing eps as zero to GDX  (epstozero1,SEQ=879)

$onText
With $onEpsToZero (compile time) and option epsToZero=on one can change the data writing
behavior, so that EPS values get written as 0.

Contributor: Lutz Westermann, September 2021
$offText


Set i;
Parameter p(i<);
$onEps
$gdxIn zero
$load p
$gdxIn

$gdxUnload epsCT.gdx   p
$onEpsToZero
$gdxUnload zeroCT.gdx  p

$call                 gdxdiff zero.gdx epsCT.gdx > %system.NullFile%
$ifE errorlevel=0 $abort expecting difference
$call.checkErrorLevel gdxdiff zero.gdx zeroCT.gdx > %system.NullFile%

execute_unload "epsET.gdx",  p;
option epsToZero=on;
execute_unload "zeroET.gdx", p;

execute                 "gdxdiff zero.gdx epsCT.gdx > %system.NullFile%";
abort$(errorlevel=0)    "expecting difference";
execute.checkErrorLevel "gdxdiff zero.gdx zeroCT.gdx > %system.NullFile%";