# GA (genetic algorithm) moves away from better values

2 views (last 30 days)
Hans on 14 Jun 2012
I am running a ga-optimization and I often get results like this one:
Best Mean Stall
Generation f-count f(x) f(x) Generations
1 932 -9.372e+005 1.231e+010 0
2 1398 -1.514e+005 7.911e+009 1
3 1864 7.705e+004 -3.975e+017 2
4 2330 -2.988e+004 -1.812e+015 0
5 2796 -2.988e+004 -1.135e+007 1
6 3262 -2.988e+004 -9.866e+007 2
7 3728 -563.1 -3.495e+007 3
8 4194 -563.1 -8.067e+006 4
9 4660 -563.1 -2.998e+007 5
10 5126 -563.1 -7.216e+006 6
11 5592 -563.1 -7.953e+006 7
12 6058 -288.2 -3.525e+006 8
13 6524 51.32 -3.823e+005 9
14 6990 -40.55 -1.176e+005 0
15 7456 19.38 2.5e+004 1
16 7922 14.31 9165 0
17 8388 14.31 8330 1
18 8854 6.788 6995 0
19 9320 6.788 8568 1
20 9786 5.907 8970 0
21 10252 1.453 1.218e+004 0
i wonder how (with an elite count set to 40 out of a population of 466) the algorithm moves to worse values first. How can this be improved? Thanks a lot for your answers!
Hans on 15 Jun 2012
I am trying again now with constraints preventing complex results. However, the algorithm is still moving away(only two generations so far becasue it needs 26500 function evaluations per generation) but still..

Richard Crozier on 14 Jun 2012
But only the mean gets worse, the best improves with every generation, and this is all that matters surely?
Random combinations with nonlinear responses can easily throw up huge values which distort the mean, while not affecting the overall progress of the search.
For example, imagine the following with a population of 7:
Gen 1 scores: 100, 100, 150, 140, 111, 100, 119
best score: 100
mean score: 117.14
Gen2 scores: 87, 66, 167, 1000000000000, 55, 98, 206
best score: 55
mean score: 1.4286 x 10^11
The really bad individual would have a very low chance of passing its genes to the next generation so it's ok.
Richard Crozier on 15 Jun 2012
or actually abs(10000 * real(ll) ) would be better.

### Categories

Find more on Genetic Algorithm in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by