Interface Mutator

All Known Implementing Classes:
GenericMutatorImpl, NodeReplacementMutator, ProgramRandomMutateMutator, ProgramRandomPruneMutator, ProgramRulesApplicatorMutator, TrimTreeMutator
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Mutator
Functional interface for applying mutation operations to genotypes in evolutionary algorithms.

Mutation is a crucial genetic operator that introduces variation into the population by making small random changes to individual genotypes. This helps maintain genetic diversity and enables the exploration of new areas in the solution space.

The mutator operates on the genotype level, potentially modifying one or more chromosomes within the genotype according to the specific mutation strategy being applied.

Common mutation strategies include:

  • Random mutation: Randomly change allele values with a given probability
  • Creep mutation: Make small incremental changes to numeric values
  • Swap mutation: Exchange positions of two alleles (useful for permutations)
  • Partial mutation: Apply mutation to only a subset of chromosomes

Implementations should be:

  • Stateless: The same input should produce consistent probabilistic behavior
  • Thread-safe: May be called concurrently during parallel evolution
  • Preserve structure: Maintain genotype integrity and constraints
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    mutate(Genotype original)
    Applies mutation to the given genotype and returns a new mutated genotype.
  • Method Details

    • mutate

      Genotype mutate(Genotype original)
      Applies mutation to the given genotype and returns a new mutated genotype.

      The original genotype should not be modified; instead, a new genotype with the mutations applied should be returned. The specific mutation behavior depends on the implementation and the mutation policy being used.

      Mutation may affect:

      • Individual alleles within chromosomes (bit flips, value changes)
      • Chromosome structure (for variable-length representations)
      • Multiple chromosomes simultaneously
      Parameters:
      original - the genotype to mutate, must not be null
      Returns:
      a new genotype with mutations applied, never null
      Throws:
      IllegalArgumentException - if original genotype is null or invalid
      RuntimeException - if mutation fails due to constraint violations