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
Constructor Summary |
TournamentSelection()
Default constructor: sets the selection pressure to the value of 10. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TournamentSelection
public TournamentSelection()
- Default constructor: sets the selection pressure to the value of 10.
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:
select
in interface SelectionFunction
- Parameters:
pop
- the Population
to select from.genAlg
- the parent GeneticAlgorithm
.
- Returns:
- the
Organism
s 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
- the GeneticAlgorithm
this selection belongs ton
- number of individuals to be selected.
- Returns:
- nextgen a
Population
containing the selected
Organisms