| Overview | Group | Tree | Graph | Index | Concepts |

An instance of IloAnd represents a conjunctive constraint.
In other words, it defines a logical conjunctive-AND among any
number of constraints. It lets
you represent a constraint on constraints in your model. Since an instance of
IloAnd is a constraint itself,
you can build up extensive conjunctions by
adding constraints to an instance of IloAnd by means of
the member function IloAnd::add.
You can also remove constraints
from an instance of IloAnd by means of the member function
IloAnd::remove.
The elements of a conjunctive constraint must be in the same environment.
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.
Conjunction of Goals
If you want to represent the conjunction of goals
(rather than constraints) in your
model, then you should consider the function IloAndGoal
(documented in the IBM ILOG Solver Reference Manual).
What Is Extracted
All the constraints (that is, instances of
IloConstraint or one of its subclasses)
that have been added to a conjunctive constraint
(an instance of IloAnd) and that have
not been removed from it will be extracted when an algorithm such as
IloCplex, IloCP, or IloSolver
extracts the constraint.
Example
For example, you may write:
IloAnd and(env); and.add(constraint1); and.add(constraint2); and.add(constraint3);
Those lines are equivalent to :
IloAnd and = constraint1 && constraint2 && constraint3;
See Also:
IloConstraint, IloOr, operator&&
| Constructor Summary | |
|---|---|
public | IloAnd() |
public | IloAnd(IloAndI * impl) |
public | IloAnd(const IloEnv env, const char * name=0) |
| Method Summary | |
|---|---|
public void | add(const IloConstraintArray array) const |
public void | add(const IloConstraint constraint) const |
public IloAndI * | getImpl() const |
public void | remove(const IloConstraintArray array) const |
public void | remove(const IloConstraint constraint) const |
Inherited Methods from IloConstraint |
|---|
getImpl |
Inherited Methods from IloIntExprArg |
|---|
getImpl |
Inherited Methods from IloNumExprArg |
|---|
getImpl |
Inherited Methods from IloExtractable |
|---|
asConstraint, asIntExpr, asModel, asNumExpr, asObjective, asVariable, end, getEnv, getId, getImpl, getName, getObject, isConstraint, isIntExpr, isModel, isNumExpr, isObjective, isVariable, setName, setObject |
| Constructor Detail |
|---|
This constructor creates a conjunctive constraint for use in the environment
env. 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.
The optional argument name is set to 0 by default.
| Method Detail |
|---|
This member function makes all the elements in array elements of the
invoking conjunctive constraint. In other words, it applies the invoking conjunctive
constraint to all the elements of array.
add notifies Concert Technology algorithms about this
change to the invoking object.
This member function makes constraint one of the elements of the
invoking conjunctive constraint. In other words, it applies the invoking conjunctive
constraint to constraint.
add notifies Concert Technology algorithms about
this change to the invoking object.This member function removes all the elements of array from the
invoking conjunctive constraint so that the invoking conjunctive constraint no longer
applies to any of those elements.
remove notifies Concert Technology algorithms about
this change to the invoking object.
This member function removes constraint from the invoking conjunctive
constraint so that the invoking conjunctive constraint no longer applies to
constraint.
remove notifies Concert Technology algorithms about
this change to the invoking object.