JGAP

org.jgap.impl
Class StandardPostSelector

java.lang.Object
  extended by org.jgap.NaturalSelector
      extended by org.jgap.impl.StandardPostSelector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Configurable, INaturalSelector, ICloneable

public class StandardPostSelector
extends NaturalSelector
implements ICloneable

Implementation of a NaturalSelector that is suited for being processed after genetic operators have been executed. It takes all chromosomes with no fitness value computed to the next generation. Then it takes the top n chromosomes from the remaining input into the next generation. Which chromosomes are the best is decided by evaluating their fitness value.

Since:
3.2
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgap.NaturalSelector
NaturalSelector.AgeFitnessValueComparator, NaturalSelector.FitnessAgeValueComparator, NaturalSelector.FitnessValueComparator
 
Field Summary
 
Fields inherited from class org.jgap.NaturalSelector
m_config, m_monitor, m_monitorActive
 
Constructor Summary
StandardPostSelector()
          Default constructor.
StandardPostSelector(Configuration a_config)
          Constructor.
 
Method Summary
protected  void add(IChromosome a_chromosomeToAdd)
          Add a Chromosome instance to this selector's working pool of Chromosomes.
 java.lang.Object clone()
           
 void empty()
          Empties out the working pool of chromosomes.
 boolean equals(java.lang.Object a_o)
           
 boolean returnsUniqueChromosomes()
           
 void select(int a_howManyToSelect, Population a_from_pop, Population a_to_pop)
          Selects a given number of Chromosomes from the pool that will move on to the next generation population.
 
Methods inherited from class org.jgap.NaturalSelector
getConfiguration
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardPostSelector

public StandardPostSelector()
                     throws InvalidConfigurationException
Default constructor.

Attention: The configuration used is the one set with the static method Genotype.setConfiguration.

Throws:
InvalidConfigurationException
Since:
3.2

StandardPostSelector

public StandardPostSelector(Configuration a_config)
                     throws InvalidConfigurationException
Constructor.

Parameters:
a_config - the configuration to use
Throws:
InvalidConfigurationException
Since:
3.2
Method Detail

add

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

Specified by:
add in class NaturalSelector
Parameters:
a_chromosomeToAdd - the specimen to add to the pool
Since:
3.2

select

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

Specified by:
select in interface INaturalSelector
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()
Empties out the working pool of chromosomes.

Specified by:
empty in interface INaturalSelector
Since:
3.2

returnsUniqueChromosomes

public boolean returnsUniqueChromosomes()
Specified by:
returnsUniqueChromosomes in interface INaturalSelector
Returns:
always true as no chromosome can be returnd multiple times
Since:
3.2

equals

public boolean equals(java.lang.Object a_o)
Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
Specified by:
clone in interface ICloneable
Overrides:
clone in class java.lang.Object
Returns:
clone of the current object instance

JGAP