Overview | Group | Tree | Graph | Index | Concepts |
This function creates a processor from an environment
env
, a solution pool target
and a selector of solutions selector
. The
idea of the processor is to replace some of the solutions
in target
by those which are the input of
the processor, such as to keep the size of target
constant. The (optional) selector selector
decides
which solutions should be replaced. If none is specified, a
selector selecting the worst solutions is used.
The solutions identified by the selector are removed from the
target
and output by the processor.
The processor works as follows:
selector
is asked n times to select
a solution from target.target
and
added to the processor's output pool.target
.The following code creates a processor which will replace some members
of the population by offspring. The choice of population members to
remove is made by a tournament selector, with a tournament size of 3.
The tournament selector favors worse solutions so that poorer members
of the population are replaced. Replaced solutions (dead ones) are
supplied to the IloDestroyAll
processor which will destroy them and reclaim the memory used:
IloSolutionPool offspring(env, "offspring"); IloTournamentSelector<IloSolution,IloSolutionPool> deadSelector( env, 3, IloWorstSolutionComparator(env) ); IloGoal replacementGoal = IloExecuteProcessor(env, offspring >> IloReplaceSolutions(env, population, deadSelector) >> IloDestroyAll(env) );