5

E.g. I have two random representatives

1 6 8 9 0 3 4 7 5

and

3 6 5 7 8 5

What are the ways to crossover them?

Add some empty numbers (or operations or sth) on the end of every genotype so they will have the same size?

3 6 5 7 8 5 -1 -1 -1

where -1 means nothing?

Or copy few number from first genotype and some from second?

What is the way you use?

manlio
  • 18,345
  • 14
  • 76
  • 126
Mateusz
  • 690
  • 1
  • 6
  • 21
  • Difficult to answer because what you need to do is largely problem dependent. You need to figure out what makes the most sense to do for your specific problem. If a specific number in the same position, regardless of the amount of numbers in total, always means / does the exact same thing (but not the same as the same number in a different position), what you suggested would work just fine. If not, you may want to consider doing a more complex cross-over. – Bernhard Barker May 14 '13 at 22:03

1 Answers1

9

If you already have variable length chromosomes, then it shouldnt matter how you do it, you just need to select a crossover point for each of them, and then crossover as normal.

For example using your chromosomes, I have selected two points (.) at random:

1 6 8 9.0 3 4 7 5
3 6.5 7 8 5

With resulting chromosomes:

1 6 8 9.5 7 8 5
3 6.0 3 4 7 5
NWS
  • 3,080
  • 1
  • 19
  • 34