Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)

org.uncommons.watchmaker.framework.selection
Class RouletteWheelSelection

java.lang.Object
  extended by org.uncommons.watchmaker.framework.selection.RouletteWheelSelection
All Implemented Interfaces:
SelectionStrategy<Object>

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 i times. Candidates may be selected more than once.

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.

Author:
Daniel Dyer

Constructor Summary
RouletteWheelSelection()
           
 
Method Summary
<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()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RouletteWheelSelection

public RouletteWheelSelection()
Method Detail

select

public <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. Selection is with replacement (the same candidate may be selected multiple times).

Specified by:
select in interface SelectionStrategy<Object>
Type Parameters:
S - The type of the evolved objects in the population.
Parameters:
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.
Returns:
The selected candidates.

toString

public String toString()

Overrides:
toString in class Object

Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)