public class TruncationSelection extends java.lang.Object implements SelectionStrategy<HigherOrderMutant>
Implements selection of n candidates from a population by simply selecting the n candidates with the highest fitness scores (the rest are discarded). A candidate is never selected more than once.
Constructor and Description |
---|
TruncationSelection() |
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.