Module io.jenetics.base
Package io.jenetics
Class SamplerMutator<G extends NumericGene<?,G>,C extends Comparable<? super C>>
java.lang.Object
io.jenetics.AbstractAlterer<G,C>
io.jenetics.Mutator<G,C>
io.jenetics.SamplerMutator<G,C>
- Type Parameters:
G- the gene typeC- the allele type
- All Implemented Interfaces:
Alterer<G,C>
- Direct Known Subclasses:
GaussianMutator
public class SamplerMutator<G extends NumericGene<?,G>,C extends Comparable<? super C>>
extends Mutator<G,C>
A mutator which replaces a gene (mutates it) with a value created by a
Sampler.- Since:
- 8.3
- Version:
- 8.3
-
Field Summary
FieldsFields inherited from class io.jenetics.AbstractAlterer
_probabilityFields inherited from interface io.jenetics.Alterer
DEFAULT_ALTER_PROBABILITY -
Constructor Summary
ConstructorsConstructorDescriptionSamplerMutator(double probability) Create a new mutator with the given mutationprobabilityand uniform gene sample,Sampler.UNIFORM.SamplerMutator(double probability, Sampler sampler) Create a new mutator with the given mutationprobabilityand genesampler.SamplerMutator(Sampler sampler) Create a new mutator with the default mutation probabilityAlterer.DEFAULT_ALTER_PROBABILITYand genesampler. -
Method Summary
Modifier and TypeMethodDescriptionprotected Gmutate(G gene, RandomGenerator random) Mutates the given gene.Methods inherited from class io.jenetics.AbstractAlterer
probability
-
Field Details
-
sampler
-
-
Constructor Details
-
SamplerMutator
Create a new mutator with the given mutationprobabilityand genesampler.- Parameters:
probability- the mutation probabilitysampler- the gene sampler for creating new gene values
-
SamplerMutator
Create a new mutator with the default mutation probabilityAlterer.DEFAULT_ALTER_PROBABILITYand genesampler.- Parameters:
sampler- the gene sampler for creating new gene values
-
SamplerMutator
Create a new mutator with the given mutationprobabilityand uniform gene sample,Sampler.UNIFORM.- Parameters:
probability- the mutation probability
-
-
Method Details
-
mutate
Description copied from class:MutatorMutates the given gene.- Overrides:
mutatein classMutator<G extends NumericGene<?,G>, C extends Comparable<? super C>> - Parameters:
gene- the gene to mutaterandom- the random engine used for the genotype mutation- Returns:
- the mutation result
-