uldidx03.gms : unloadIdx - checking compilation restrictions

Description

Check basic operation of execute_unloadIdx.  We expect to write only
parameters.  We test here for things that are rejected at compile time.
N.B. Currently you have to run this with action=compile (a=c).
Check for:
  - writing a set: rejected
  - writing a variable: rejected
  - writing a parameter indexed by the universe: rejected
  - writing a parameter indexed by an alias to the universe: rejected

Contributor: Steve Dirkse, Oct 2013


Small Model of Type : GAMS


Category : GAMS Test library


Main file : uldidx03.gms

$TITLE unloadIdx - checking compilation restrictions (uldidx03,SEQ=624)
$ondollar

$ontext
Check basic operation of execute_unloadIdx.  We expect to write only
parameters.  We test here for things that are rejected at compile time.
N.B. Currently you have to run this with action=compile (a=c).
Check for:
  - writing a set: rejected
  - writing a variable: rejected
  - writing a parameter indexed by the universe: rejected
  - writing a parameter indexed by an alias to the universe: rejected

Contributor: Steve Dirkse, Oct 2013
$offtext


set i / 1 * 10 /;
alias(u,*);
parameter b(i)  / 1 1.5 /;
parameter s1(*) / 2 2.5 /;
parameter s2(u) / 2 2.5 /;


variable x / L 4, M eps /;


execute_unloadIdx 'tmp', b, i;
$if errorfree $abort 'Compiler should reject passing a set to unloadIdx'
$clearerror

execute_unloadIdx 'tmp', x;
$if errorfree $abort 'Compiler should reject passing a variable to unloadIdx'
$clearerror

execute_unloadIdx 'tmp', s1;
$if errorfree $abort 'Compiler should reject s1(*)'
$clearerror

execute_unloadIdx 'tmp', s2;
$if errorfree $abort 'Compiler should reject s2(u), u=universe'
$clearerror

* terminate should end compilation and prevent any attempt at execution
$terminate