> Are there equivalent ways to code AMPL prev/last/next/ord functions
>  in GLPK?

prev/last/next require some linear ordering of the set. Formally,
a linear ordering is the mapping S -> {1,2,...,n}, where n is the
cardinality of S. So, to describe some ordering it is sufficient to
assign a distinct ordinal number to each element of S:

param ordnum{S}, integer, >= 1, <= n;

To access elements of S by their ordinal numbers more efficiently
the inversion of ordnum can be used:

param ordinv{1..n}, symbolic, in S;

In principle, any set can be make equivalent to {1,2,...,n} having
a natural ordering (as in the latter case), where the difference is
only in notation of its elements.



_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to