Genetic programming is a process by which computer programs are enhanced using algorithms inspired by biological evolution. Programming languages that lend themselves naturally to genetic programming are those able to evaluate their code natively. A classic example is Lisp, whose characteristic data structure is a list. Every Lisp program is written as a list, so Lisp programs are very good at manipulating and generating Lisp programs.
How does it work?
A 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.” The chromosomes of the fittest programs are combined, much like genetic code is combined in biological evolutionary selection. 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 in this manner, each generation getting closer to a desired result.
Instructions, Programming terms