Order Crossover (OX) - genetic algorithm

Can someone explain to me how the Order crossover works? I'll give this example, and I want to understand it in general terms for implementation after.

Parent 1 = 1 2 3 | 4 5 6 7 | 8 9

Parent 2 = 4 5 2 | 1 8 7 6 | 9 3

and the solution is two child screens:

Children 1 = 2 1 8 | 4 5 6 7 | 9 3

Children 2 = 3 4 5 | 1 8 7 6 | 9 2

I understand some parts, but others not.

thank

+3


source to share


2 answers


One such solution for an ordered crossover is detailed in this post .

This answer provides a sample Java code with documentation describing the processes used for an ordered crossover.



Also, this document from Moscato provides a breakdown of the OX process.

Hope this helps!

+3


source


Basically, the shaft of consecutive alleles from parent 1 falls down, and the remaining values ​​are placed in the child in the order they appear in parent 2.

enter image description here

Step 1: select a random row of consecutive alleles from parent 1. (underlined)



Step 2: Drop the shaft to Child 1 and highlight these alleles in Parent 2.

Step 3: Starting on the right side of the swath, take the alleles from parent 2 and insert them into Child 1 on the right side of the swath. Since 8 is in this position in Parent 2, it is inserted into Child 1 first at the right edge of the roll. Note that alleles 1, 2 and 3 are skipped as they are highlighted and 4 is inserted at the second position in Child 1.

Step 4: If you want a second child from two parents, turn over Parent 1 and Parent 2 and return to step 1.

+10


source







All Articles