org.jgap
Class NaturalSelector

java.lang.Object
  extended by org.jgap.NaturalSelector
Direct Known Subclasses:
SimpleSelector, WeightedRouletteSelector

public abstract class NaturalSelector
extends java.lang.Object

Natural selectors are responsible for actually selecting a specified number of Chromosome specimens from a population, using the fitness values as a guide. Usually fitness is treated as a statistic probability of survival, not as the sole determining factor. Therefore, Chromosomes with higher fitness values are more likely to survive than those with lesser fitness values, but it's not guaranteed.


Constructor Summary
NaturalSelector()
           
 
Method Summary
protected abstract  void add(Configuration config, Chromosome c)
           
 void add(Configuration config, java.util.List chroms)
          If elitism is enabled, places appropriate chromosomes in elite list.
 void empty()
          clear pool of candidate chromosomes
protected abstract  void emptyImpl()
           
 int getElitismMinSpecieSize()
           
 float getSurvivalRate()
           
 java.util.List select(Configuration config)
          Select a given number of Chromosomes from the pool that will move on to the next generation population.
protected abstract  java.util.List select(Configuration config, int numToSurvive)
           
 void setElitism(boolean b)
           
 void setElitismMinSpecieSize(int i)
           
 void setSurvivalRate(float aSurvivalRate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NaturalSelector

public NaturalSelector()
Method Detail

add

public final void add(Configuration config,
                      java.util.List chroms)
If elitism is enabled, places appropriate chromosomes in elite list. Elitism follows methodolofy in NEAT. Passes everything else to subclass add( Configuration config, Chromosome c ) method.

Parameters:
config -
chroms - List contains Chromosome objects

add

protected abstract void add(Configuration config,
                            Chromosome c)
Parameters:
config -
c - chromosome to add to selection pool

select

public java.util.List select(Configuration config)
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. Elite chromosomes always survivie, unless there are more elite than the survival rate permits. In this case, elite with highest fitness are chosen. Remainder of survivors are determined by subclass select( Configuration config, int numToSurvive ) method.

Parameters:
config -
Returns:
List contains Chromosome objects

select

protected abstract java.util.List select(Configuration config,
                                         int numToSurvive)
Parameters:
config -
numToSurvive -
Returns:
List contains Chromosome objects, those that have survived; size of this list should be numToSurvive, unless fewer than that number of chromosomes have been added to selector

empty

public void empty()
clear pool of candidate chromosomes

See Also:
emptyImpl()

emptyImpl

protected abstract void emptyImpl()
See Also:
empty()

getSurvivalRate

public float getSurvivalRate()
Returns:
float survival rate

setSurvivalRate

public void setSurvivalRate(float aSurvivalRate)
Parameters:
aSurvivalRate -

getElitismMinSpecieSize

public int getElitismMinSpecieSize()
Returns:
minimum size a specie must be to support an elite chromosome

setElitismMinSpecieSize

public void setElitismMinSpecieSize(int i)
Parameters:
i - minimum size a specie must be to support an elite chromosome

setElitism

public void setElitism(boolean b)
Parameters:
b - true if elitisim is to be enabled