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