empsp01.gms : Test EMPSP keyword stageDefault

Description

This test checks the correctness of the EMPSP keyword stageDefault. For
this we use the model nbcontindep which has 3 stages and run it with different
stage settings which should all be equivalent.

Contributor: Lutz Westermann, October 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : empsp01.gms

$title Test EMPSP keyword stageDefault (EMPSP01,SEQ=881)

$onText
This test checks the correctness of the EMPSP keyword stageDefault. For
this we use the model nbcontindep which has 3 stages and run it with different
stage settings which should all be equivalent.

Contributor: Lutz Westermann, October 2021
$offText


$call.checkErrorLevel emplib -q nbcontindep
$include nbcontindep.gms

* By default, stage 1 is used for symbols without explict stage
execute_unload 'default.gdx', Row1, Row2, Row3, Row4, Profit, Z, X, I, L, S, Y, E;


* Run the model with all stages defined explicitly
put emp '* problem %gams.i%'/;
$onPut
randvar d normal 45 10
randvar r normal -3 2
stage 1 Row1 X
stage 2 d
stage 3 r
stage 2 I L S
stage 3 Z Y E
stage 2 Row2 Row3
stage 3 Profit Row4
$offPut
* Lindo can handle continuous distributions directly
* For other EMPSP solvers d and r need to be sampled aqead of time
$if not '%gams.emp%'==lindo put 'sample d r 6';
putclose emp;

solve nb max z use emp scenario dict;
execute_unload 'explicit.gdx', Row1, Row2, Row3, Row4, Profit, Z, X, I, L, S, Y, E;
execute.checkErrorLevel 'gdxdiff default.gdx explicit.gdx > %system.NullFile%';


* Run the model with stageDefault=2 (and not setting this stage explicitly)
put emp '* problem %gams.i%'/;
$onPut
randvar d normal 45 10
randvar r normal -3 2
stage 1 Row1 X
stage 3 r
stage 3 Z Y E
stage 3 Profit Row4
stageDefault 2
$offPut
* Lindo can handle continuous distributions directly
* For other EMPSP solvers d and r need to be sampled aqead of time
$if not '%gams.emp%'==lindo put 'sample d r 6';
putclose emp;

solve nb max z use emp scenario dict;
execute_unload 'stageDef2.gdx', Row1, Row2, Row3, Row4, Profit, Z, X, I, L, S, Y, E;
execute.checkErrorLevel 'gdxdiff default.gdx stageDef2.gdx > %system.NullFile%';


* Run the model with stageDefault=3 (and not setting this stage explicitly)
put emp '* problem %gams.i%'/;
$onPut
randvar d normal 45 10
randvar r normal -3 2
stage 1 Row1 X
stage 2 d
stage 2 I L S
stage 2 Row2 Row3
stageDefault 3
$offPut
* Lindo can handle continuous distributions directly
* For other EMPSP solvers d and r need to be sampled aqead of time
$if not '%gams.emp%'==lindo put 'sample d r 6';
putclose emp;

solve nb max z use emp scenario dict;
execute_unload 'stageDef3.gdx', Row1, Row2, Row3, Row4, Profit, Z, X, I, L, S, Y, E;
execute.checkErrorLevel 'gdxdiff default.gdx stageDef3.gdx > %system.NullFile%';