Consider the example of a chemical plant with a control panel that has 100 on/off switches used to regulate the manufacturing process. You are given the task of finding the combination of switch settings that will generate the highest total output for the plant. How would you solve the problem? One obvious approach would be to run the plant briefly with each possible combination of switch settings and select the best one. Unfortunately, even in this very simplified example there are 2^100 possible combinations. This is a surprisingly gigantic number much larger, for instance, than the number of grains of sand on Earth. We could spend a million lifetimes trying various combinations of switches and never get to most of the possible combinations.

But there’s a trick that can help us. Once we start to try combinations, we might begin to notice patterns like “when switches 17 and 84 are set to on,’ production tends to increase when I put switch 53 to the off’ position.” Such insights could help us to narrow down our search, and get to the answer faster. This might not seem to be much help in the face of such an enormous number of possibilities, but the power of these rules is also surprising.

To illustrate this, think of a simple game: I pick a random whole number between one and a billion, and you try to guess it. If the only thing I tell you when you make each guess is whether you are right or wrong, you would have very little chance of guessing my number even if I let you guess non-stop for a year. If, however, I tell you whether each guess is high or low, there is a procedure that will get the exact answer within about 30 guesses. You should always guess 500 million first. For all subsequent guesses, you should always pick the mid-point of the remaining possibilities. If, for example, the response to your opening guess of 500 million is that you are too high, your next guess should be the mid-point of the remaining possibilities, or 250 million. If the response to this second guess is “too low,” then your next guess should be the mid-point of 250 million and 500 million, or 375 million, and so on. You can find my number within about a minute.

A Genetic Algorithm works on roughly the same principle. To return to our problem of the 2^100 possible combinations of switch settings, we can use a GA as an automated procedure to sort through the vast “search space” of possibilities and thus home in quickly on the best one. This procedure has the same three elements as our procedure for guessing the number: a starting guess, a feedback measurement that gives some indication of how good any guess is, and an iterative method that exploits this feedback to improve subsequent guesses.

In order to establish the initial guess for the GA, imagine writing a vertical column of 100 zeroes and ones on a piece of paper. If we agree to let one=“turn the switch on” and zero=“turn the switch off,” this could be used as a set of instructions for operating the chemical plant. The first of the hundred would tell us whether switch 1 should be on or off, the second would tell us what to do with switch 2, and so on all the way down to the 100th switch.

This is a pretty obvious analogy to what happens with biological organisms and their genetic codes and therefore, in a GA, we refer to this list as a “genome.” The mapping of genome to physical manifestation is termed the genotype-phenotype map.