[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] AMPL prev, last, next, ord functions - equivalents in GL
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] AMPL prev, last, next, ord functions - equivalents in GLPK? |
Date: |
Mon, 13 Mar 2006 12:10:25 +0300 |
> 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.