org.jgap.impl
Class TournamentSelector
- java.lang.Object
-
- org.jgap.NaturalSelector
-
- org.jgap.NaturalSelectorExt
-
- org.jgap.impl.TournamentSelector
-
- All Implemented Interfaces:
- java.io.Serializable, Configurable, INaturalSelector
public class TournamentSelector extends NaturalSelectorExt
Implementation of a NaturalSelector that plays tournaments to determine the chromosomes to be taken to the next generation.The tournament size can be adjusted as well as the probability for selecting an individual.
- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jgap.NaturalSelector
NaturalSelector.AgeFitnessValueComparator, NaturalSelector.FitnessAgeValueComparator
-
-
Constructor Summary
Constructors Constructor and Description TournamentSelector()Default constructor.TournamentSelector(Configuration a_config, int a_tournament_size, double a_probability)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidempty()Empty out the working pool of Chromosomes.doublegetProbability()intgetTournamentSize()booleanreturnsUniqueChromosomes()voidselectChromosomes(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.voidsetProbability(double a_probability)voidsetTournamentSize(int a_tournament_size)-
Methods inherited from class org.jgap.NaturalSelectorExt
equals, getDoubletteChromosomesAllowed, select, setDoubletteChromosomesAllowed
-
Methods inherited from class org.jgap.NaturalSelector
getConfiguration
-
-
-
-
Constructor Detail
-
TournamentSelector
public TournamentSelector() throws InvalidConfigurationExceptionDefault constructor.Attention: The configuration used is the one set with the static method Genotype.setConfiguration.
- Throws:
InvalidConfigurationException
-
TournamentSelector
public TournamentSelector(Configuration a_config, int a_tournament_size, double a_probability) throws InvalidConfigurationException
- Parameters:
a_config- the configuration to usea_tournament_size- the size of each tournament to playa_probability- probability for selecting the best individuals- Throws:
InvalidConfigurationException- Since:
- 2.0
-
-
Method Detail
-
setTournamentSize
public void setTournamentSize(int a_tournament_size)
-
getTournamentSize
public int getTournamentSize()
-
getProbability
public double getProbability()
-
setProbability
public void setProbability(double a_probability)
-
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.- Parameters:
a_howManyToSelect- inta_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:INaturalSelectorEmpty 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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG