IBM ILOG Solver User's Manual > Extending the Library > Writing a Goal: Car Sequencing > Understanding goals > Using goals |
Using goals |
INDEX
![]() |
The member functions IloSolver::solve
and IloSolver::next
control the execution of goals. The first time one of these member functions is called, it creates a stack of goals, called the goal stack.
Note |
Goals must be called by IloSolver::solve , IloSolver::next , or by other goals. Otherwise, they are not executed.
|
Defining a goal creates two functions:
execute
. Its body is the body used in the definition of the goal. When this function is used, the goal is executed.
A goal is passed as a parameter to the member functions IloSolver::solve
or IloSolver::next
. These functions push a goal onto the goal stack of the invoking solver; when that occurs, the goal is called.
Thus, each time a goal is called, it is added on top of this stack, but it is not executed immediately. When the current goal execution is finished, the member function IloSolver::solve
or IloSolver::next
pops the goal which is on top of the goal stack, if any, and executes it. Thus goals are executed first in, last out. If the goal stack is empty, the call to solve
or next
terminates and returns IlcTrue
.
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |