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