org.jgap.impl
Class WeightedRouletteSelector

java.lang.Object
  extended by org.jgap.NaturalSelector
      extended by org.jgap.impl.WeightedRouletteSelector

public class WeightedRouletteSelector
extends NaturalSelector

A basic implementation of NaturalSelector that models a roulette wheel. When a Chromosome is added, it gets a number of "slots" on the wheel equal to its fitness value. When the select method is invoked, the wheel is "spun" and the Chromosome occupying the spot on which it lands is selected. Then the wheel is spun again and again until the requested number of Chromosomes have been selected. Since Chromosomes with higher fitness values get more slots on the wheel, there's a higher statistical probability that they'll be chosen, but it's not guaranteed.


Constructor Summary
WeightedRouletteSelector()
           
 
Method Summary
protected  void add(Configuration a_activeConfigurator, Chromosome a_chromosomeToAdd)
          Add a Chromosome instance to this selector's working pool of Chromosomes.
protected  void emptyImpl()
          Empty out the working pool of Chromosomes.
protected  java.util.List select(Configuration a_activeConfiguration, int a_howManyToSelect)
          Select a given number of Chromosomes from the pool that will move on to the next generation population.
 
Methods inherited from class org.jgap.NaturalSelector
add, empty, getElitismMinSpecieSize, getSurvivalRate, select, setElitism, setElitismMinSpecieSize, setSurvivalRate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeightedRouletteSelector

public WeightedRouletteSelector()
Method Detail

add

protected void add(Configuration a_activeConfigurator,
                   Chromosome a_chromosomeToAdd)
Add a Chromosome instance to this selector's working pool of Chromosomes.

Specified by:
add in class NaturalSelector
Parameters:
a_activeConfigurator - The current active Configuration to be used during the add process.
a_chromosomeToAdd - The specimen to add to the pool.

select

protected java.util.List select(Configuration a_activeConfiguration,
                                int a_howManyToSelect)
Select a given number of Chromosomes from the pool that will move on to the next generation population. This selection should be guided by the fitness values, but fitness should be treated as a statistical probability of survival, not as the sole determining factor. In other words, Chromosomes with higher fitness values should be more likely to be selected than those with lower fitness values, but it should not be guaranteed.

Specified by:
select in class NaturalSelector
Parameters:
a_activeConfiguration - The current active Configuration that is to be used during the selection process.
a_howManyToSelect - The number of Chromosomes to select.
Returns:
List contains Chromosome objects.

emptyImpl

protected void emptyImpl()
Empty out the working pool of Chromosomes.

Specified by:
emptyImpl in class NaturalSelector
See Also:
NaturalSelector.empty()