public class TournamentSelection extends Object implements SelectionFunction
SelectionFunction.SelectAll, SelectionFunction.Threshold
DEFAULT
Constructor and Description |
---|
TournamentSelection()
Default constructor: sets the selection pressure to the value of 10.
|
Modifier and Type | Method and Description |
---|---|
Population |
select(Population pop,
GeneticAlgorithm genAlg)
Standard call to select organisms, will select a number of Organisms
corresponding to 75 % of the population.
|
Population |
selectNIndividuals(Population pop,
GeneticAlgorithm ga,
int n)
This method selects n Organism from the population it is given, using the
tournament selection method
|
void |
setSelectionPressure(int numberOfIndividuals)
sets the parameter controlling selection pressure
|
public TournamentSelection()
public void setSelectionPressure(int numberOfIndividuals)
numberOfIndividuals
- the number of Individuals the best is selected from, ranges from 1
(random selection) to the size of the population (elitism)public Population select(Population pop, GeneticAlgorithm genAlg) throws ChangeVetoException
select
in interface SelectionFunction
pop
- the Population
to select from.genAlg
- the parent GeneticAlgorithm
.Organism
s selectedChangeVetoException
- if the function attempts to change the population and it is
vetoed.SelectionFunction.select(org.biojavax.ga.Population, org.biojavax.ga.GeneticAlgorithm)
public Population selectNIndividuals(Population pop, GeneticAlgorithm ga, int n)
pop
- the population to select fromga
- the GeneticAlgorithm
this selection belongs ton
- number of individuals to be selected.Population
containing the selected
OrganismsCopyright © 2014 BioJava. All rights reserved.