IBM ILOG Solver User's Manual > Extending the Library > Writing a Goal: Car Sequencing > Understanding goals

Goals are the building blocks used to implement search algorithms in Solver. Goals implement algorithms where the exact sequence of operations to follow is not known in advance. This kind of programming is often called non-deterministic. Both predefined search algorithms and user-defined search algorithms can be expressed in Solver through goals. The class IloGoal represents goals in a IBM® ILOG® Concert Technology model. The class IlcGoal represents goals internally in a Solver search.

Goals as they are represented in a Concert Technology model depend on two classes: IloGoal and IloGoalI. An instance of the class IloGoal (a handle) contains a data member (the handle pointer) that points to an instance of the class IloGoalI (its implementation object).

Goals as they are represented in a Solver search (for example, inside a constraint or inside another goal) depend on two classes: IlcGoal and IlcGoalI. The class IlcGoal is the handle class. An instance of the class IlcGoal contains a data member (the handle pointer) that points to an instance of the class IlcGoalI (the implementation object) allocated on the Solver heap. You can use the macro ILCGOALn to define a new class of goals. If you want to use this new class of goals in a Concert Technology model, you must first wrap them using the macro ILOCPGOALWRAPPER.

A goal can either succeed or fail. A goal fails if a fail member function (such as IlcGoalI::fail or IloSolver::fail, for example) is called during its execution. Such a call happens when the domain of a constrained variable becomes empty because of a constraint. A goal succeeds if it does not fail.