Skip to main content
FRAMES NO FRAMES

Class IloCPEngine

Definition file: ilcp/cpext.h
Map of IloCPEngineIloCPEngineIloCPEngineIlcCPEngine
An instance of this class represents a search engine for CP Optimizer.

This class adds functionality to IlcCPEngine in order to access Ilc-level objects, particularly variables from Concert technology objects such as IloIntVar and IloIntervalVar.

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.

See Also:

Method Summary
public IloCPEngine::PrintIntervalVarDomainsdomain(const IloIntervalVar a) const
public IloCPEngine::PrintNumVarDomainsdomain(const IloIntVarArray vars) const
public IloCPEngine::PrintNumVarDomainsdomain(const IloNumVar var) const
public IlcCumulElementVargetCumulElement(const IloCumulFunctionExpr f) const
public IloIntgetDomainSize(const IloIntVar var) const
public IloIntgetDomainSize(const IloNumVar var) const
public IloIntgetEnd(const IloIntervalVar a) const
public IloIntgetEndMax(const IloIntervalVar a) const
public IloIntgetEndMin(const IloIntervalVar a) const
public IloIntervalVargetFirst(const IloIntervalSequenceVar seq) const
public IlcFloatArraygetFloatArray(const IloNumArray arg) const
public IloIntgetHeightAtEnd(const IloIntervalVar var, const IloCumulFunctionExpr f) const
public IloIntgetHeightAtStart(const IloIntervalVar var, const IloCumulFunctionExpr f) const
public IlcIntArraygetIntArray(const IloIntArray arg) const
public IlcIntervalVargetInterval(const IloIntervalVar var) const
public IlcIntervalSequenceVargetIntervalSequence(const IloIntervalSequenceVar s) const
public IlcIntTupleSetgetIntTupleSet(const IloIntTupleSet ts) const
public IlcIntVargetIntVar(const IloNumVar var) const
public IlcIntVarArraygetIntVarArray(const IloIntVarArray vars) const
public IloIntervalVargetLast(const IloIntervalSequenceVar seq) const
public IloIntgetLength(const IloIntervalVar a) const
public IloIntgetLengthMax(const IloIntervalVar a) const
public IloIntgetLengthMin(const IloIntervalVar a) const
public IloCPgetMasterCP() const
public IloIntgetMax(const IloIntVar var) const
public IloIntgetMin(const IloIntVar var) const
public IloIntervalVargetNext(const IloIntervalSequenceVar seq, const IloIntervalVar a) const
public IloIntgetNumberOfSegments(const IloStateFunction f) const
public IloIntgetNumberOfSegments(const IloCumulFunctionExpr f) const
public IloIntervalVargetPrev(const IloIntervalSequenceVar seq, const IloIntervalVar a) const
public IloIntgetSegmentEnd(const IloStateFunction f, IloInt s) const
public IloIntgetSegmentEnd(const IloCumulFunctionExpr f, IloInt i) const
public IloIntgetSegmentStart(const IloStateFunction f, IloInt s) const
public IloIntgetSegmentStart(const IloCumulFunctionExpr f, IloInt i) const
public IloIntgetSegmentValue(const IloStateFunction f, IloInt s) const
public IloIntgetSegmentValue(const IloCumulFunctionExpr f, IloInt i) const
public IloIntgetSize(const IloIntervalVar a) const
public IloIntgetSizeMax(const IloIntervalVar a) const
public IloIntgetSizeMin(const IloIntervalVar a) const
public IloIntgetStart(const IloIntervalVar a) const
public IloIntgetStartMax(const IloIntervalVar a) const
public IloIntgetStartMin(const IloIntervalVar a) const
public IloIntgetValue(const IloStateFunction f, IloInt t) const
public IloIntgetValue(const IloCumulFunctionExpr f, IloInt t) const
public IloIntgetValue(const IloIntVar v) const
public IloCPEngine(const IlcCPEngine & engine)

Create an instance of IloCPEngine from one of of type IlcCPEngine.

public IloBoolisAbsent(const IloIntervalVar a) const
public IloBoolisExtracted(const IloExtractable ext) const
public IloBoolisFixed(const IloStateFunction f) const
public IloBoolisFixed(const IloCumulFunctionExpr f) const
public IloBoolisFixed(const IloIntervalSequenceVar seq) const
public IloBoolisFixed(const IloIntervalVar a) const
public IloBoolisFixed(const IloNumVar var) const
public IloBoolisInDomain(const IloIntVar var, IloInt value) const
public IloBoolisPresent(const IloIntervalVar a) const
public IloCPEngine::IntVarIteratoriterator(const IloIntVar var)
public IloBoolrestore(const IloSolution solution) const
Inherited Methods from IlcCPEngine
add, addReversibleAction, exitSearch, fail, getHeap, getInfo, getInfo, getRandomInt, getRandomNum, out, solve
Inner Class
IloCPEngine::IntVarIterator The class for iterating over the current domain of an integer variable.
Method Detail

IloCPEngine

public IloCPEngine(const IlcCPEngine & engine)
Create an instance of IloCPEngine from one of of type IlcCPEngine.

This constructor can be useful to have accesses to services such as IloCPEngine::getIntVar(IloIntVar) which is not available on IlcCPEngine as it does not know about Concert Technology objects.


domain

public IloCPEngine::PrintIntervalVarDomains domain(const IloIntervalVar a) const

This member function returns the undocumented class IloCPEngine::PrintIntervalVarDomains which can be inserted into a stream to print the current domain of interval variable a as maintained by the invoking instance of IloCPEngine. Here is an example of its use:

  cp.out() << cp.domain(a) << std::endl;
  

domain

public IloCPEngine::PrintNumVarDomains domain(const IloIntVarArray vars) const

This member function returns the undocumented class IloCPEngine::PrintNumVarDomains which can be inserted into a stream to print the current domains of vars as maintained by the invoking instance of IloCPEngine. Here is an example of its use:

       cp.out() << cp.domain(vars) << std::endl;
     

domain

public IloCPEngine::PrintNumVarDomains domain(const IloNumVar var) const

This member function returns the undocumented class IloCPEngine::PrintNumVarDomains which can be inserted into a stream to print the current domain of var as maintained by the invoking instance of IloCPEngine. Here is an example of its use:

       cp.out() << cp.domain(var) << std::endl;
     

getCumulElement

public IlcCumulElementVar getCumulElement(const IloCumulFunctionExpr f) const

This member function returns the optimizer engine cumul element variable corresponding to the modeling variable f. A cumul element function variable is an instance of IloCumulFunctionExpr built by the shape functions IloPulse, IloStepAtStart or IloStepAtEnd with an instance of IloIntervalVar as first argument.

For more information on the scheduling search API, see the concept Search API for scheduling in CP Optimizer.

See Also:


getDomainSize

public IloInt getDomainSize(const IloIntVar var) const

This member function returns the size of the domain of variable var as maintained in the invoking instance of IloCPEngine.


getDomainSize

public IloInt getDomainSize(const IloNumVar var) const

This member function returns the size of the domain of variable var as maintained in the invoking instance of IloCPEngine. An assertion is violated if var is not of integral type.


getEnd

public IloInt getEnd(const IloIntervalVar a) const

This member function returns the current value of the end of interval variable a in the invoking instance of IloCPEngine. An assertion is violated if a is not fixed.


getEndMax

public IloInt getEndMax(const IloIntervalVar a) const

This member function returns the maximum value for the end of interval variable a in the invoking instance of IloCPEngine.


getEndMin

public IloInt getEndMin(const IloIntervalVar a) const

This member function returns the minimum value for the end of interval variable a in the invoking instance of IloCPEngine.


getFirst

public IloIntervalVar getFirst(const IloIntervalSequenceVar seq) const

This member function assumes that interval sequence variable seq is fixed. It returns the interval variable at the first position in the sequence. The returned interval variable is necessarily present. If all interval variables of the sequence are absent, it returns an empty handle. An assertion is violated if the sequence seq is not fixed.

This function can be used to print the total order corresponding to the sequence value as illustrated by the following code sample.

  for(IloIntervalVar a = cp.getFirst(seq); a.getImpl()!=0; a = cp.getNext(seq, a))
     cp.out() << cp.domain(a) << std::endl;
 

For more information on interval sequence variables see the concept Interval variable sequencing in CP Optimizer.


getFloatArray

public IlcFloatArray getFloatArray(const IloNumArray arg) const

This member function returns the optimizer engine floating-point array corresponding to the modeling array arg.


getHeightAtEnd

public IloInt getHeightAtEnd(const IloIntervalVar var, const IloCumulFunctionExpr f) const

This member function assumes that cumul function expression f is fixed. It returns the total contribution of the interval variable var to the cumul function expressionf at the end time of var. Note that contribution of absent interval variable is always zero.

For more information on cumul function expressions see the concept Cumul functions in CP Optimizer.


getHeightAtStart

public IloInt getHeightAtStart(const IloIntervalVar var, const IloCumulFunctionExpr f) const

This member function assumes that cumul function expression f is fixed. It returns the total contribution of the interval variable var to the cumul function expressionf at the start time of var. Note that contribution of absent interval variable is always zero.

For more information on cumul function expressions see the concept Cumul functions in CP Optimizer.


getIntArray

public IlcIntArray getIntArray(const IloIntArray arg) const

This member function returns the optimizer engine integer array corresponding to the modeling array arg.


getInterval

public IlcIntervalVar getInterval(const IloIntervalVar var) const

This member function returns the optimizer engine interval variable corresponding to the modeling variable var.

For more information on the search API for scheduling, see the concept Search API for scheduling in CP Optimizer.

See Also:


getIntervalSequence

public IlcIntervalSequenceVar getIntervalSequence(const IloIntervalSequenceVar s) const

This member function returns the optimizer engine interval variable corresponding to the modeling variable var.

For more information on the scheduling search API, see the concept Search API for scheduling in CP Optimizer.

See Also:


getIntTupleSet

public IlcIntTupleSet getIntTupleSet(const IloIntTupleSet ts) const

This function returns the optimizer engine tuple set corresponding to the modeling tuple set ts.


getIntVar

public IlcIntVar getIntVar(const IloNumVar var) const

This member function returns the optimizer engine integer variable corresponding to the modeling variable var.


getIntVarArray

public IlcIntVarArray getIntVarArray(const IloIntVarArray vars) const

This member function returns the optimizer engine integer variable array corresponding to the modeling variable array vars.


getLast

public IloIntervalVar getLast(const IloIntervalSequenceVar seq) const

This member function assumes that interval sequence variable seq is fixed. It returns the interval variable at the last position in the sequence. The returned interval variable is necessarily present. If all interval variables of the sequence are absent, it returns an empty handle. An assertion is violated if the sequence seq is not fixed.

This function can be used to print the reverse total order corresponding to the sequence value as illustrated by the following code sample.

  for(IloIntervalVar a = cp.getLast(seq); a.getImpl()!=0; a = cp.getPrev(seq, a))
     cp.out() << cp.domain(a) << std::endl;
 

For more information on interval sequence variables see the concept Interval variable sequencing in CP Optimizer.


getLength

public IloInt getLength(const IloIntervalVar a) const

This member function returns the current value of the length of interval variable a in the invoking instance of IloCPEngine. An assertion is violated if a is not fixed.


getLengthMax

public IloInt getLengthMax(const IloIntervalVar a) const

This member function returns the maximum value for the length of interval variable a in the invoking instance of IloCPEngine.


getLengthMin

public IloInt getLengthMin(const IloIntervalVar a) const

This member function returns the minimum value for the length of interval variable a in the invoking instance of IloCPEngine.


getMasterCP

public IloCP getMasterCP() const

Retrieves the master IloCP object which controls the invoking IloCPEngine object.


getMax

public IloInt getMax(const IloIntVar var) const

This member function returns the maximum value of the variable var in the invoking instance of IloCPEngine.


getMin

public IloInt getMin(const IloIntVar var) const

This member function returns the minimum value of the variable var in the invoking instance of IloCPEngine.


getNext

public IloIntervalVar getNext(const IloIntervalSequenceVar seq, const IloIntervalVar a) const

This member function assumes that interval sequence variable seq is fixed. It returns the interval variable that immediately follows interval a in the sequence. The returned interval variable is necessarily present. An assertion is violated if a is absent or is not an interval variable of sequence seq and if the sequence is not fixed. If a is at the last position of the sequence, the function returns an empty handle.

This function can be used to print the total order corresponding to the sequence value as illustrated by the following code sample.

  for(IloIntervalVar a = cp.getFirst(seq); a.getImpl()!=0; a = cp.getNext(seq, a))
     cp.out() << cp.domain(a) << std::endl;
 

For more information on interval sequence variables see the concept Interval variable sequencing in CP Optimizer.


getNumberOfSegments

public IloInt getNumberOfSegments(const IloStateFunction f) const

This member function assumes that state function f is fixed. It returns the number of segments of the corresponding stepwise function. A segment is an interval [start, end) on which the value of f is constant. If the state function is not defined, the value is IloCP::NoState; otherwise the value is a non-negative integer. An assertion is violated if state function f is not fixed.

This function can be used to print the content of a state function as illustrated by the following code sample.

  for (IloInt i=0; i < cp.getNumberOfSegments(f); ++i)
    cp.out() << "["  << cp.getSegmentStart(f, i)
             << ","  << cp.getSegmentEnd(f, i)
             << "):" << cp.getSegmentValue(f, i)
             << std::endl;
 

For more information on state function see the concept State functions in CP Optimizer.


getNumberOfSegments

public IloInt getNumberOfSegments(const IloCumulFunctionExpr f) const

This member function assumes that cumul function expression f is fixed. It returns the number of segments of the corresponding stepwise non-negative function. A segment is an interval [start, end) on which the value of f is constant. An assertion is violated if cumul function expression f is not fixed.

This function can be used to print the content of a cumul function expression as illustrated by the following code sample.

  for (IloInt i=0; i < cp.getNumberOfSegments(f); ++i)
    cp.out() << "["  << cp.getSegmentStart(f, i)
             << ","  << cp.getSegmentEnd(f, i)
             << "):" << cp.getSegmentValue(f, i)
             << std::endl;
 

For more information on cumul function expressions see the concept Cumul functions in CP Optimizer.


getPrev

public IloIntervalVar getPrev(const IloIntervalSequenceVar seq, const IloIntervalVar a) const

This member function assumes that interval sequence variable seq is fixed. It returns the interval variable that immediately precedes interval a in the sequence. The returned interval variable is necessarily present. An assertion is violated if a is absent or is not an interval variable of sequence seq and if the sequence is not fixed. If a is at the first position of the sequence, the function returns an empty handle.

This function can be used to print the reverse total order corresponding to the sequence value as illustrated by the following code sample.

  for(IloIntervalVar a = cp.getLast(seq); a.getImpl()!=0; a = cp.getPrev(seq, a))
     cp.out() << cp.domain(a) << std::endl;
 

For more information on interval sequence variables see the concept Interval variable sequencing in CP Optimizer.


getSegmentEnd

public IloInt getSegmentEnd(const IloStateFunction f, IloInt s) const

This member function assumes that state function f is fixed. It returns the end of the ith segment of the corresponding stepwise function. A segment is an interval [start, end) on which the value of f is constant. If the state function is not defined, the value is IloCP::NoState; otherwise the value is a non-negative integer. An assertion is violated if state function f is not fixed.

This function can be used to print the content of a state function as illustrated by the following code sample.

  for (IloInt i=0; i < cp.getNumberOfSegments(f); ++i)
    cp.out() << "["  << cp.getSegmentStart(f, i)
             << ","  << cp.getSegmentEnd(f, i)
             << "):" << cp.getSegmentValue(f, i)
             << std::endl;
 

For more information on state function see the concept State functions in CP Optimizer.


getSegmentEnd

public IloInt getSegmentEnd(const IloCumulFunctionExpr f, IloInt i) const

This member function assumes that cumul function expression f is fixed. It returns the end of the ith segment of the corresponding stepwise non-negative function. A segment is an interval [start, end) on which the value of f is constant. If n is the number of segments of the function segments are indexed starting from 0 so index i should belong to the range [0,n). An assertion is violated if cumul function expression f is not fixed or if i is not a valid segment index.

This function can be used to print the content of a cumul function expression as illustrated by the following code sample.

  for (IloInt i=0; i < cp.getNumberOfSegments(f); ++i)
    cp.out() << "["  << cp.getSegmentStart(f, i)
             << ","  << cp.getSegmentEnd(f, i)
             << "):" << cp.getSegmentValue(f, i)
             << std::endl;
 

For more information on cumul function expressions see the concept Cumul functions in CP Optimizer.


getSegmentStart

public IloInt getSegmentStart(const IloStateFunction f, IloInt s) const

This member function assumes that state function f is fixed. It returns the start of the ith segment of the corresponding stepwise function. A segment is an interval [start, end) on which the value of f is constant. If the state function is not defined, the value is IloCP::NoState; otherwise the value is a non-negative integer. An assertion is violated if state function f is not fixed.

This function can be used to print the content of a state function as illustrated by the following code sample.

  for (IloInt i=0; i < cp.getNumberOfSegments(f); ++i)
    cp.out() << "["  << cp.getSegmentStart(f, i)
             << ","  << cp.getSegmentEnd(f, i)
             << "):" << cp.getSegmentValue(f, i)
             << std::endl;
 

For more information on function see the concept State functions in CP Optimizer.


getSegmentStart

public IloInt getSegmentStart(const IloCumulFunctionExpr f, IloInt i) const

This member function assumes that cumul function expression f is fixed. It returns the start of the ith segment of the corresponding stepwise non-negative function. A segment is an interval [start, end) on which the value of f is constant. If n is the number of segments of the function segments are indexed starting from 0 so index i should belong to the range [0,n). An assertion is violated if cumul function expression f is not fixed or if i is not a valid segment index.

This function can be used to print the content of a cumul function expression as illustrated by the following code sample.

  for (IloInt i=0; i < cp.getNumberOfSegments(f); ++i)
    cp.out() << "["  << cp.getSegmentStart(f, i)
             << ","  << cp.getSegmentEnd(f, i)
             << "):" << cp.getSegmentValue(f, i)
             << std::endl;
 

For more information on cumul function expressions see the concept Cumul functions in CP Optimizer.


getSegmentValue

public IloInt getSegmentValue(const IloStateFunction f, IloInt s) const

This member function assumes that state function f is fixed. It returns the value of the ith segment of the corresponding stepwise function. A segment is an interval [start, end) on which the value of f is constant. If the state function is not defined, the value is IloCP::NoState; otherwise the returned value is a non-negative integer. An assertion is violated if state function f is not fixed.

This function can be used to print the content of a state function as illustrated by the following code sample.

  for (IloInt i=0; i < cp.getNumberOfSegments(f); ++i)
    cp.out() << "["  << cp.getSegmentStart(f, i)
             << ","  << cp.getSegmentEnd(f, i)
             << "):" << cp.getSegmentValue(f, i)
             << std::endl;
 

For more information on state function see the concept State functions in CP Optimizer.


getSegmentValue

public IloInt getSegmentValue(const IloCumulFunctionExpr f, IloInt i) const

This member function assumes that cumul function expression f is fixed. It returns the value of the ith segment of the corresponding stepwise non-negative function. A segment is an interval [start, end) on which the value of f is constant. If n is the number of segments of the function segments are indexed starting from 0 so index i should belong to the range [0,n). An assertion is violated if cumul function expression f is not fixed or if i is not a valid segment index.

This function can be used to print the content of a cumul function expression as illustrated by the following code sample.

  for (IloInt i=0; i < cp.getNumberOfSegments(f); ++i)
    cp.out() << "["  << cp.getSegmentStart(f, i)
             << ","  << cp.getSegmentEnd(f, i)
             << "):" << cp.getSegmentValue(f, i)
             << std::endl;
 

For more information on cumul function expressions see the concept Cumul functions in CP Optimizer.


getSize

public IloInt getSize(const IloIntervalVar a) const

This member function returns the current value of the size of interval variable a in the invoking instance of IloCPEngine. An assertion is violated if a is not fixed.


getSizeMax

public IloInt getSizeMax(const IloIntervalVar a) const

This member function returns the maximum value for the size of interval variable a in the invoking instance of IloCPEngine.


getSizeMin

public IloInt getSizeMin(const IloIntervalVar a) const

This member function returns the minimum value for the size of interval variable a in the invoking instance of IloCPEngine.


getStart

public IloInt getStart(const IloIntervalVar a) const

This member function returns the current value of the start of interval variable a in the invoking instance of IloCPEngine. An assertion is violated if a is not fixed.


getStartMax

public IloInt getStartMax(const IloIntervalVar a) const

This member function returns the maximum value for the start of interval variable a in the invoking instance of IloCPEngine.


getStartMin

public IloInt getStartMin(const IloIntervalVar a) const

This member function returns the minimum value for the start of interval variable a in the invoking instance of IloCPEngine.


getValue

public IloInt getValue(const IloStateFunction f, IloInt t) const

This member function assumes that state function f is fixed. It returns the value of the corresponding stepwise non-negative function at point t. If the state function is not defined, the value is IloCP::NoState; otherwise the returned value is a non-negative integer. An assertion is violated if state function f is not fixed or if t does not belong to the interval [IloIntervalMin, IloIntervalMax).

For more information on state function see the concept State functions in CP Optimizer.


getValue

public IloInt getValue(const IloCumulFunctionExpr f, IloInt t) const

This member function assumes that cumul function expression f is fixed. It returns the value of the corresponding stepwise non-negative function at point t. An assertion is violated if cumul function expression f is not fixed or if t does not belong to the interval [IloIntervalMin, IloIntervalMax).

For more information on cumul function expressions see the concept Cumul functions in CP Optimizer.


getValue

public IloInt getValue(const IloIntVar v) const

This member function returns the current value of the variable v in the invoking instance of IloCPEngine. An assertion is violated if v is not fixed to a value.


isAbsent

public IloBool isAbsent(const IloIntervalVar a) const

This member function returns IloTrue if and only if interval variable a is absent in the invoking instance of IloCPEngine.


isExtracted

public IloBool isExtracted(const IloExtractable ext) const

This member function checks whether an extractable ext has been extracted.


isFixed

public IloBool isFixed(const IloStateFunction f) const

This member function indicates if the state function f takes on a particular value as maintained by the invoking IloCPEngine instance. A state function f is said to be fixed if it defines a fixed value f(t) for all t in [IloIntervalMin,IloIntervalMax). When fixed, a state function is a stepwise function. If the state function is not defined, the value is IloCP::NoState; otherwise the value is a non-negative integer.

For more information on state functions see the concept State functions in CP Optimizer.


isFixed

public IloBool isFixed(const IloCumulFunctionExpr f) const

This member function indicates if the cumul function expression f takes on a particular value as maintained by the invoking IloCPEngine instance. A cumul function expression f is said to be fixed if it defines a fixed value f(t) for all t in [IloIntervalMin,IloIntervalMax). When fixed, a cumul function expression is a stepwise non-negative function.

For more information on cumul function expressions see the concept Cumul functions in CP Optimizer.


isFixed

public IloBool isFixed(const IloIntervalSequenceVar seq) const

This member function indicates if the domain of the interval sequence variable seq takes on a particular value as maintained by the invoking IloCPEngine instance. An interval sequence variable is said to be fixed if and only if all the interval variables of the sequence are either absent or ordered.

For more information on interval sequence variables see the concept Interval variable sequencing in CP Optimizer.


isFixed

public IloBool isFixed(const IloIntervalVar a) const

This member function indicates if the domain of a takes on a particular value as maintained by the invoking IloCPEngine instance. An interval variable is said to be fixed if and only if it is either absent or present with fixed start, end and size value.


isFixed

public IloBool isFixed(const IloNumVar var) const

This member function indicates if the domain of var takes on a particular value as maintained by the invoking IloCPEngine instance.


isInDomain

public IloBool isInDomain(const IloIntVar var, IloInt value) const

This member function indicates whether value is contained in the current domain of var as maintained by the invoking IloCPEngine instance.


isPresent

public IloBool isPresent(const IloIntervalVar a) const

This member function returns IloTrue if and only if interval variable a is present in the invoking instance of IloCPEngine.


iterator

public IloCPEngine::IntVarIterator iterator(const IloIntVar var)

This member function returns an iterator to iterate over the domain of var, as maintained by the invoking CP optimizer. It is equivalent to: IloCPEngine::IntVarIterator(this, var).


restore

public IloBool restore(const IloSolution solution) const

This member function uses the invoking CP optimizer to instantiate the variables in solution with their saved values. The value of any objective added to the solution is not restored. If the solution does not violate any constraints of the model extracted by the invoking CP optimizer, then IloTrue is returned and the state of the constraint variables in the CP optimizer reflect those stored in solution. Otherwise the CP optimizer's state remains unchanged and IloFalse is returned.