Warm tip: This article is reproduced from serverfault.com, please click

best crossover for route optimization

发布于 2021-02-18 06:29:49

I was checking on crossover techniques for route optimization and have gone through few of thgem as mentioned below

1 - single point crossover
2 - two point crossover
3 - uniform crossover

In single point crossover, we generally swap one variable from each parent and get the child. The same with two point crossover where we swap two variables from two parents .

In my problems, the parents length's are not same, for example p1: ['a','b','c'] and p2:['v','n','m','h','k'] . As we the length of both parents are not same, I was able to use single point crossover based on the even and odd technique.

Now I want to use the uniform crossover with masking and finding it difficult to use with different lengths. Any suggestions ?

Questioner
pylearner
Viewed
0
22.2k 2021-02-24 10:16:14

What length are the offspring to be, if they are to be the same length of the parents then you could just do a normal uniform order. For example

 [a,b,c] = p1
 [v,n,m,h,k] = p2
 [0,0,1,0,1] = mask (this should be random)

 [v,n,c] = o1
 [a,b,m,h,k] = o2

You could even randomly place where the smaller one sits on the mask for example:

 [-,-,v,n,c]
 [a,b,m,h,k]

so offspring would be

 [v,h,c] 
 [a,b,m,n,k]