Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AI and Deep Learning by (50.2k points)

Can someone explain to 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

1 Answer

0 votes
by (107k points)

Order 1 Crossover is a fairly simple permutation crossover. A swath of consecutive alleles from parent 1 falls, and remaining values are stored in the child in the order which they appear in parent 2.

image

  1. Select a random swath of consecutive alleles from parent 1. (underlined)

  2. Drop the swath down to Child 1 and mark out these alleles in Parent 2.

  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.

  4.  If you desire a second child from the two parents, flip Parent 1 and Parent 2 and go back to Step 1.

If you are looking to learn more about Artificial Intelligence then you visit Artificial Intelligence(AI) Tutorial. Also, if you are appearing for job profiles of AI Engineer or AI Expert then you can prepare for the interviews on Artificial Intelligence Interview Questions.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...