An instance of IloInverse
represents an inverse constraint. Informally,
we say that an inverse constraint works on two arrays, say, f
and
invf
, so that an element of f
composed with the
corresponding element of invf
produces the index of that element.
In formal terms, if the length of the array f
is n
, and
the length of the array invf
is m
, then the inverse
constraint insures that:
- for all
i
in the interval [0, n-1]
, if f[i]
is in [0, m-1]
then invf[f[i]] == i
; - for all
j
in the interval [0, m-1]
, if
invf[j]
is in [0, n-1]
then f[invf[j]] == j
.
In order for a constraint to take effect, you must add it to a model with the
template IloAdd
or the member function
IloModel::add
and extract the model for an algorithm
with the member function IloAlgorithm::extract
.
Most member functions in this class contain assert
statements. For an
explanation of the macro NDEBUG
(a way to turn on or turn off these
assert
statements), see the concept
Assert and NDEBUG.
This constructor creates an empty handle. You must initialize it before you use it.
This constructor creates a handle object from a pointer to an implementation object.
This constructor creates an inverse constraint that if the length of the array
f
is n
, and the length of the array invf
is
m
, then this function returns a constraint that insures that:
- for all
i
in the interval [0, n-1]
, if f[i]
is in [0, m-1]
then invf[f[i]] == i
; - for all
j
in the interval [0, m-1]
, if
invf[j]
is in [0, n-1]
then f[invf[j]] == j
.
This member function returns a pointer to the implementation object of the invoking handle.