load7.gms : Tests execute_loaddc

Description

This is a basic test for the enhanced execute_load with domain checking
(execute_loaddc). Any domain violations will be reported and flagged as
execution errors. In contrast, execute_load ignores all domain violations and
loads only data that meets the domain restrictions.

Contributor: Lutz Westermann, July 2013


Small Model of Type : GAMS


Category : GAMS Test library


Main file : load7.gms

$Title Tests execute_loaddc (LOAD7,SEQ=613)

$ontext
This is a basic test for the enhanced execute_load with domain checking
(execute_loaddc). Any domain violations will be reported and flagged as
execution errors. In contrast, execute_load ignores all domain violations and
loads only data that meets the domain restrictions.

Contributor: Lutz Westermann, July 2013
$offtext


* Prepare data
$onecho > data.gms
set i    /i1*i3/
    iSub /i1*i2/;
parameter pi(i);
pi(i) = ord(i);
$offecho

$call gams data.gms lo=%GAMS.lo% gdx=data
$if errorlevel 1 $abort Error creating data

* This should be OK: pi1 has data for i1
set i1;
parameter pi1(i1);
$gdxin data.gdx
$load i1=i
$gdxin
execute_loaddc 'data.gdx', pi1=pi;
display pi1;

* This should be OK: pi2 has data for more than i2, but we ignore that
set i2;
parameter pi2(i2);
$gdxin data.gdx
$load i2=iSub
$gdxin
execute_load 'data.gdx', pi2=pi;
display pi2;

* This should not be OK: pi3 has data for more than i3, and we use domain checking
set i3;
parameter pi3(i3);
$gdxin data.gdx
$load i3=iSub
$gdxin
execute_loaddc 'data.gdx', pi3=pi;
display pi3;
abort$(not execerror) 'We should see a domain violation here';
execerror=0;