java.lang.Object
org.moeaframework.core.operator.binary.BitFlip
All Implemented Interfaces:
Configurable, Mutation, Variation

public class BitFlip extends Object implements Mutation
Bit flip mutation operator. Each bit is flipped (switched from a 0 to a 1, or vice versa) using the specified probability.

This operator is type-safe.

  • Constructor Details

    • BitFlip

      public BitFlip()
      Constructs a bit flip operator with the default settings.
    • BitFlip

      public BitFlip(double probability)
      Constructs a bit flip operator.
      Parameters:
      probability - the probability of flipping a bit
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Variation
      Returns the name of this variation operator. This name should also be used as the prefix for any parameters. As such, the name should only contain alphanumeric characters, avoid using whitespace and other symbols.
      Specified by:
      getName in interface Variation
      Returns:
      the name of this variation operator
    • getProbability

      public double getProbability()
      Returns the probability of flipping a bit.
      Returns:
      the probability of flipping a bit
    • setProbability

      public void setProbability(double probability)
      Sets the probability of flipping a bit.
      Parameters:
      probability - the probability of flipping a bit
    • 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 static void mutate(BinaryVariable variable, double probability)
      Mutates the specified variable using bit flip mutation.
      Parameters:
      variable - the variable to be mutated
      probability - the probability of flipping a bit