Genetic Algorithm for Processing Negative Fitness Values

I am trying to implement a genetic algorithm to maximize a function of n variables. However, the problem is that fitness values ​​can be negative, and I'm not sure how to handle negative values ​​when making a selection. I read this article Linear fitness scaling in the genetic algorithm creates negative fitness values, but it’s not clear to me how negative fitness values ​​were taken into account and how the scaling factors a and b were calculated.

In addition, from the article I know that choosing a roulette wheel only works for a positive fitness value. The same for choosing a tournament?

+8
genetic algorithm
source share
2 answers

The choice of the tournament does not affect this problem. He simply compares the fitness values ​​of a uniformly selected subset of size n of the population and takes the one that has the best value. However, this means that if you do not repeat the choice, then the worst n-1 people will never be selected. If you repeat the repetition, they have a chance to choose.

As with proportional selection: it does not work with negative fitness values. You can only “window” or “scale” your fitness values, in which case they work again.

I once programmed some methods as extension methods for C # IEnumerable among them - the extension method SampleProportional and SampleProportionalWithoutRepetition. They are part of the HeuristicLab under the GPL.

+6
source share

When you have negative values, you can try to find the smallest fitness value in your totality and add your opposite to each value. Thus, you will no longer have negative values, and the differences between the fitness values ​​will remain the same.

+7
source share

All Articles