Class IloSequence
Definition file: ilconcert/ilomodel.h
For constraint programming: a sequence constraint in a model.
An instance of this class represents a sequence constraint in a model.
As you can see from the arguments of its constructor,
an instance of this class makes it possible for you to
constrain:
- the minimum number of allowable values in the sequence,
- the maximum number of allowable values in the sequence,
- the frequency of allowable values
(that is, how often a value occurs in the sequence),
- the number of elements in the sequence.
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.
See Also:
IloConstraint, IloDistribute
| Method Summary |
|---|
public IloSequenceI * | getImpl() const |
Inherited Methods from IloExtractable |
|---|
asConstraint, asIntExpr, asModel, asNumExpr, asObjective, asVariable, end, getEnv, getId, getImpl, getName, getObject, isConstraint, isIntExpr, isModel, isNumExpr, isObjective, isVariable, setName, setObject |
public IloSequence()
This constructor creates an empty handle. You must initialize it before you use it.
public IloSequence(IloSequenceI * impl)
This constructor creates a handle object from a pointer to an implementation object.
This constructor creates a sequence constraint in an environment.
The argument
nbMin specifies a minimum number of allowable values, and
nbMax specifies a maximum number of allowable values.
The argument
seqWidth specifies the number of elements in a sequence.
The argument
cards specifies an array of cardinalities
(that is, how many occurrences).
In the new constraint created by this class,
the constrained variables in the array
cards will be equal to the number of occurrences in the array
vars of the values in the array values such that for each
sequence of seqWidth (a number) consecutive constrained variables of
vars, at least nbMin and at most nbMax values
are assigned to a constrained variable of the sequence.
The arrays cards and values must be the same length;
otherwise, on platforms where C++ exceptions are supported and exceptions are enabled,
Concert Technology throws the exception InvalidArraysException.
public IloSequenceI * getImpl() const
This member function returns a pointer to the implementation object of the invoking handle.