Partially Mapped Crossover (PMX) for permutations.
PMX preserves permutation validity by mapping conflicting values when copying segments between parents.
Algorithm
- Select two random crossover points
- Copy the segment from parent1 to child
- For remaining positions, use mapping from parent2
- 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]