This class allows you to monitor different aspects of CP Optimizer's
search process by being called upon different events. By overriding
the virtual function invoke, you may define the behavior
you wish. When the callback is invoked you may use getters on the
IloCP object such as IloCP::getInfo,
IloCP::getObjValues and
IloCP::getObjBounds.
You may also terminate the search by calling
IloCP::abortSearch.
Note
Aside from calling IloCP::abortSearch,
it is forbidden to call any function which changes CP Optimizer's
state inside a call to invoke, for example member
functions such as setParameter, extract,
solve, refineConflict etc. should
not be called.
This member function is invoked by the passed CP object to
perform the callback action. You should define a subclass
of IloCP::Callback which overrides the behavior
of this function.
The reason parameter indicates for which reason the callback
is being invoked. The current list of reasons is:
Destruction:
The callback is being called to signal that the
IloCP::end member function
is being called on the passed IloCP object.
During this callback, you must not call any member function
on the IloCP object.
EndExtraction:
The callback is being called to signal that the process of
extracting the model to the engine has ended.
EndInitialPropagation:
The callback is being called to signal that the initial
top-level inference (propagation) has been carried out.
At this point, you can use domain getters (such as
IloCP::getMin(IloIntVar) or
IloCP::isPresent(IloIntervalVar)) to retrieve
information about variable domains.
EndSearch:
The callback is being called to signal that the solution
search has ended either naturally (through a proof for example),
or because of a limit or abort.
EndSolve:
The callback is being called to signal that the solving process
has completed. This callback type is received after any
others in a solve process and can be used as a teardown or
a trigger to consolidate information obtained during the solve.
ObjBound:
The callback is being called to signal that an improved bound
has been found to the optimization problem being solved.
Periodic:
The callback is being called as part of a periodic process
during search.
Proof:
The callback is being called to indicate that a proof of
feasibility, infeasibility or optimality (within specified
tolerances) has been made.
Solution:
The callback is being called to indicate that a new (better
in the case of an optimization problem) solution has been
produced. You can use getters like
IloCP::getValue(IloIntVar)
to get the values of decision variables.
StartExtraction:
The callback is being called to signal that the process of
extracting the model to the engine has begun.
StartInitialPropagation:
The callback is being called to signal that the initial
top-level inference (propagation) is about to begin.
At this point, you can use domain getters (such as
IloCP::getMin(IloIntVar) or
IloCP::isPresent(IloIntervalVar)) to retrieve
information about variable domains.
StartSearch:
The callback is being called to signal that the solution
search process (after initial propagation) is about to begin.
StartSolve:
The callback is being called to signal that the solving process
has just started. This type of callback is received before any
others in a solve process and can be used to initialize the
callback with information needed for the duration of the solve.
During a callback called for this reason, no information, like
objective or bounds will be available on the IloCP object.