Need help asking in writing crossover code.

조회 수: 1 (최근 30일)
Xi Wen Lim
Xi Wen Lim 2016년 3월 28일
댓글: Geoff Hayes 2016년 3월 28일
I have 2 sample paths right now. In reality, these parents are randomly selected and can have different number of elements each time. The sample is as follows:
Parent 1: [1 11 21 22 23 24 14 4 5 15 16 17 27 37 38 48 58 59 69 68 67 77 78 88 89 90 100]
Parent 2: [1 2 3 4 5 15 16 26 36 37 47 57 67 77 87 88 89 99 100]
How should I write the code such that the crossover occurs everytime 2 identical nodes are found?
eg. Common nodes are 1, 15, 77, 88, 89, 100. So first I need to identify the common nodes.
Then the offspring should thus be: Offspring 1: [1 2 3 4 5 15 --> 16 17 27 37 38 48 58 50 60 68 67 77 --> 87 88 --> 89 90 100] Offspring 2: [1 11 21 22 23 24 14 4 5 15 --> 16 26 36 37 47 57 67 77 --> 78 88 --> 89 99 100]
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2016년 3월 28일
Xi - why are 4 and 5 not considered to be common nodes? Can we always assume that the numbers are in ascending order?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by