public class TruncationSelection extends Object implements SelectionStrategy<Object>
| Constructor and Description |
|---|
TruncationSelection(double selectionRatio) |
TruncationSelection(NumberGenerator<Double> selectionRatio)
Creates a truncation selection strategy that is controlled by the
variable selection ratio provided by the specified
NumberGenerator. |
| Modifier and Type | Method and Description |
|---|---|
<S> List<S> |
select(List<EvaluatedCandidate<S>> population,
boolean naturalFitnessScores,
int selectionSize,
Random rng)
Selects the fittest candidates.
|
String |
toString() |
public TruncationSelection(NumberGenerator<Double> selectionRatio)
NumberGenerator.selectionRatio - A number generator that produces values in
the range 0 < r < 1. These values are used to determine
the proportion of the population that is retained in any given selection.public TruncationSelection(double selectionRatio)
selectionRatio - The proportion of the highest ranked candidates to
select from the population. The value must be positive and less than 1.public <S> List<S> select(List<EvaluatedCandidate<S>> population, boolean naturalFitnessScores, int selectionSize, Random rng)
select in interface SelectionStrategy<Object>S - The type of evolved entity that is being selected.population - The population of evolved and evaluated candidates
from which to select.naturalFitnessScores - Whether higher fitness values represent fitter
individuals or not.selectionSize - The number of candidates to select from the
evolved population.rng - A source of randomness (not used by this selection
implementation since truncation selection is deterministic).