Overview | Group | Tree | Graph | Index | Concepts |
To create a generic constraint, you need generic variables. In order to
create generic variables for an array of constrained expressions, Solver
provides this class IlcIndex
.
A generic constraint is a constraint shared by an array of
variables. For example, IlcAllDiff
is a
generic constraint that insures that all the elements of a given array are
different from one another. Solver provides generic constraints to save
memory since, if you use them, you can avoid allocating one object per
variable.
You create a generic constraint simply by stating the constraint over generic variables. Each generic variable stands for all the elements of an array of constrained variables.
In that sense, generic variables are only syntactic objects provided by
Solver to support generic constraints, and they can be used only for
creating generic constraints. To create a generic variable, you use the
operator []
. The argument passed to that operator is known as
the index for that generic variable; we say that the generic
variable stems from that index.
An index is simply a syntactical means for creating generic variables for
an array of constrained variables. The index has no value, and no value can
be assigned to it. Any attempt to access the value of an index will throw an
exception (an instance of IloSolver::SolverErrorException
).
See Also:
IlcAnyVarArray, IlcCard, IlcIntVarArray, IlcSetOf
Constructor Summary | |
---|---|
public | IlcIndex(IlcIndexI * impl) |
public | IlcIndex(IloSolver solver) |
Method Summary | |
---|---|
public IlcIndexI * | getImpl() const |
Constructor Detail |
---|
This constructor creates a handle object (an instance of the class IlcIndex
) from a
pointer to an object (an instance of the implementation class IlcIndexI
).
This constructor creates an index which will be managed by solver
.
Method Detail |
---|
This member function returns a pointer to the implementation object of the invoking handle, an index.