Package smile.gap

Enum Class Crossover

All Implemented Interfaces:
Serializable, Comparable<Crossover>, Constable

public enum Crossover extends Enum<Crossover>
The types of crossover operation.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Single point crossover - one crossover point is selected, binary string from beginning of chromosome to the crossover point is copied from one parent, the rest is copied from the second parent.
    Two point crossover - two crossover point are selected, binary string from beginning of chromosome to the first crossover point is copied from one parent, the part from the first to the second crossover point is copied from the second parent and the rest is copied from the first parent.
    Uniform crossover - bits are randomly copied from the first or from the second parent.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract BitString[]
    apply(BitString father, BitString mother)
    Returns a pair of offsprings by crossovering parent chromosomes.
    static Crossover
    Returns the enum constant of this class with the specified name.
    static Crossover[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • SINGLE_POINT

      public static final Crossover SINGLE_POINT
      Single point crossover - one crossover point is selected, binary string from beginning of chromosome to the crossover point is copied from one parent, the rest is copied from the second parent.
    • TWO_POINT

      public static final Crossover TWO_POINT
      Two point crossover - two crossover point are selected, binary string from beginning of chromosome to the first crossover point is copied from one parent, the part from the first to the second crossover point is copied from the second parent and the rest is copied from the first parent.
    • UNIFORM

      public static final Crossover UNIFORM
      Uniform crossover - bits are randomly copied from the first or from the second parent.
  • Method Details

    • values

      public static Crossover[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Crossover valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • apply

      public abstract BitString[] apply(BitString father, BitString mother)
      Returns a pair of offsprings by crossovering parent chromosomes.
      Parameters:
      father - the parent chromosome.
      mother - the other parent chromosome.
      Returns:
      a pair of offsprings.