Overview | Group | Tree | Graph | Index | Concepts |
The class IlcBoolVarArray
is the class for an array
of instances of IlcBoolVar
.
Generic Constraints
The array makes it easier to implement generic constraints. In this context, a generic constraint is a constraint that applies to all of the variables in the array. Member functions of the array class are available to post such generic constraints. A generic constraint is then allocated and recorded only once for all the variables in the array. This fact represents a significant economy in memory, compared to allocating and recording one constraint per variable.
Backtracking and Reversibility
All the functions and member functions capable of modifying arrays of constrained Boolean variables are reversible. In particular, when modifiers and functions that post constraints are called, the state before their call will be saved by Solver.
Empty Handle or Null Array
It is possible to create a null array, or in other words, an empty handle. When you do so, only these operations are allowed on that null array:
getSize
for the null array returns 0 (zero).
ok
returns
IlcFalse
for a null array.Attempts to access a null array in any other way will throw an exception
(an instance of IloSolver::SolverErrorException
).
See Also:
IlcAbstraction, IlcBoolAbstraction, IlcIndex
Constructor Summary | |
---|---|
public | IlcBoolVarArray() |
public | IlcBoolVarArray(IlcBoolVarArrayI * impl) |
public | IlcBoolVarArray(const IlcBoolVarArray & array) |
public | IlcBoolVarArray(IloSolver solver, IlcInt size) |
Method Summary | |
---|---|
public void | display(ostream & stream) const |
public IlcBoolVar & | getElem(IlcInt index) const |
public IlcBoolVarArrayI * | getImpl() const |
public IlcInt | getSize() const |
public IloSolver | getSolver() const |
public void | operator=(const IlcBoolVarArray & array) |
public IlcBoolVar & | operator[](IlcInt index) const |
Constructor Detail |
---|
This constructor creates an uninitialized array of constrained Boolean variables. The index range of the array is undefined. The array must be assigned before it can be used.
This constructor creates a handle object (an instance of the class IlcBoolVarArray
)
from a pointer to an object (an instance of the implementation class IlcBoolVarArrayI
).
This copy constructor creates a new instance of IlcBoolVarArray
. After execution of
this constructor, both the newly created array and array
point to the same implementation object.
This constructor creates an instance of IlcBoolVarArray
and adds it to those
belonging to solver
. The parameter size
, of course, indicates the size of the new array.
Method Detail |
---|
This member function is called by the operator <<
. The name of the invoking
array, if it has been assigned with setName
, or the string IlcBoolVarArrayI
,
otherwise, will be printed on the given output stream, followed by the display of all the elements of
the array enclosed by brackets.
This member function returns a reference to the constrained Boolean variable located at
index
in the invoking array.
This member function returns a pointer to the implementation object of the invoking array.
This member function returns an integer that indicates the size of the invoking array.
This member function returns an instance of IloSolver
associated with
the invoking array.
This assignment operator copies array
into the invoking constrained Boolean array by
assigning an address to the handle pointer of the invoking object. That address is the location of the
implementation object of the argument array
.
This subscripting operator returns a reference to a constrained Boolean variable corresponding to
the given index
in the invoking array of constrained Boolean variables. Solver will
throw an exception (an instance of IloSolver::SolverErrorException
) with the message
"bad index
" if the given index
is not a valid one for the invoking array
of constrained Boolean variables.