ldidx03.gms : $loadIdx - checking restrictions

Description

Check basic operation of $loadIdx.
If the universe contains the counting labels they must be ordered.

Contributor: Steve Dirkse, Oct 2013


Small Model of Type : GAMS


Category : GAMS Test library


Main file : ldidx03.gms

$title $loadIdx - checking restrictions (ldidx03,SEQ=627)

$onText
Check basic operation of $loadIdx.
If the universe contains the counting labels they must be ordered.

Contributor: Steve Dirkse, Oct 2013
$offText

set iii / 1, 'one', 2, 'two', 3, 'three' /;
set trouble / 5, 4 /;
sets i1, i2, j1, j2, j3;
parameters
  a2 (i1,i2)
  a3 (j1,j2,j3)
  ;
$gdxIn idx1_
* the indices in a2 already exist, and are ordered: OK
$loadIdx a2
$gdxIn
abort$[card(a2) <> 4] 'unexpected read of a2', a2;

$gdxIn idx1_
* the indices in a3 already exist, but are NOT ordered: FAIL
$loadIdx a3
$gdxIn
$if errorfree $abort 'Compiler should reject this: AAA'
$clearError