How to find the best parameters for a Genetic Algorithm?

I find it helps to think of these problems as a landscape, where you're trying to find the lowest point.

Methods like genetic algorithms are used when the landscape is too large to just test all the points, and the "shape" of the landscape is such that methods like gradient-descent will get you stuck in local minima.

One good example is Rastrigin's function (image ref): alt text
(source: scientific-computing.com)
:

Your choices are:

Generation size:

  • Too large: you're going to have a long epoch time, restricting how many chances each individual has to explore it's neighbourhood.
  • Too small: you don't get good coverage of the search space.

Mutation rate:

  • Too high: you risk the individuals "jumping" over a solution they were close to.
  • Too low: they're all going to get stuck in local minima.

So it really does depend on your own particular search space. Experiment with the parameters and try to find the optimal combination. I would agree that using another GA to optimise the parameters is not going to solve the problem.


I find it rather disappointing there are so many answers that assume you can't find the best parameters for the Genetic Algorithm automatically. I agree that the parameters does depend on the problem however there are methods where you can find them.

Additionally the No Free Lunch Theorem by no means stops you from finding the best parameters, as there have already been discussion that disputes the fact:

  • Practically it does not hold
  • Description length may dispute the theorem
  • Coevolution can make the theorem irrelevant

There are two types of parameter setting:

  • Parameter Tuning (offline parameter search - before the GA is run)
  • Parameter Control (online parameter tweaking - during the GA run)
    • Adaptive
    • Self Adaptive
    • Deterministic

There are a lot of literature out there that describe how one can find these optimal parameters, it depends whether you are wanting to do the parameter search offline or online. Popular belief is that offline is better suited for most cases because the online parameter control methods would add too much complexity over offline.

Here are some examples to find the "best" parameters:

Parameter Tuning:

  • Simple parameter sweep (try everything)
  • Meta-GA ontop of a GA
  • Racing strategy to find best parameters
  • Meta-GA and Racing together

Parameter Control:

  • Adaptive probabilities for mutation and crossover
  • Self adaptive popuation size
  • Deterministic Genetic Operators

And many more, just search for the literature using keywords used above. There are scientific methods for finding suitable parameters for any given problem!


It ain't easy.

Why? Because of the No Free Lunch theorem. This basically states that there is no general search algorithm that works well for all problems.

The best you can do is tailor the search for a specific problem space. You'll have to manually tweak your parameters to fit your solution. Sorry.

Using a GA to find GA parameters gets complicated. How do you find the optimal parameters for your GAGA search? Another GA...?