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 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
IloSolver
(documented in the ILOG Solver Reference Manual) extracts the
constraint.
Example
For example, you may write:
IloOr or(env); or.add(constraint1); or.add(constraint2); or.add(constraint3);
Those lines are equivalent to :
IloOr or = constraint1 || constraint2 || constraint3;
See Also:
IloAnd, IloConstraint, operator||
Constructor Summary | |
---|---|
public | IloOr() |
public | IloOr(IloOr::ImplClass *) |
public | IloOr(const IloEnv, const char *) |
Method Summary | |
---|---|
public void | add(const IloConstraintArray) |
public void | add(const IloConstraint) |
public IloOr::ImplClass * | getImpl() |
public void | remove(const IloConstraintArray) |
public void | remove(const IloConstraint) |
Inherited Methods from IloConstraint |
---|
getImpl |
Inherited Methods from IloIntExprArg |
---|
getImpl |
Inherited Methods from IloNumExprArg |
---|
getImpl |
Inherited Methods from IloExtractable |
---|
end, getEnv, getId, getImpl, getName, getObject, 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.