| Overview | Group | Tree | Graph | Index | Concepts |
This function creates a pool processor on the
environment env which selects from
its input by asking for successive selections
from selector. Selectors
can be built-in ones such as IloRandomSelector
or ones created using the ILOSELECTOR0 or
ILOCTXSELECTOR0 macros (or their variants).
(See ILOSELECTOR0 for ILOCTXSELECTOR0
documentation.)
You can specify if you would like selections to avoid duplicates using the parameter
unique. Set this flag to IloTrue
if the pool processor is not to produce duplicates in its output pool.
The following code
uses ILOCTXSELECTOR1 to create a custom selector:
ILOCTXSELECTOR1(CustomSelector, IloSolution, IloSolutionPool, in,
IloSolver, solver, IlcInt, tournamentSize) {
IloInt size = in.getSize();
if (size != 0) {
IlcRandom rnd = solver.getRandom();
IloSolution candidate = in.getSolution(rnd.getInt(size));
for (IlcInt tournament = 1; tournament < tournamentSize; tournament++) {
IloSolution competition = in.getSolution(rnd.getInt(size));
if (competition.isBetterThan(candidate))
candidate = competition;
}
select(candidate);
}
}
If selector has been created from
ILOCTXSELECTOR1,
IloSelectSolutions will
ensure that the context passed will be the instance of the
IloSolver on which it is executing.
See Also: