Can someone explain me how Order Crossover works? I will give this example and I want to understand it in a generic way to implement 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 are two childreen:
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.
Thanks
Basically, a swath of consecutive alleles from parent 1 drops down, and remaining values are placed in the child in the order which they appear in parent 2.
Step 1: Select a random swath of consecutive alleles from parent 1. (underlined)
Step 2: Drop the swath down to Child 1 and mark out these alleles in Parent 2.
Step 3: Starting on the right side of the swath, grab alleles from parent 2 and insert them in Child 1 at the right edge of the swath. Since 8 is in that position in Parent 2, it is inserted into Child 1 first at the right edge of the swath. Notice that alleles 1, 2 and 3 are skipped because they are marked out and 4 is inserted into the 2nd spot in Child 1.
Step 4: If you desire a second child from the two parents, flip Parent 1 and Parent 2 and go back to Step 1.
One such solution for Ordered Crossover is detailed in this post.
This answer provides some sample java code with documentation detailing the processes used for the Ordered Crossover.
Additionally, this paper from Moscato provides a breakdown of the OX Process.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With