Skip to main content
FRAMES NO FRAMES

Class IloAlternative

Definition file: ilconcert/ilosmodel.h
Map of IloAlternativeIloAlternativeIloAlternativeIloConstraintIloIntExprArgIloNumExprArgIloExtractable
An instance of this class represents an alternative constraint.

An instance of IloAlternative represents an alternative constraint. An alternative constraint between an interval variable a and a set of interval variables {b1,...,bn} models an exclusive alternative between {b1,...,bn}. If interval a is present, then exactly one of intervals {b1,...,bn} is present and a starts and ends together with this specific interval. Interval a is absent if and only if all intervals in {b1,...,bn} are absent.

Additionally, an alternative constraint can specify a non-negative integer cardinality c. In this case, if interval a is present, it is not 1 but c intervals in the set {b1,...,bn} that will be selected and all these c intervals will have to start and end together with interval a.

You must add this constraint to a model and extract the model to an algorithm in order for it to be taken into account.

Note: This constraint cannot be used in a logical constraint.

For more information on the alternative constraint, see the concept Constraints on groups of interval variables in CP Optimizer.

Method Summary
public IloAlternativeI *getImpl() const
public IloAlternative()
public IloAlternative(IloAlternativeI * impl)
public IloAlternative(const IloEnv env, const IloIntervalVar a, const IloIntervalVarArray bs, const char * name=0)
public IloAlternative(const IloEnv env, const IloIntervalVar a, const IloIntervalVarArray bs, IloInt c, const char * name=0)
public IloAlternative(const IloEnv env, const IloIntervalVar a, const IloIntervalVarArray bs, const IloIntExprArg c, const char * name=0)
Inherited Methods from IloConstraint
getImpl, IloConstraint, IloConstraint
Inherited Methods from IloIntExprArg
getImpl, IloIntExprArg, IloIntExprArg
Inherited Methods from IloNumExprArg
getImpl, IloNumExprArg, IloNumExprArg
Inherited Methods from IloExtractable
asConstraint, asIntExpr, asModel, asNumExpr, asObjective, asVariable, end, getEnv, getId, getImpl, getName, getObject, IloExtractable, isConstraint, isIntExpr, isModel, isNumExpr, isObjective, isVariable, removeFromAll, setLocation, setName, setObject
Method Detail

IloAlternative

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

IloAlternative

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

IloAlternative

public IloAlternative(const IloEnv env, const IloIntervalVar a, const IloIntervalVarArray bs, const char * name=0)

This constructor creates an alternative constraint between interval variable a and the set of interval variables in the array bs and makes it part of the environment env. If a is present, one of the intervals in bs will be selected by the alternative constraint.


IloAlternative

public IloAlternative(const IloEnv env, const IloIntervalVar a, const IloIntervalVarArray bs, IloInt c, const char * name=0)

This constructor creates an alternative constraint between interval variable a and the set of interval variables in the array bs with cardinality c and makes it part of the environment env. If a is present, c intervals in bs will be selected by the alternative constraint.


IloAlternative

public IloAlternative(const IloEnv env, const IloIntervalVar a, const IloIntervalVarArray bs, const IloIntExprArg c, const char * name=0)

This constructor creates an alternative constraint between interval variable a and the set of interval variables in the array bs with cardinality c and makes it part of the environment env. If a is present, c intervals in bs will be selected by the alternative constraint.


getImpl

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