Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to perform vector crossover in genetic algorithm?

I'm using genetic algorithm "to learn" the best parameters for a draughts/checkers AI. This parameters are stored in a vector of double.

[x1 x2 x3 x4 x5 x6 x7 x8 x9]

Actually I do the crossover using two simple methods: one-point crossover and two-point crossover. Unfortunately, in my opinion, this methods are not good enough.

For example if I have a genetic pool with:

[10 20 1]
[30 10 9]
[100 1 10]

If the theoretical optimum for x1 value is 50 I can't never find it by crossover. My only hope is to spawn a mutation with x1=50 good enough to pass in the next generation.

So, there is a better way to perform crossover with an array of numbers?

like image 592
Davide Aversa Avatar asked Sep 02 '11 07:09

Davide Aversa


People also ask

How do you do a crossover in genetic algorithm?

Create two random crossover points in the parent and copy the segment between them from the first parent to the first offspring. Now, starting from the second crossover point in the second parent, copy the remaining unused numbers from the second parent to the first child, wrapping around the list.

Which type of crossover is included in genetic algorithm?

Two-point and k-point crossover In two-point crossover, two crossover points are picked randomly from the parent chromosomes. The bits in between the two points are swapped between the parent organisms. Two-point crossover is equivalent to performing two single-point crossovers with different crossover points.

How is crossover performed?

During crossover the parent chromosomes are taken in pair and their genes are exchanged in certain order to obtain off spring. These offspring become next generation parent chromosomes [10] [11]. It is performed by exchanging alleles between two selected parent chromosomes in order to explore new solution space.

Why is crossover used in genetic algorithm?

The process of crossover ensures the exchange of genetic material between parents and thus creates chromosomes that are more likely to be better than the parents.


1 Answers

It seems that you have an encoding problem,- not a crossover. If you want more variability in chromosome - then encode data as sequence of bytes (or even bits). Suppose you have 3 integer parameters,- then you can represent them as 3*4=12 byte vector:

{114,2,0,214, // first 32-bit int
14,184,220,7, // second 32-bit int
145,2,32,12,  // etc...
}

then after crossover your ints will evolve with great variability. Also you can use not 1/2 point crossover, but uniform crossover - when at each chromosome point you will randomly decide what gene version you will use. In such case you will get even more variability. But keep in mind that too much variability in crossover is also disastrous because results in population which may never reach optimal solution, because even sub-optimal solution are teared apart by big random fluctuations in crossover operation. Stabilized evolution is main keyword here.

Another approach - is not to use genetic algorithm, but evolution strategy algorithms which changes all genes in chromosome. But this approach is feasible if number of different gene versions is not very big. So this may not fit your problem with floats/doubles.

HTH!

like image 186
Agnius Vasiliauskas Avatar answered Nov 15 '22 09:11

Agnius Vasiliauskas