2

I'm working on genetic algorithm which uses blend BLX-alpha crossover.

I found 2 algorithms, which seem to me quite different from each other

  1. https://yadi.sk/i/u5nq986GuDoNm - page 8
    crossover is made as follows:
    a. Select 2 parents: G1, G2
    b. generate uniformly distributed random number gamma from [-alpha, 1 + alpha], where alpha = 0.5
    c. generate an offspring as follows: G = gamma * G1 + (1 - gamma) * G2
  2. http://www.tomaszgwiazda.com/blendX.htm
    crossover is made as follows:
    a. select two parents X(t) and Y(t) from a parent pool

    b. create two offspring X(t+1) and Y(t+1) as follows:

    c. for i = 1 to n do

    d. di=|xi(t)-yi(t)|

    e. choose a uniform random real number u from interval

    f. xi(t+1)=u

    g. choose a uniform random real number u from interval

    h. yi(t+1)=u

    i. end do

where: a – positive real parameter
xi, yi - the i-th component of a parent
di - distance betweet parent components

Which of these 2 algorithms is correct? Or they are equal? In my task I'm using 2nd method, because the first one provides unsatisfying results. I concerned with this question, because I'm working on GA, where the first algorithm is supposed to be used.

Any help would be appreciated!

Alex
  • 43
  • 1
  • 8
  • There are many crossover operators. There is no "correct" one. Try both and use the one that works best for your problem. – Ray Aug 18 '16 at 02:29

2 Answers2

2

You can search for paper "Real-Coded Genetic Algorithms and Interval Schemata" in which the BLX-alpha crossover first introduced.

In this paper,the first algorithm is introduced.

As for the second one ,I think it is equal to the first one in the way of producing offsprings.Because the second algs produces two offsprings one time,it has more chance to get a better individual.But it also needs more FEs.

Kevin Yang
  • 76
  • 5
0
def crossover_blen(p1,p2,alpha):

         c1,c2 = deepcopy(p1),deepcopy(p2)

         for i in range(len(p1)):

             distancia = abs(c2[i]-c1[i])

             l = min(c1[i],c2[i]) - alpha * distancia
             u = max(c1[i],c2[i]) + alpha * distancia

             c1[i] = l + random.random() * (u-l)
             c2[i] = l + random.random() * (u-l)

         return [c1,c2]
bguiz
  • 27,371
  • 47
  • 154
  • 243