Overview | Group | Tree | Graph | Index | Concepts |
A tournament selection is one where objects compete to be selected and therefore a notion of pairwise comparable objects is needed. A tournament selector is defined by two objects: the tournament size (referred to as t) and a comparator. To select an object, the tournament selector selects t objects in a random unbiased way with replacement, meaning that the same object can be selected more than once. Then, the comparator is used to select the best of those t objects. In the case of ties (equal quality objects), the object selected first in the initial round will be chosen. The effect of the tournament size t is to prefer the "better" objects for higher t. t=1 corresponds to random selection, but for normal usage, t is normally a small integer, as if it is too high, only the very best objects are ever selected.
When you create a tournament selector, you must pass a
visitor object which can traverse the container from which you are
selecting objects. However, in the case where a default visitor
exists for the container in question, you can omit the visitor and
the default will be used. In addition to the default visitors already in Solver,
IIM provides default visitors for IloSolutionPool
and IloPoolProcArray
.
The following code shows how to declare a tournament selector and use it to build a pool processor:
IloTournamentSelector<IloSolution, IloSolutionPool> tsel( env, 2, IloBestSolutionComparator(env) ); IloPoolProc selector = IloSelectSolutions(env, tsel, IloTrue);
In this example, better objective value solutions are preferred and the tournament size is two.
IloTournamentSelector
which has been
transformed into a pool processor using
IloSelectSolutions
will always draw its
random numbers from the random number generator of the solver
on which it is executing.
See Also:
IloSolutionPool, IloPoolProcArray, IloVisitor, IloComparator, IloRandomSelector, IloRouletteWheelSelector
Constructor Summary | |
---|---|
public | IloTournamentSelector(IloEnv env, IloInt tournamentSize, IloComparator< IloObject > cmp, IloVisitor< IloObject, IloContainer > visitor=0) Builds a tournament selector. |
Method Summary | |
---|---|
public IloComparator< IloObject > | getComparator() const Delivers the comparator given at construction time. |
public IloInt | getTournamentSize() const Delivers the tournament size. |
public IloVisitor< IloObject, IloContainer > | getVisitor() const Delivers the visitor used by the selector. |
Inherited Methods from IloSelector |
---|
select |
Constructor Detail |
---|
This constructor builds a selector from an environment
env
which will select objects
according to a competitive "tournament" rule. This constructor
uses the comparator cmp
to compare objects. The parameter
tournamentSize
controls the number of randomly chosen
objects to consider each time a selection is made. It is used to control
the size of the competition and thus the bias of the selector towards
preferred objects. An optional visitor visitor
can be passed to
traverse the container. If no visitor is specified, a default visitor will be used
if it exists. If no default visitor exists, an exception of type
IloException
is raised.
Method Detail |
---|
This member function returns the comparator passed at construction time.
This member function returns the tournament size given at construction time.
This member function returns the visitor passed at construction time, or, if no visitor was passed, the default visitor for the container from which objects are being selected.