Jido.Evolve.Crossover.PMX (Jido Evolve v1.0.0)

Copy Markdown View Source

Partially Mapped Crossover (PMX) for permutations.

PMX preserves permutation validity by mapping conflicting values when copying segments between parents.

Algorithm

  1. Select two random crossover points
  2. Copy the segment from parent1 to child
  3. For remaining positions, use mapping from parent2
  4. If value conflicts, follow the mapping chain

Example

parent1 = [0, 1, 2, 3, 4, 5, 6, 7, 8]
parent2 = [1, 2, 3, 5, 4, 6, 8, 7, 0]

# Cut points at 3 and 6
child   = [_, _, _, 3, 4, 5, _, _, _]

# Fill remaining using mapping
child   = [0, 1, 2, 3, 4, 5, 6, 7, 8]