- All Implemented Interfaces:
public final class TruncationSelector<G extends Gene<?,G>,C extends Comparable<? super C>> extends Object implements Selector<G,C>In truncation selection individuals are sorted according to their fitness. Only the n best individuals are selected. The truncation selection is a very basic selection algorithm. It has it's strength in fast selecting individuals in large populations, but is not very often used in practice.
- See Also:
- Wikipedia: Truncation selection
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
select(Seq<Phenotype<G,C>> population, int count, Optimize opt)This method sorts the population in descending order while calculating the selection probabilities.
public TruncationSelector(int n)Create a new
TruncationSelectorobject, where the worst selected individual has rank
n. This means, if you want to select
countindividuals, the worst selected individual has rank
count > n, the selected population will contain duplicate individuals.
n- the worst rank of the selected individuals
n < 1
public TruncationSelector()Create a new TruncationSelector object.
selectThis method sorts the population in descending order while calculating the selection probabilities. If the selection size is greater the the population size, the whole population is duplicated until the desired sample size is reached.
- Specified by:
Selector<G extends Gene<?,G>,C extends Comparable<? super C>>
population- The population to select from.
count- The number of phenotypes to select.
opt- Determines whether the individuals with higher fitness values or lower fitness values must be selected. This parameter determines whether the GA maximizes or minimizes the fitness function.
- The selected phenotypes (a new Population).
NullPointerException- if the