30.01.2015 Views

ILOG CPLEX C++ API 9.0 Reference Manual

ILOG CPLEX C++ API 9.0 Reference Manual

ILOG CPLEX C++ API 9.0 Reference Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

accepts the injected solution, it first tests whether the injected solution is feasible<br />

with respect to the model and goals.<br />

◆ When <strong>ILOG</strong> <strong>CPLEX</strong> executes any other goal, the returned goal is simply pushed<br />

onto the stack.<br />

IloCplex continues popping goals from the goal stack until OrGoal or FailGoal<br />

is executed, or until the stack becomes empty; in the case of an empty stack, it will<br />

continue with a built-in search strategy.<br />

The predefined goals OrGoal and AndGoal allow you to combine goals. AndGoal<br />

allows you to execute different goals at one node, while OrGoal allows you to execute<br />

different goals on different, newly created nodes. A conventional use of these two goals<br />

in a return statement of a user-written goal looks like this:<br />

return AndGoal ( OrGoal (branch1, branch2), this);<br />

This AndGoal first pushes this (the goal currently being executed) onto the goal<br />

stack, and then it pushes the OrGoal. Thus the OrGoal is on top of the stack and will<br />

be executed next. When the OrGoal executes, it creates two new nodes and copies the<br />

remaining goal stack to both of them. Thus both new nodes will have this goal on top<br />

of the goal stack at this point. Then the OrGoal proceeds to push branch1 onto the<br />

goal stack of the first child node and branch2 onto the goal stack of the second goal<br />

child node. Conventionally, branch1 and branch2 contain cut goals, so by<br />

executing branch1 and branch2 at the respective child nodes, the child nodes will<br />

be restricted to represent smaller subproblems than their parent. After branch1 and<br />

branch2 have been executed, this is on top of the node stack of both child nodes;<br />

that is, both child nodes will continue branching according to the same rule. In<br />

summary, this example creates the branches branch1 and branch2 and continues in<br />

both branches to control the same search strategy this.<br />

To perform a search using a goal, you need to solve the extracted model by calling the<br />

method IloCplex::solve(goal) with the goal to use as an argument instead of<br />

the standard IloCplex::solve. The method solve(goal) simply pushes the<br />

goal onto the goal stack of the root node before calling the standard solve.<br />

See Also<br />

IloCplex::Goal and IloCplex::GoalI<br />

<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>9.0</strong> REFERENCE M ANUAL 11

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!