Overview | Group | Tree | Graph | Index | Concepts |
This function creates and returns a constraint that abstracts an array of constrained Boolean
variables in a model. It differs from IloAbstraction
in that its y-array is an
array of Boolean variables (also known as 0-1 variables or binary variables). Like
IloAbstraction
, for each element x[i]
, there is a variable y[i]
corresponding to the abstraction of x[i] with respect to an array of values. That is,
x[i] = v with v in values if and only if y[i] = IloTrue; x[i] = v with v not in values if and only if y[i] = IloFalse.
This constraint maintains a many-to-one mapping that makes it possible to define constraints that impinge only on a particular set of values from the domains of constrained variables.
Example
For simplicity, assume that an array x
consists of three elements with the domains
{3}, {4}, and {5}. Assume that the values we are interested in are {4, 8, 12, 16}.
Then IloBoolAbstraction
produces the elements of the array y
, like this:
X & Values Y --- ------- ------- 3 4 IloFalse 4 8 --> IloTrue 5 12 IloFalse 16
Adding a Constraint to a Model, Extracting a Model for an Algorithm
In order for the constraint returned by IloBoolAbstraction
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
.
Exceptions
If the arrays x
and y
are not the same size, this function throws
the exception IloBoolAbstraction::InvalidArraysException
.