public class TournamentSelection extends java.lang.Object implements SelectionStrategy<HigherOrderMutant>
Selection strategy that picks a pair of candidates at random and then selects the fitter of the two candidates with probability p, where p is the configured selection probability (therefore the probability of the less fit candidate being selected is 1 - p).
Constructor and Description |
---|
TournamentSelection() |
Modifier and Type | Method and Description |
---|---|
java.util.List<HigherOrderMutant> |
select(Population<HigherOrderMutant> population,
int selectionSize)
Select the specified number of candidates from the population.
|
public java.util.List<HigherOrderMutant> select(Population<HigherOrderMutant> population, int selectionSize)
SelectionStrategy
Select the specified number of candidates from the population. Implementations may assume that the population is sorted in descending order according to fitness (so the fittest individual is the first item in the list).
It is an error to call this method with an empty or null population.
select
in interface SelectionStrategy<HigherOrderMutant>
population
- The Population
from which to select.selectionSize
- The number of individual selections to make.