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

An instance of IloOr represents a disjunctive constraint.
In other words, it defines a disjunctive-OR among any number of constraints.
Since an instance of IloOr is a constraint itself,
you can build up extensive disjunctions
by adding constraints to an instance of IloOr
by means of the member
function IloOr::add.
You can also remove constraints
from an instance of IloOr by means of the member function
IloOr::remove.
The elements of a disjunctive 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.
Disjunctive Goals
If you would like to represent a disjunctive-OR as a goal (rather than a
constraint), then you should consider the function IloOrGoal,
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 disjunctive constraint (an instance of IloOr)
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:
IloOr myor(env); myor.add(constraint1); myor.add(constraint2); myor.add(constraint3);
Those lines are equivalent to :
IloOr or = constraint1 || constraint2 || constraint3;
See Also:
IloAnd, IloConstraint, operator||
| Constructor Summary | |
|---|---|
public | IloOr() |
public | IloOr(IloOrI * impl) |
public | IloOr(const IloEnv env, const char * name=0) |
| Method Summary | |
|---|---|
public void | add(const IloConstraintArray cons) const |
public void | add(const IloConstraint con) const |
public IloOrI * | getImpl() const |
public void | remove(const IloConstraintArray cons) const |
public void | remove(const IloConstraint con) 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 disjunctive constraint for use in env.
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 disjunctive constraint. In other words, it applies the invoking disjunctive
constraint to all the elements of array.
add notifies Concert Technology algorithms about this
change of this invoking object.This member function makes constraint one of the elements of the
invoking disjunctive constraint. In other words, it applies the invoking disjunctive
constraint to constraint.
add notifies Concert Technology algorithms about
this change of this invoking object. This member function removes all the elements of array from the
invoking disjunctive constraint so that the invoking disjunctive constraint no longer
applies to any of those elements.
remove notifies Concert Technology algorithms about
this change of this invoking object.
This member function removes constraint from the invoking disjunctive
constraint so that the invoking disjunctive constraint no longer applies to
constraint.
remove notifies Concert Technology algorithms about
this change of this invoking object.