Genetic Programming

Updated: 04/26/2017 by Computer Hope

Genetic programming is the process of enhancing computer programs using algorithms inspired by biological evolution. Programming languages that lend themselves naturally to genetic programming are those able to evaluate their own code natively. A classic example is LISP because LISP's characteristic data structure is a list — and every LISP program is itself a list.

How does it work?

Genetic Programming Flow ChartA genetic program starts with a set of instructions serving as the "chromosomes," and a "fitness function" that determines which outcomes are ideal. The instructions are combined randomly to produce a first "generation" of programs, and then those individual programs are tested for their fitness.

The fittest programs — those that come closest to achieving the behavior defined by the fitness function — are selected for "breeding." The chromosomes of the fittest programs are combined, much like genetic code is combined in biological breeding. Some chromosomes are "crossed over" (exchanged) with those in other programs, and some are "mutated" — altered randomly in a predefined manner. Thousands or even millions of programs may be produced, with each generation coming closer and closer to achieving a desired result.

Instructions, Programming terms