This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Two point partial preservation crossover for PermutationGenotype, also known as Partially Mapped Crossover (PMX). | |
# | |
# The PMX proceeds by choosing two cut points at random: | |
# Parent 1: hkcefd bla igj | |
# Parent 2: abcdef ghi jkl | |
# | |
# The cut-out section defines a series of swapping operations to be performed on the second parent. | |
# In the example case, we swap b with g, l with h and a with i and end up with the following offspring: | |
# Offspring: igcdef bla jkh | |
# Performing similar swapping on the first parent gives the other offspring: |