Package org.biojavax.ga.functions
Class TournamentSelection
java.lang.Object
org.biojavax.ga.functions.TournamentSelection
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionDefault constructor: sets the selection pressure to the value of 10. -
Method Summary
Modifier and TypeMethodDescriptionselect
(Population pop, GeneticAlgorithm genAlg) Standard call to select organisms, will select a number of Organisms corresponding to 75 % of the population.selectNIndividuals
(Population pop, GeneticAlgorithm ga, int n) This method selects n Organism from the population it is given, using the tournament selection methodvoid
setSelectionPressure
(int numberOfIndividuals) sets the parameter controlling selection pressure
-
Constructor Details
-
TournamentSelection
public TournamentSelection()Default constructor: sets the selection pressure to the value of 10.
-
-
Method Details
-
setSelectionPressure
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
Standard call to select organisms, will select a number of Organisms corresponding to 75 % of the population.- Specified by:
select
in interfaceSelectionFunction
- Parameters:
pop
- thePopulation
to select from.genAlg
- the parentGeneticAlgorithm
.- Returns:
- the
Organism
s selected - Throws:
ChangeVetoException
- if the function attempts to change the population and it is vetoed.- See Also:
-
selectNIndividuals
This method selects n Organism from the population it is given, using the tournament selection method- Parameters:
pop
- the population to select fromga
- theGeneticAlgorithm
this selection belongs ton
- number of individuals to be selected.- Returns:
- nextgen a
Population
containing the selected Organisms
-