org.jgap.impl
Class BestChromosomesSelector

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

public class BestChromosomesSelector
extends NaturalSelector

Implementation of a NaturalSelector that takes the top n chromosomes into the next generation. n can be specified. Which chromosomes are the best is decided by evaluating their fitness value

Since:
1.1
Author:
Klaus Meffert

Constructor Summary
BestChromosomesSelector()
          Constructor
BestChromosomesSelector(double a_originalRate)
           
 
Method Summary
 void empty()
          Empty out the working pool of Chromosomes.
 boolean getDoubletteChromosomesAllowed()
           
 double getOriginalRate()
           
 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.
 void setOriginalRate(double a_originalRate)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BestChromosomesSelector

public BestChromosomesSelector()
Constructor

Since:
1.1

BestChromosomesSelector

public BestChromosomesSelector(double a_originalRate)
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 will be guided by the fitness values. The chromosomes with the best fitness value win.

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

empty

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

Since:
1.1

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

returnsUniqueChromosomes

public boolean returnsUniqueChromosomes()
Returns:
always true as no Chromosome can be returnd multiple times
Since:
2.0

setOriginalRate

public void setOriginalRate(double a_originalRate)
Parameters:
a_originalRate - the rate of how many of the original chromosomes will be selected according to BestChromosomeSelector's strategy. The rest (non-original) of the chromosomes is addest as duplicates
Since:
2.0

getOriginalRate

public double getOriginalRate()
Returns:
see setOriginalRate
Since:
2.0