Package org.biojavax.ga.functions
Class TournamentSelection
- java.lang.Object
-
- org.biojavax.ga.functions.TournamentSelection
-
- All Implemented Interfaces:
SelectionFunction
public class TournamentSelection extends Object implements SelectionFunction
Tournament Selection chooses the best organisms from n random subsets of a given population. Currently it assumes a maximization problem. Perhaps this could be selected depending on the Genetic Algorithm utilized.- Author:
- Susanne Merz
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.biojavax.ga.functions.SelectionFunction
SelectionFunction.SelectAll, SelectionFunction.Threshold
-
-
Field Summary
-
Fields inherited from interface org.biojavax.ga.functions.SelectionFunction
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description TournamentSelection()Default constructor: sets the selection pressure to the value of 10.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Populationselect(Population pop, GeneticAlgorithm genAlg)Standard call to select organisms, will select a number of Organisms corresponding to 75 % of the population.PopulationselectNIndividuals(Population pop, GeneticAlgorithm ga, int n)This method selects n Organism from the population it is given, using the tournament selection methodvoidsetSelectionPressure(int numberOfIndividuals)sets the parameter controlling selection pressure
-
-
-
Constructor Detail
-
TournamentSelection
public TournamentSelection()
Default constructor: sets the selection pressure to the value of 10.
-
-
Method Detail
-
setSelectionPressure
public void setSelectionPressure(int numberOfIndividuals)
sets the parameter controlling selection pressure- Parameters:
numberOfIndividuals- the number of Individuals the best is selected from, ranges from 1 (random selection) to the size of the population (elitism)
-
select
public Population select(Population pop, GeneticAlgorithm genAlg) throws ChangeVetoException
Standard call to select organisms, will select a number of Organisms corresponding to 75 % of the population.- Specified by:
selectin interfaceSelectionFunction- Parameters:
pop- thePopulationto select from.genAlg- the parentGeneticAlgorithm.- Returns:
- the
Organisms selected - Throws:
ChangeVetoException- if the function attempts to change the population and it is vetoed.- See Also:
SelectionFunction.select(org.biojavax.ga.Population, org.biojavax.ga.GeneticAlgorithm)
-
selectNIndividuals
public Population selectNIndividuals(Population pop, GeneticAlgorithm ga, int n)
This method selects n Organism from the population it is given, using the tournament selection method- Parameters:
pop- the population to select fromga- theGeneticAlgorithmthis selection belongs ton- number of individuals to be selected.- Returns:
- nextgen a
Populationcontaining the selected Organisms
-
-