Interface MutationOperator<T extends GASolution<T>>

All Known Implementing Classes:
GaussianMutation

public interface MutationOperator<T extends GASolution<T>>
Interface for mutation operators in genetic algorithms. A mutation operator defines how an individual solution is randomly modified. The GA will call this interface to perform mutation on individuals in the population.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    beginGeneration(long generation, long maxGenerations)
    Notify the operator before offspring are created for a generation.
    mutate(T individual, Random rng)
    Mutate an individual, either in-place or by returning a replacement.
    default T
    mutate(T individual, Random rng, double mutationRate)
    Apply the configured mutation probability to one offspring.
  • Method Details

    • beginGeneration

      default void beginGeneration(long generation, long maxGenerations)
      Notify the operator before offspring are created for a generation. Stateful operators may use this to adapt their mutation strength.
      Parameters:
      generation - generation about to be produced, starting at zero
      maxGenerations - configured generation limit
    • mutate

      T mutate(T individual, Random rng)
      Mutate an individual, either in-place or by returning a replacement.
      Parameters:
      individual - individual to mutate
      rng - source of randomness
      Returns:
      non-null mutated individual
    • mutate

      default T mutate(T individual, Random rng, double mutationRate)
      Apply the configured mutation probability to one offspring. Operators with gene-level mutation semantics may override this method and interpret mutationRate at that finer granularity.
      Parameters:
      individual - offspring to consider for mutation
      rng - source of randomness
      mutationRate - configured rate in [0,1]
      Returns:
      the original or mutated individual; never null