Class EnhancedEdgeRecombination

All Implemented Interfaces:
PermutationBinaryOperator, Splittable<CrossoverOperator<Permutation>>, CrossoverOperator<Permutation>

public final class EnhancedEdgeRecombination extends Object implements CrossoverOperator<Permutation>, PermutationBinaryOperator
Implementation of the Enhanced Edge Recombination operator, a crossover operator for permutations. Enhanced Edge Recombination is an improvement over the original Edge Recombination operator. Both the original and the Enhanced Edge Recombination assumes that the permutations represent a cyclic sequence of edges. That is, if 3 follows 5 in the permutation, then that corresponds to an undirected edge between 3 and 5. Given this assumption, it is suitable for problems where permutations do represent a sequence of edges such as the traveling salesperson. However, the Chips-n-Salsa library does not limit its use to such problems, and you can use it on any problem with solutions represented as permutations.

The original Edge Recombination operator, implemented in the EdgeRecombination class, is designed to create children that inherit undirected edges from the parents. A child permutation inherited an edge (i,j), if i and j are in adjacent positions anywhere in the child, and if there is at least one parent that likewise includes i and j in adjacent positions. Since the operator considers edges to be undirected, the order also doesn't matter. For example, if j immediately follows i in the child, then a parent may have been such that i immediately followed j. And since it considers the permutation to be a cycle, the two endpoints are considered to be adjacent. The documentation of the EdgeRecombination class includes an explanation of the inner workings of the operator, along with an example.

The Enhanced Edge Recombination operator additionally attempts to create children that inherit common subsequences of edges from the parents. It does so using a modified version of the edge map data structure introduced by Whitley et al for efficient implementation of the original Edge Recombination. Starkweather et al's modification involves augmenting the edge map to mark the edges that the parents have in common. Then, when constructing the child, during the decision of which element to add next to the permutation, an edge that is the start of a common subsequence of edges is preferred over other edges from the parents.

We leave the details to the paper that introduced the Enhanced Edge Recombination operator:
T. Starkweather, S McDaniel, K Mathias, D Whitley, and C Whitley. A Comparison of Genetic Sequencing Operators. Proceedings of the Fourth International Conference on Genetic Algorithms, pages 69-76, 1991.

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

  • Constructor Details

    • EnhancedEdgeRecombination

      public EnhancedEdgeRecombination()
      Constructs an enhanced edge recombination operator.
  • 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>
      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

      public EnhancedEdgeRecombination 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>>
      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)
      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
      raw1 - The raw representation of the first permutation.
      raw2 - The raw representation of the second permutation.