ldidx02.gms : $loadIdx - checking restrictions

Description

Check basic operation of $loadIdx.  $loadIdx is very strict in its
checks, so there are many ways to make it raise an error.

Contributor: Steve Dirkse, Oct 2013


Small Model of Type : GAMS


Category : GAMS Test library


Main file : ldidx02.gms

$TITLE $loadIdx - checking restrictions (ldidx02,SEQ=626)

$ontext
Check basic operation of $loadIdx.  $loadIdx is very strict in its
checks, so there are many ways to make it raise an error.

Contributor: Steve Dirkse, Oct 2013
$offtext

sets j1, j3;
parameters a3 (j1, j3, j3);
* 2nd and 3rd dims have different extent, so cannot use a common set
$gdxin idx1_
$loadIdx a3
$gdxin
$if errorfree $abort 'Compiler should reject this: AAA'
$clearerror

set t / 1 * 5 /;
parameter c(t,t,t);
* declared size must match actual size
$gdxin idx1_
$loadIdx c=a3
$gdxin
$if errorfree $abort 'Compiler should reject this: BBB'
$clearerror

* -----  load the data and index sets, using aliases in declaration
sets w1, w2, w3;
alias (v1,w1), (v2,w2), (v3,w3);
parameter e10(v1,v2,v3,v3,v3,v3,v3,v3,v3,v3);
$gdxin idx1_
$loadIdx e10=a10
$gdxin
$if errorfree $abort 'Compiler should reject this: CCC'
$clearerror