Need help asking in writing crossover code.
1 回表示 (過去 30 日間)
古いコメントを表示
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
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 Center および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!