T
- The type of evolvable entity that this operator applies to.public class Replacement<T> extends Object implements EvolutionaryOperator<T>
Constructor and Description |
---|
Replacement(CandidateFactory<T> factory,
NumberGenerator<Probability> replacementProbability)
Creates a replacement operator that replaces individuals according to
a variable probability.
|
Replacement(CandidateFactory<T> factory,
Probability replacementProbability)
Creates a replacement operator that replaces individuals according to
the specified probability.
|
Modifier and Type | Method and Description |
---|---|
List<T> |
apply(List<T> selectedCandidates,
Random rng)
Randomly replace zero or more of the selected candidates with new,
independent individuals that are randomly created.
|
public Replacement(CandidateFactory<T> factory, Probability replacementProbability)
factory
- A source of new individuals.replacementProbability
- The probability that any given individual will
be replaced by a new individual. This should typically be quite low. If it is
too high, it will undermine the evolutionary progress.public Replacement(CandidateFactory<T> factory, NumberGenerator<Probability> replacementProbability)
factory
- A source of new individuals.replacementProbability
- A NumberGenerator
that provides
a probability of replacement. The probablity may be constant, or it may change
over time. The probability should typically be quite low. If it is too high,
it will undermine the evolutionary progress.public List<T> apply(List<T> selectedCandidates, Random rng)
apply
in interface EvolutionaryOperator<T>
selectedCandidates
- The selected candidates, some of these may be
discarded and replaced with new individuals.rng
- A source of randomness.