For example, a simple fitness function might interpret the genes of an organism as the value of x in a complicated equation. The natural-selection process could then be tuned to prefer organisms that generate an output near zero, so that the survivors would eventually produce a solution to the equation. A complete genetic algorithm is too complex for a CS 70 assignment, but we can implement some of the core functions relatively easily. Mutation involves selecting a gene site and modifying it in some fashion, usually by replacing it with another gene. Mutation is very rare both in real life and in genetic algorithms.
Recombination is the most important process in generating new organisms.
Real genetic algorithms usually generate two children in this process, and may splice at more than one point, but we'll simplify things in our implementation. The final step, selection, will not be implemented in this assignment. As in real life, there is some randomness, so that a somewhat unfit organism has a chance of surviving even when a more fit one is discarded. Because we will not have time to implement an entire genetic algorithm, we will limit ourselves to the recombination and mutation functions. However, we will build them using a relatively general approach, so that the code we write could later be incorporated into a larger program.