public interface IloSearchPhase
The interface IloSearchPhase is used
to define instantiation strategies to help the embedded CP Optimizer search.
A search phase is composed of:
IloIntVar[]) to
instantiate,IloIntVarChooser) that defines how the next
variable to instantiate is chosenIloIntValueChooser) that defines how values
are chosen when instantiating variables.A search phase is given to an IloCP instance by invoking one
of the methods:
void IloCP.solve(IloSearchPhase phase); void IloCP.startNewSearch(IloSearchPhase phase);
The embedded search strategy, determined by the value of
the parameter IloCP.IntParam.SearchType, will use the search
phases to instantiate the variables for which a search phase is specified.
Several search phases can be given to an IloCP instance by way of
an IloSearchPhase[]. The methods that need to be invoked for that
purpose are:
void IloCP.solve(IloSearchPhase[] phases); void IloCP.startNewSearch(IloSearchPhase[] phases);
The order of the search phases in the array is important. In the CP search strategy, the variables will be instantiated phase by phase starting by the first phase of the array. It is not necessary that the variables in the search phases cover all the variables of the problem. It can be assumed that a search phase containing all the problem variables is implicitly added to the end of the given array of search phases.
For instance, assume we have a model over three arrays of variables x, y and z. In the following search phase array
IloSearchPhase[] phases = new IloSearchPhase[2]; phases[0] = cp.searchPhase(x, ..., ...); phases[1] = cp.searchPhase(y, ..., ...);
the variables x will be instantiated before the variables
y and
once x and y are instantiated, variables
in z will be instantiated.
There are some models which have particular well-understood structure
where giving such an order can have a dramatic impact on the solving time.
It is important to note that for constructing a search phase,
not all the three parameters above are required. A search phase
can be created with an array of variables only. The embedded search
will then choose an instantiation strategy automatically.
For instance, assuming that x and y
are arrays of integer variables, the following code:
IloCP cp = new IloCP(); IloSearchPhase[] phases = new IloSearchPhase[2]; phases[0] = cp.searchPhase(x); phases[1] = cp.searchPhase(y); cp.solve(phases);
indicates to CP search that variables from the array x
must be instantiated before those from the array y. The way to
instantiate them will be chosen by CP search.
Similarly, it is not necessary to specify an array of variables to a search phase. A search phase defined this way will be applied to every integer variable extracted from the model.
| Modifier and Type | Method and Description |
|---|---|
void |
end() |