Class TypeSafeMutation<T extends Variable>

java.lang.Object
org.moeaframework.core.operator.TypeSafeMutation<T>
Type Parameters:
T - the type of decision variable this operator supports
All Implemented Interfaces:
Configurable, Mutation, Variation
Direct Known Subclasses:
Add, Insertion, PM, Remove, Replace, Swap, UM

public abstract class TypeSafeMutation<T extends Variable> extends Object implements Mutation
An abstract mutation class that validates the types of each variable before applying the mutation operation with a given probability.
  • Constructor Details

    • TypeSafeMutation

      public TypeSafeMutation(Class<T> type, double probability)
      Constructs a new mutation operator for the given type.
      Parameters:
      type - the type of decision variable this operator supports
      probability - the probability of mutating each decision variable
  • Method Details

    • getProbability

      public double getProbability()
      Returns the probability of mutating each decision variable
      Returns:
      the probability between 0.0 and 1.0, inclusive
    • setProbability

      public void setProbability(double probability)
      Sets the probability of mutating each decision variable.
      Parameters:
      probability - the probability between 0.0 and 1.0, inclusive
    • mutate

      public Solution mutate(Solution parent)
      Description copied from interface: Mutation
      Mutates the given parent to produce an offspring.
      Specified by:
      mutate in interface Mutation
      Parameters:
      parent - the parent solution
      Returns:
      the offspring
    • mutate

      public abstract void mutate(T variable)
      Mutates in place a single decision variable.
      Parameters:
      variable - the variable to mutate