Class IloAllDiff
Definition file: ilconcert/ilomodel.h
A constraint that forces constrained integer variables to assume different values in a model.
An instance of this class is a constraint that forces constrained integer
variables to assume different values from one another in a model. In other words, no
two of those integer variables will have the same integer value when this constraint
is satisfied.
In order for the 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.
What Is Extracted
All the variables (that is, instances of IloNumVar
or one of its subclasses) that have appeared as a parameter of a constructor of
IloAllDiff
and all variables that have been explicitly added to the
instance of IloAllDiff
will be extracted by an algorithm (such as an
instance of IloSolver
, documented in the ILOG Solver Reference Manual)
that extracts that constraint.
See Also:
IloAdd, IloConstraint, IloDiff
Method Summary |
---|
public IloAllDiff::ImplClass * | getImpl() |
public IloAllDiff()
This constructor creates an empty handle. You must initialize it before you use it.
public IloAllDiff(IloAllDiff::ImplClass * impl)
This constructor creates a handle object from a pointer to an implementation object.
This constructor creates a constraint that forces all the integer variables in
vars
to assume different values from each other. If vars
is empty, this constructor creates an empty instance of IloAllDiff
, and
then you must fill the constraint; that is, you must put variables into the array.
You must add this constraint to a model and extract the model for an algorithm in
order for it to be taken into account.
public IloAllDiff::ImplClass * getImpl()
This member function returns a pointer to the implementation object of the invoking handle.