Genetic programming is the process of using one computer program to write another computer program using evolutionary algorithm-based methodology. This process is often compared to linear programming, in which the programmer writes specific instructions for the computer to carry out. LISP and Scheme are the most common programming languages for this type of work due to their high level functionality and flexibility. As a result of its conceptual similarity to biological evolution, genetic programming is often cited as an example of bio-inspired computing.
Genetic programs (GPs) work by generating and running thousands of programs and chooses the most effective to use. For example, a GP might be used to create a program to draw a sketch of a photograph. The first thing that the GP would do is create a set of programs that use various computer drawing functions in random combinations. Then the GP would run each of these programs in order, outputting the results of each to image files.
The next step for the GP is selecting the best of those programs from the set. This process is generally the most difficult part of genetic programming. In the case of the drawing program, the GP would use image comparison software to determine which of the random drawings was most similar to the image the software was attempting to draw. Of the randomly generated programs, the GP would select the top several and discard the rest. The selection process is known as fitness evaluation, and is generally considered to be the most difficult part of genetic programming.
Once the top few programs have been selected, the GP will use them as the basis of a new batch of programs. Each new batch is called a generation. The two ways of creating the new generation are mutation and crossover. Mutation works by taking one of the existing programs and making random changes to it, hopefully for the better. Crossover, also called breeding, works by taking two of the top programs and combining elements of them to create new programs.
After creating a new batch of programs, the GP repeats the process of running and evaluating them, and then repeats the selection, elimination, and generation processes. GPs will frequently run hundreds of generations before finding a single program with a satisfactory result. Despite this limitation, genetic programming is a common way to solve some types of difficult computing problems, including robotic engineering and artificial intelligence problems.