A genetic algorithm is at its core an efficient strategy for guessing. Any kind of task where you would sit and guess solutions to a problem but where the number of possible guesses is huge is a good candidate for a genetic algorithm. You maintain a fixed number of guesses at any given time and you figure out new guesses based on the performance of old guesses.

The basic outline of an genetic algorithm is very simple. An initial population is generated. Fitness values are computed for this first population. We select individuals of higher fitness (better performance concerning the problem we are trying to solve) and produce new individuals based on them by mutation. The new individuals are evaluated. We check to see if any of these new individuals meet the criteria we are searching for. If not we repeat the process.

There are several mathematically imprecise terms in the previous paragraph and finding specific, mathematical definitions for these terms is most of what I am doing when I write a genetic algorithm to solve a particular task. For instance, the terms ‘fitness’ or ‘better performance’ would need to be defined.

Quite often, I use a diagram similar to the one above to remind me of all the elements I need to incorporate in order to construct an evolutionary algorithm. I usually write in C++. This is one of the reasons I am excited to see the same elements play out in Mathematica. The promise is that I can write more interesting programs in a shorter time in Mathematica. (It has a tremendous ability to manipulate formulas.) The trade-off is programs in Mathematica would be slower than they would be if I wrote the entire thing in C++.

### Like this:

Like Loading...

*Related*