Partially mapped crossover (PMX) combines two permutation chromosomes while preserving feasible offspring without duplicate elements. It is useful for permutation-based genetic algorithms, including an 8-city traveling-salesperson example. section 8.3.1
Algorithm 8.1 Partially mapped crossover (PMX)
Input: two parents P1 and P2
Output: two children C1 and C2
1. Initialize: Choose two random crossover points and copy the segment between these two points from parent P1 to child C1 and from the second parent P2 to the second child C2.
2. For each element in the copied segment of C1:
3. Find the corresponding element in P2's segment.
4. If the corresponding element is not already in C1:
5. Replace the element in C1 at the same position as in P2 with the
corresponding element from P2.
6. Fill the remaining positions in the offspring with the elements from the other parent, ensuring that no duplicates are introduced.
7. Repeat steps 2-6 for the second offspring, using P1's segment as the reference.
8. Return C1 and C2.
Follow the PMX procedure: choose crossover points, copy parent segments, resolve displaced elements through positional mappings, fill remaining positions, and repeat for the second child. section 8.3.1
Eight-city permutation
Copy a segment from parent P1 into child C1. For each copied city, find its corresponding city in P2; if that city is absent from C1, place it where the mapped city occurs in P2. Complete the remaining positions from P2 without duplicates. section 8.3.1

