public class RouletteWheelSelection extends Object implements SelectionStrategy<Object>
Implements selection of n candidates from a population by selecting
n candidates at random where the probability of each candidate getting
selected is proportional to its fitness score. This is analogous to each
candidate being assigned an area on a roulette wheel proportionate to its fitness
and the wheel being spun
In some instances, particularly with small population sizes, the randomness
of selection may result in excessively high occurrences of particular candidates.
If this is a problem, StochasticUniversalSampling
provides an alternative
fitness-proportionate strategy for selection.
Constructor and Description |
---|
RouletteWheelSelection() |
Modifier and Type | Method and Description |
---|---|
<S> List<S> |
select(List<EvaluatedCandidate<S>> population,
boolean naturalFitnessScores,
int selectionSize,
Random rng)
Selects the required number of candidates from the population with
the probability of selecting any particular candidate being proportional
to that candidate's fitness score.
|
String |
toString() |
public <S> List<S> select(List<EvaluatedCandidate<S>> population, boolean naturalFitnessScores, int selectionSize, Random rng)
select
in interface SelectionStrategy<Object>
S
- The type of the evolved objects in the population.population
- The candidates to select from.naturalFitnessScores
- True if higher fitness scores indicate fitter
individuals, false if lower fitness scores indicate fitter individuals.selectionSize
- The number of selections to make.rng
- A source of randomness.