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

You never need to create an instance of this class. The master
IloCP object will create instances of this class which
you can then use in your own CP Optimizer extensions code in C++.
Specifically, you can get the current instance from within an instance
of IlcGoalI, IlcDemonI or
IlcConstraintI by calling the getCPEngine()
member function. Likewise, these classes (as well as others such as
IlcRevInt) require that you pass an instance of this
class when building an object of that type.
The search can also be influenced by adding constraints
(add(const IlcConstraint ct)) or by performing "internal"
solves (solve(IlcGoal goal, IlcBool restore = IlcFalse)).
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:
IloCPEngine, IlcGoalI, IlcConstraintI, IlcDemonI
| Method Summary | |
|---|---|
public void | add(const IlcConstraint constraint) const |
public void | addReversibleAction(const IlcGoal goal) const |
public void | exitSearch() const |
public void | fail(IlcAny label=0) const |
public IlcAllocationStack * | getHeap() const |
public IlcFloat | getInfo(const char * name) const |
public IlcInt | getInfo(IlcCPEngine::IntInfo info) const |
public IlcInt | getRandomInt(IlcInt n) const |
public IlcFloat | getRandomNum() const |
public ostream & | out() const |
public IlcBool | solve(const IlcGoal goal, IlcBool restore=IlcFalse) const |
| Inner Enumeration | |
|---|---|
| IlcCPEngine::IntInfo |
Integer information for IlcCPEngine.
|
| Method Detail |
|---|
This member function adds constraint to the invoking engine so that it
takes constraint into account during its search.
This function may only be called from inside an IlcGoalI or
IlcConstraintI::post.
For managing reversible changes that are not assignments, CP Optimizer provides reversible actions. Such
actions are executed when CP Optimizer restores the state of the invoking optimizer. A reversible action is created by
the member function addReversibleAction.
However, where possible, it is much more efficient to use the reversible classes—IlcRevInt,
IlcRevAny, IlcRevBool,
IlcRevFloat—to manage reversible assignments than to use reversible actions.
In the member function addReversibleAction, the argument goal must be a goal
that does not change the state of the invoking engine. That is, it must not execute any reversible assignments,
nor call other goals, nor call the member function fail. If the local engine backtracks to a choice point that was set
before this call to addReversibleAction, then goal will be executed.
The execution of reversible actions is interleaved with the restoration of reversible states. Thus when a
reversible goal is called, the state of the invoking CP optimizer is the same as the state of the invoking solver
when addReversibleAction was called.
This member function completely exits the search of the invoking worker.
See Also:
The backtrack of a search goal is triggered by this member function. In fact, this member function triggers
the failure of the executing instance of IlcGoal. The execution of the current goal
then stops, and goal execution resumes at
the last choice point with untried subgoals. It is possible to resume goal execution at an earlier
choice point by associating labels with choice points. Then the member function fail
can be called with a label, and in that case, goal execution resumes at the last choice point with
that label.
See Also:
IlcOr, IlcAnd, IlcGoal, IlcGoalI
This member function returns a pointer to the heap associated with the
invoking engine. Use this member function with the overloaded
new operator, like this:
new (cpengine.getHeap())
This method returns the value of information named name in
the invoking IlcCPEngine instance. The information is with
respect to this local worker, and not globally over the whole search process.
This method returns the value of the Integer information info in
the invoking IlcCPEngine instance. The information is with respect to this
local worker, and not globally over the whole search process.
This member function returns a pseudo-randomly generated integer value in the range [0..n).
See Also:
This member function returns a pseudo-randomly generated floating-point value in the range [0..1).
This member function returns a reference to the stream currently
used for logging. It returns the same stream provided by
IloCP::out (IloAlgorithm::out).
This member function solves a sub-problem by using the goal goal
passed as a parameter. The parameter restore indicates whether
or not at the end of the search the invoking engine should restore the
state that it was in prior to the search.
| Inner Enumeration Detail |
|---|
IlcCPEngine.
An enumeration for the class IlcCPEngine.
These values are used by IlcCPEngine::getInfo to
obtain local information about the invoking worker as opposed to
global information over the whole search process. For example,
IlcCPEngine::getInfo(IlcCPEngine::NumberOfBranches)
will return the number of branches executed by this local worker up to
the current point in search.
| Fields |
|---|
NumberOfChoicePoints = 1 | This information is the number of choice points executed
so far in the local worker |
NumberOfFails = 2 | This information is the number of fails executed
so far in the local worker |
NumberOfBranches = 3 | This information is the number of branches executed
so far in the local worker |
NumberOfEngineVariables = 6 | Advanced information. This information represents the total number of ''engine''
variables created in the local engine at the current point in search.
Instances of
|
MemoryUsage = 8 | This information represents the total memory, in bytes, used
by the local |
WorkerId = 26 | CP Optimizer assigns an ID to each local worker when solving in parallel. This ID can take a value to 0 to the number of worker threads less one. |
NumberOfEngineConstraints = 2018 | Advanced information. This information represents the total number of ''engine'' constraints created in the local engine at the current point in search. This is largely an internal measurement but can be useful for debugging or understanding memory usage. |
ILC_MAX_IntInfo |