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 type
C - 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 Details

  • Constructor Details

    • SamplerMutator

      public SamplerMutator(double probability, Sampler sampler)
      Create a new mutator with the given mutation probability and gene sampler.
      Parameters:
      probability - the mutation probability
      sampler - the gene sampler for creating new gene values
    • SamplerMutator

      public SamplerMutator(Sampler sampler)
      Create a new mutator with the default mutation probability Alterer.DEFAULT_ALTER_PROBABILITY and gene sampler.
      Parameters:
      sampler - the gene sampler for creating new gene values
    • SamplerMutator

      public SamplerMutator(double probability)
      Create a new mutator with the given mutation probability and uniform gene sample, Sampler.UNIFORM.
      Parameters:
      probability - the mutation probability
  • Method Details

    • mutate

      protected G mutate(G gene, RandomGenerator random)
      Description copied from class: Mutator
      Mutates the given gene.
      Overrides:
      mutate in class Mutator<G extends NumericGene<?,G>,C extends Comparable<? super C>>
      Parameters:
      gene - the gene to mutate
      random - the random engine used for the genotype mutation
      Returns:
      the mutation result