mini-gp is a small genetic programming library, no longer under active development by its original author. It is used here under the terms of the MIT Licence.

A number of changes and additions have been made to mini-gp to better support the GEMS environment. These changes include:

  • use of logging functions

  • an extras field, to report more detailed information through the logger

Structures

The GP system uses a structure, individual, to store information in. The package exports the following functions to work with this structure:

next make-individual - creates an individual

next individual-p - returns t if given item is an instance of individual

next individual-fitness - accesses the overall fitness

next individual-tree - accesses the program

next individual-extras - accesses the "extras" field, an addition made for GEMS

Functions

The GP system is called through the following function:

next (launch operator-set fitness-function &key …​)

  • operator-set - list of (operator-name . num-children) pairs:

    • operator-name is the name of an operator (function or terminal), such as respond-left or if

    • num-children is the number of child nodes that operator has, such as 0 for respond-left or 3 for if

  • fitness-function - a function accepting a gp:individual and returning two values: fitness score, and optional extra information

and the following key parameters:

(total-generations 10)

maximum number of generations to run

(population-size 10)

size of population

(initial-depth 2)

size of generated program tree

(maximum-depth 5)

size of generated program tree

(t-size 3)

number of individuals to select from when doing a tournament selection

(crossover-rate 0.9)

rate of cross-over

(mutation-rate 0.05)

rate of mutation

(elitism t)

whether to preserve best models in next generation

(type :generational)

either :generational or :steady-state, the type of population update

(logger nil)

an optional logger function, as defined in gems-logger

Warning There is no distinction made between the function and terminal set. Internally, mini-gp treats all functions with 0 children as terminals.

next (set-initial-population LIST)

Use this function to set members of the initial population used by the GP system. This function must be passed a list of gp:individual instances.

The initial population for a run of the GP system is created by using this list first. If the list is larger than the required size of the population, then only the required size of instances is taken. If the list is shorter than the required size, then the remainder of the population is constructed with random instances.