org.jgap.impl
Class ThresholdSelector
java.lang.Object
org.jgap.NaturalSelector
org.jgap.NaturalSelectorExt
org.jgap.impl.ThresholdSelector
- All Implemented Interfaces:
- java.io.Serializable, Configurable, INaturalSelector
public class ThresholdSelector
- extends NaturalSelectorExt
Implementation of a NaturalSelector that ensures a certain threshold of the
best chromosomes are taken to the next generation.
- Since:
- 2.0
- See Also:
- Serialized Form
|
Method Summary |
protected void |
add(IChromosome a_chromosomeToAdd)
Add a Chromosome instance to this selector's working pool of Chromosomes. |
void |
empty()
Empty out the working pool of Chromosomes. |
boolean |
returnsUniqueChromosomes()
|
void |
selectChromosomes(int a_howManyToSelect,
Population a_to_pop)
Select a given number of Chromosomes from the pool that will move on
to the next generation population. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThresholdSelector
public ThresholdSelector()
throws InvalidConfigurationException
- Default constructor. Uses threshold of 30 percent.
Attention: The configuration used is the one set with the static method
Genotype.setConfiguration.
- Throws:
InvalidConfigurationException- Since:
- 2.6
ThresholdSelector
public ThresholdSelector(Configuration a_config,
double a_bestChromosomes_Percentage)
throws InvalidConfigurationException
- Parameters:
a_config - the configuration to usea_bestChromosomes_Percentage - indicates the number of best
chromosomes from the population to be selected for granted. All other
chromosomes will be selected in a random fashion. The value must be in
the range from 0.0 to 1.0.
- Throws:
InvalidConfigurationException- Since:
- 2.0
selectChromosomes
public void selectChromosomes(int a_howManyToSelect,
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.
- Specified by:
selectChromosomes in class NaturalSelectorExt
- Parameters:
a_howManyToSelect - the number of Chromosomes to selecta_to_pop - the population the Chromosomes will be added to- Since:
- 2.0
returnsUniqueChromosomes
public boolean returnsUniqueChromosomes()
- Returns:
- false as we allow to return the same chromosome multiple times
- Since:
- 2.0
empty
public void empty()
- Description copied from interface:
INaturalSelector
- Empty out the working pool of Chromosomes. This will be invoked after
each evolution cycle so that the natural selector can be reused for
the next one.
add
protected void add(IChromosome a_chromosomeToAdd)
- Description copied from class:
NaturalSelector
- Add a Chromosome instance to this selector's working pool of Chromosomes.
- Specified by:
add in class NaturalSelectorExt
- Parameters:
a_chromosomeToAdd - Chromosome- Since:
- 2.0