Class SwapPropertyMutator

    • Field Summary

      • Fields inherited from class io.jenetics.AbstractAlterer

        _probability
      • Fields inherited from interface io.jenetics.Alterer

        DEFAULT_ALTER_PROBABILITY
    • Constructor Summary

      Constructors 
      Constructor Description
      SwapPropertyMutator​(double probability)
      Construct a swap mutator which swaps a component of the genes.
    • Constructor Detail

      • SwapPropertyMutator

        public SwapPropertyMutator​(double probability)
        Construct a swap mutator which swaps a component of the genes.
        Parameters:
        probability - the swapping probability
    • Method Detail

      • mutate

        protected io.jenetics.MutatorResult<io.jenetics.Chromosome<DiscreteGene>> mutate​(io.jenetics.Chromosome<DiscreteGene> chromosome,
                                                                                         double p,
                                                                                         Random random)
        Overrides:
        mutate in class io.jenetics.SwapMutator<DiscreteGene,​Double>
      • swapComponent

        protected abstract void swapComponent​(io.jenetics.util.MSeq<DiscreteGene> mSeq,
                                              int a,
                                              int b)
        Swap a property of two genes at positions a and b.
        Parameters:
        mSeq - sequence of genes
        a - position a
        b - position b