Class IloSequence
Definition file: ilconcert/ilomodel.h
An instance of this class represents a sequence constraint in a model. As you can
see from the parameters of its constructor, an instance of this class enables 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 IloSequence::ImplClass * | getImpl() |
public IloSequence()
This constructor creates an empty handle. You must initialize it before you use it.
public IloSequence(IloSequence::ImplClass * impl)
This constructor creates a handle object from a pointer to an implementation object.
This constructor creates a sequence constraint in an environment. The parameter
nbMin
indicates a minimum number of allowable values, and
nbMax
indicates a maximum number of allowable values. The parameter
seqWidth
indicates the number of elements in a sequence. The parameter
cards
indicates 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 IloSequence::ImplClass * getImpl()
This member function returns a pointer to the implementation object of the invoking handle.