Class UniformPartiallyMatchedCrossover

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

public final class UniformPartiallyMatchedCrossover extends Object implements CrossoverOperator<Permutation>, PermutationFullBinaryOperator
Implementation of uniform partially matched crossover (UPMX). UPMX is a variation of partially matched crossover (PMX), but whereas PMX selects a contiguous cross region similar to a two-point bit-string crossover, UPMX selects a set of non-contiguous cross points similar to uniform crossover for bit-strings. UPMX begins by selecting a set of random cross points, using a parameter U, which is the probability that an index is a cross point. Thus, for permutation length N, the expected number of cross points is U*N. UPMX then initializes the children as copies of the parents, and proceeds to make a sequence of swaps within child c1 as to cause c1 at the end of those swaps to contain the elements from the cross points of p2 at those indexes. And similarly for the other child. Essentially, the cross points define a set of swaps that are made internally within each child.

Consider as an example parent permutation p1 = [7, 6, 5, 4, 3, 2, 1, 0] and parent permutation p2 = [1, 2, 0, 5, 6, 4, 7, 3]. Now consider that the random cross sites are indexes 3, 1, and 6. Child c1 is initialized as a copy of p1, i.e., c1 = [7, 6, 5, 4, 3, 2, 1, 0]. At index 3 in p1 is element 4, and at index 3 in p2 is element 5, so UPMX swaps the 4 and the 5 within c1 to get c1 = [7, 6, 4, 5, 3, 2, 1, 0]. At index 1, we find elements 6 and 2 in p1 and p2, respectively, so UMPX swaps the 6 and the 2 within c1 to get c1 = [7, 2, 4, 5, 3, 6, 1, 0]. Finally, at index 6, we find 1 and 7 in p1 and p2, respectively. Thus, UPMX swaps the 1 and 7 within c1 to get the final child c1 = [1, 2, 4, 5, 3, 6, 7, 0]. In a similar way, we can derive child c2, such that c2 = [7, 6, 0, 4, 2, 5, 1, 3].

UPMX was introduced in the following paper:

Vincent A. Cicirello and Stephen F. Smith. Modeling GA Performance for Control Parameter Optimization. Proceedings of the Genetic and Evolutionary Computation Conference (GECCO-2000), pages 235-242. Morgan Kaufmann Publishers, July 2000. [PDF] [BIB] [From ACM Digital Library]

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

  • Constructor Details

    • UniformPartiallyMatchedCrossover

      public UniformPartiallyMatchedCrossover()
      Constructs a uniform partially matched crossover (UPMX) operator, with a default u = 1.0 / 3.0. The rationale for this default u is that it leads UPMX to the same expected number of swaps as PMX, only scattered throughout the permutation.
    • UniformPartiallyMatchedCrossover

      public UniformPartiallyMatchedCrossover(double u)
      Constructs a uniform partially matched crossover (UPMX) operator.
      Parameters:
      u - The probability of an index being among the cross points.
      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.
    • 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.
    • apply

      public void apply(int[] raw1, int[] raw2, Permutation p1, Permutation p2)
      See PermutationFullBinaryOperator 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 PermutationFullBinaryOperator
      Parameters:
      raw1 - The raw representation of the first permutation.
      raw2 - The raw representation of the second permutation.
      p1 - The first permutation.
      p2 - The second permutation.