NO FRAMES

Class IloOr

Definition file: ilconcert/ilomodel.h
Represents a disjunctive constraint.

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 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:

Constructor Summary
public IloOr()
public IloOr(IloOrI * impl)
public IloOr(const IloEnv env, const char * name=0)
Method Summary
public voidadd(const IloConstraintArray cons) const
public voidadd(const IloConstraint con) const
public IloOrI *getImpl() const
public voidremove(const IloConstraintArray cons) const
public voidremove(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

IloOr

public IloOr()
This constructor creates an empty handle. You must initialize it before you use it.

IloOr

public IloOr(IloOrI * impl)
This constructor creates a handle object from a pointer to an implementation object.

IloOr

public IloOr(const IloEnv env, const char * name=0)

This constructor creates a disjunctive constraint for use in env. The optional argument name is set to 0 by default.


Method Detail

add

public void add(const IloConstraintArray cons) const

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.

Note
The member function add notifies Concert Technology algorithms about this change of this invoking object.

add

public void add(const IloConstraint con) const

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.

Note
The member function add notifies Concert Technology algorithms about this change of this invoking object.

getImpl

public IloOrI * getImpl() const
This member function returns a pointer to the implementation object of the invoking handle.

remove

public void remove(const IloConstraintArray cons) const

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.

Note
The member function remove notifies Concert Technology algorithms about this change of this invoking object.

remove

public void remove(const IloConstraint con) const

This member function removes constraint from the invoking disjunctive constraint so that the invoking disjunctive constraint no longer applies to constraint.

Note
The member function remove notifies Concert Technology algorithms about this change of this invoking object.