The standard GP algorithm takes five inputs.
- a set of terminal functions, T
- a set of non-terminal functions, NT
- a set of control parameters P
- a fitness funtion, f(x)
- a termination criterion t
Contained in the set of control parameters are
- n - the initial number of S-expressions
- Di - the initial maximum depth of nesting of an S-Expression
- Pr - probability of reproduction of a fit individual
- Pc - probablility of recombination of a fit individual
- Pm - probabiliy of mutation of a fit indivudual
- Dc - maximum depth of nesting of an S-Expression during a run
The standard algorithm runs a follows
- (setf *generation-count* 0)
- (setf *current-population* (random-experssions :count n :nesting Di :terminals T :non-terminals TF))
- (set *current-fitness* (loop for individial in *current-population* collect (fitness individual))
- Filter the current population by fitness, producing a new individual by a randomly chosen method.
- (setf *current-population* *new-population*)
- (until t)
Fitness is usually measured by standardzed fitness where the fittest indvidiual has a fitness of zero. Reproduction is a asexual copy, mutation is asxual copying with reandom errors, and crosover is splicing together two infvidials from one half of each individial, the splice point being arbitarily chosen. It is important that the union of T and NT (called C) is sufficent to solve the target problem, and that all the functions accept and return arguments of the same type.