Need help asking in writing crossover code.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Geoff Hayes
le 28 Mar 2016
Xi - why are 4 and 5 not considered to be common nodes? Can we always assume that the numbers are in ascending order?
Réponses (0)
Voir également
Catégories
En savoir plus sur Genetic Algorithm dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!