Need help asking in writing crossover code.

1 visualizzazione (ultimi 30 giorni)
Xi Wen Lim
Xi Wen Lim il 28 Mar 2016
Commentato: Geoff Hayes il 28 Mar 2016
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 Commento
Geoff Hayes
Geoff Hayes il 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?

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by