FRAMES NO FRAMES

Class IloRouletteWheelSelector<,>

Definition file: ilsolver/iimmulti.h
Include file: <ilsolver/iim.h>
A selector which chooses objects following a roulette wheel rule.

A roulette wheel selection is one where a non-negative evaluation is ascribed to each selectable object. The probability of selection of a particular object is then equal to its evaluation divided by the sums of the evaluations of the selectable objects. Roulette wheel selection chooses the nth object with probability (evaluation[n] / sum(evaluation)). This evaluation is given using an evaluator which will evaluate each object to be selected.

When you create a roulette wheel 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 available in Solver, IIM provides default visitors for IloSolutionPool and IloPoolProcArray.

The following code shows how to declare a roulette wheel selector and use it to build a pool processor:

    IloRouletteWheelSelector<IloSolution,IloSolutionPool>
      rwsel(env, parentEvaluator);
    IloPoolProc selector = IloSelectSolutions(env, rwsel, IloTrue);

This code will select solutions based on an evaluator parentEvaluator, created for instance by IloSolutionEvaluator. The IloTrue parameter to IloSelectSolutions means that you do not want duplicates in the resulting selection. Once this selector is created, it can be used to build a reproduction goal:

    IloGoal reproduceGoal = IloExecuteProcessor(
      env, population >> selector >> applyOp(maxOffspring) >> offspring
    );

In this goal, the selector is fed by the population pool and will provide parent solutions to the applyOp processor.

Note
An instance of IloRouletteWheelSelector 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:

Constructor Summary
public IloRouletteWheelSelector(IloEnv env, IloEvaluator< IloObject > evaluator, IloVisitor< IloObject, IloContainer > visitor=0)

Builds a roulette wheel selector from an evaluator.

Method Summary
public IloEvaluator< IloObject >getEvaluator() const

Delivers the evaluator given at construction time.

public IloVisitor< IloObject, IloContainer >getVisitor() const

Delivers the visitor used by the selector.

Inherited Methods from IloSelector
select
Constructor Detail

IloRouletteWheelSelector

public IloRouletteWheelSelector(IloEnv env, IloEvaluator< IloObject > evaluator, IloVisitor< IloObject, IloContainer > visitor=0)
Builds a roulette wheel selector from an evaluator.

This constructor builds a roulette wheel selector from an environment env which will evaluate its objects using an evaluator evaluator and an optional visitor visitor. Each object visited by visitor will be handed to evaluator for evaluation. If any evaluation is negative or all evaluations are zero, then an exception (of type IloException) is raised. 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

getEvaluator

public IloEvaluator< IloObject > getEvaluator() const
Delivers the evaluator given at construction time.

This member function returns the evaluator passed at construction time. If the selector was not constructed using an evaluator, then an empty handle is returned.


getVisitor

public IloVisitor< IloObject, IloContainer > getVisitor() const
Delivers the visitor used by the selector.

This member function returns the visitor passed at construction time, or, if no visitor was passed, the default visitor for the container from which object are being selected.