gams:error_set_used_in_ord_or_lag_is_not_ordered

The ordering properties of a set can depend on the data in the set, and not on use. I am attaching an example, with comments, that should make this clear. Note: The functions `sameas`

, `.pos`

, and `.val`

will also work, if the set is not ordered.

* $ontext * Here, the set 'big' is not ordered; this is because the * elements in it have already appeared (in the sets even and odd), * but appeared in the order 0, 2, 4, 1, 3, 5, * not 0, 1, 2, 3, 4, 5 * Thus you will get an error message with the code below: * 198 Set used in 'ord' or lag is not ordered. * Hint: Some of the elements of the set were used before this * was initialized and the order was different from the order used * in this set. Try to initialize the set earlier. SETS even / 0, 2, 4 /, odd / 1, 3, 5 /, big / 0 * 5 /; * $offtext $ontext * Here, the set 'big' is ordered * and the elements in even and odd occur in this same order, * so they are ordered as well. SETS big / 0 * 5 /, even / 0, 2, 4 /, odd / 1, 3, 5 /; $offtext parameter oo(big); oo(big) = ord(big); display oo;

IMPRESSUM / LEGAL NOTICE
PRIVACY POLICY
gams/error_set_used_in_ord_or_lag_is_not_ordered.txt · Last modified: 2008/10/15 12:17 by support