Class UniformOrderBasedCrossover

java.lang.Object
org.cicirello.search.operators.permutations.UniformOrderBasedCrossover
All Implemented Interfaces:
PermutationBinaryOperator, Splittable<CrossoverOperator<Permutation>>, CrossoverOperator<Permutation>

public final class UniformOrderBasedCrossover extends Object implements CrossoverOperator<Permutation>, PermutationBinaryOperator
Implementation of uniform order-based crossover (UOBX). UOBX is controlled by a parameter U, which is the probability that an index is a fixed-point for children relative to parents (i.e., that the children get the elements at those positions from the parents). Child c1 gets the absolute positions of U*N elements on average from parent p1, where N is the permutation length, and c1 gets the relative positions of the remaining elements from parent p2. Likewise, child c2 gets the absolute positions of elements at those same chosen indexes from p2, with the relative positions of the others coming from p1.

Consider an example to illustrate. Let parent p1 = [3, 0, 6, 2, 5, 1, 4, 7] and parent p2 = [7, 6, 5, 4, 3, 2, 1, 0]. Consider U=0.5, and imagine in this hypothetical scenario that exactly half of the indexes were chosen, and that those 4 indexes are: 0, 3, 4, 6. Child c1 will get the elements at those indexes from p1, thus c1 begins with [3, x, x, 2, 5, x, 4, x]. The missing elements, 0, 1, 6, 7 will get their relative ordering from p2, and thus will be ordered as: 7, 6, 1, 0. In that order, they will fill into the open spots to derive: c1 = [3, 7, 6, 2, 5, 1, 4, 0]. Likewise, c2 will get the elements from indexes 0, 3, 4, and 6 from p2 to initialize as [7, x, x, 4, 3, x, 1, x]. Its missing elements, 0, 2, 5, and 6 will get relative order from p1, and thus will be ordered 0, 6, 2, 5 to derive c2 = [7, 0, 6, 4, 3, 2, 1, 5].

The worst case runtime of a call to cross is O(n), where n is the length of the permutations.

UOBX was introduced in the following paper:
Syswerda, G. Schedule Optimization using Genetic Algorithms. Handbook of Genetic Algorithms, 1991.

  • Constructor Details

    • UniformOrderBasedCrossover

      public UniformOrderBasedCrossover()
      Constructs a uniform order-based crossover (UOBX) operator, with a default U=0.5.
    • UniformOrderBasedCrossover

      public UniformOrderBasedCrossover(double u)
      Constructs a uniform order-based crossover (UOBX) operator.
      Parameters:
      u - The probability of an index being among the fixed-point positions.
      Throws:
      IllegalArgumentException - if u is less than or equal to 0.0, or if u is greater than or equal to 1.0.
  • Method Details

    • cross

      public void cross(Permutation c1, Permutation c2)
      Description copied from interface: CrossoverOperator
      Performs a crossover for an evolutionary algorithm, such that crossover forms two children from two parents. Implementations of this method modify the parameters, transforming the parents into the children.
      Specified by:
      cross in interface CrossoverOperator<Permutation>
      Parameters:
      c1 - A candidate solution subject to the crossover. This method changes the state of c1.
      c2 - A candidate solution subject to the crossover. This method changes the state of c2.
    • apply

      public void apply(int[] raw1, int[] raw2)
      See PermutationBinaryOperator for details of this method. This method is not intended for direct usage. Use the cross(org.cicirello.permutations.Permutation, org.cicirello.permutations.Permutation) method instead.
      Specified by:
      apply in interface PermutationBinaryOperator
      Parameters:
      raw1 - The raw representation of the first permutation.
      raw2 - The raw representation of the second permutation.
    • split

      Description copied from interface: Splittable
      Generates a functionally identical copy of this object, for use in multithreaded implementations of search algorithms. The state of the object that is returned may or may not be identical to that of the original. Thus, this is a distinct concept from the functionality of the Copyable interface. Classes that implement this interface must ensure that the object returned performs the same functionality, and that it does not share any state data that would be either unsafe or inefficient for concurrent access by multiple threads. The split method is allowed to simply return the this reference, provided that it is both safe and efficient for multiple threads to share a single copy of the Splittable object. The intention is to provide a multithreaded search with the capability to provide spawned threads with their own distinct search operators. Such multithreaded algorithms can call the split method for each thread it spawns to generate a functionally identical copy of the operator, but with independent state.
      Specified by:
      split in interface Splittable<CrossoverOperator<Permutation>>
      Returns:
      A functionally identical copy of the object, or a reference to this if it is both safe and efficient for multiple threads to share a single instance of this Splittable object.