org.jgap.impl
Class WeightedRouletteSelector

java.lang.Object
  extended byorg.jgap.NaturalSelector
      extended byorg.jgap.impl.WeightedRouletteSelector
All Implemented Interfaces:
INaturalSelector

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.

Since:
1.0
Author:
Neil Rotstan, Klaus Meffert

Constructor Summary
WeightedRouletteSelector()
           
 
Method Summary
 void empty()
          Empty out the working pool of Chromosomes.
 boolean getDoubletteChromosomesAllowed()
           
 boolean returnsUniqueChromosomes()
           
 void select(int a_howManyToSelect, Population a_from_pop, Population a_to_pop)
          Select a given number of Chromosomes from the pool that will move on to the next generation population.
 void setDoubletteChromosomesAllowed(boolean a_doublettesAllowed)
          Determines whether doublette chromosomes may be added to the selector or will be ignored.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeightedRouletteSelector

public WeightedRouletteSelector()
Since:
2.0 (prior: existent thru super class)
Method Detail

select

public void select(int a_howManyToSelect,
                   Population a_from_pop,
                   Population a_to_pop)
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.

Parameters:
a_howManyToSelect - The number of Chromosomes to select.
a_from_pop - the population the Chromosomes will be selected from.
a_to_pop - the population the Chromosomes will be added to.
Since:
1.0

empty

public void empty()
Empty out the working pool of Chromosomes.

Since:
1.0

returnsUniqueChromosomes

public boolean returnsUniqueChromosomes()
Returns:
always false as some Chromosome's could be returnd multiple times
Since:
2.0

setDoubletteChromosomesAllowed

public void setDoubletteChromosomesAllowed(boolean a_doublettesAllowed)
Determines whether doublette chromosomes may be added to the selector or will be ignored.

Parameters:
a_doublettesAllowed - true: doublette chromosomes allowed to be added to the selector. FALSE: doublettes will be ignored and not added
Since:
2.0

getDoubletteChromosomesAllowed

public boolean getDoubletteChromosomesAllowed()
Returns:
TRUE: doublette chromosomes allowed to be added to the selector
Since:
2.0