Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if a genetic algorithm is working? [closed]

It is important to benchmark your algorithm before applying it to a specific question. Otherwise, garbage in, garbage out. Having implemented a genetic algorithm (GA) with elitism, I have no idea how to test whether it works or not.

I have thought about printing out the statistics, such as mean, median, and variance, of each generation. However, they are not really strong indicators of the correctness. For example, the maximum fitness doesn't say anything, because even for random search with elitism, you have a non-decreasing maximum fitness. Mean and median do not say much either, because they may occasionally deteriorate, even if the GA is perfectly correct.

What is an effective way of testing if GA is working good?

like image 298
Sibbs Gambling Avatar asked Oct 22 '25 06:10

Sibbs Gambling


1 Answers

A great approach is that you have elitism, in that way you ensure you will never lose your best individual.

However, that doesn't mean that through the generations you will see progress. First you need to understand the GA, and best way to do that is to play around with the parameters (CROSSOVER RATE, MUTATION RATE, No. INDIVIDUAL, No. ITERATION, ELITISM VALUE) and see the outcome.

As trailmax says, visualize or print out the best individual as a function of the number of iterations. If you see that the best individual is "stuck", e.i. doesn't really show progress, try to change the parameters and see what happens. If a progress is shown (ok, this is too relative!) your algorithm works. :)

like image 144
Ranic Avatar answered Oct 25 '25 02:10

Ranic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!