VARS

boost-hard

full-population

ninety-ten-crossover

ninety-ten-sl-crossover

ramped-half-and-half-population

random-full-tree

random-grow-tree

random-tree-mutation

simple-crossover

simple-mutation

size-limited-crossover

trim-hard

trim-soft

twiddle-constant

twiddle-constants

boost-hard

full-population

ninety-ten-crossover

ninety-ten-sl-crossover

ramped-half-and-half-population

random-full-tree

random-grow-tree

random-tree-mutation

simple-crossover

simple-mutation

size-limited-crossover

trim-hard

trim-soft

twiddle-constant

twiddle-constants

« Index of all namespaces of this project

Core genetic operation on expressions. Includes functions for creating expressions.

`(boost-hard min-size generator expr)`

Takes an expresion and a min-size, and if it's undersize replaces it an expression generated by calling the given generator.

`(full-population functions terminals n max-depth)`

Make an intial population of nfullexpressions, with depths up to and including max-depth.

`(ninety-ten-crossover expr1 expr2)`

Randomly selects a crossover point in each of the two given trees, and switches the subtrees at these points. Following Koza, The crossover points are selected from the terminal and function nodes with probability 0.10 and 0.90 respectively.

`(ninety-ten-sl-crossover max-size expr1 expr2)`

A helper for making a size-limited 90:10 crossover, which you'll probably want to use.

`(ramped-half-and-half-population functions terminals n max-depth)`

Koza's 'ramped half-and-half' tree generation algorithm. Half of the trees are made withgrowand half withfull, the depths range over 2 to the max depth, distributed uniformly.

`(random-full-tree functions terminals depth)`

Generates a tree filled to the given depth from the given functions and terminals. The tree is full in the sense that all of the nodes at depths less than the max depth are functions. That is, every terminal is at the max-depth. The functions and terminals should be supplied in the format shown in algebolic.core.

`(random-grow-tree functions terminals depth)`

Generates a tree with given maximum depth from the given functions and terminals. The nodes will be chosen uniformly from the set of functions and terminals. The functions and terminals should be supplied in the format shown in algebolic.core.

`(random-tree-mutation functions terminals depth expr)`

Replaces part of the given expression with a random tree, generated from the given functions and terminals, with the given depth

`(simple-crossover expr1 expr2)`

Randomly selects a crossover point in each of the two given trees, and switches the subtrees at these points. The crossover points are selected from the terminal and function nodes with uniform probability.

`(simple-mutation new-tree-func expr)`

Replaces a randomly selected part of the expression with a new tree generated by calling the given function. The subtree to be replaced is selected from the nodes (terminal and function) with uniform probability.

`(size-limited-crossover max-size crossover-func expr1 expr2)`

Takes a crossover operation and makes a size-limited version of it. If a product is larger than the size limit then it is replaced with the corresponding parent. Note that this will result in expressions over the size limit being locked out of crossover. So long as there is some mutation in the system that can reduce the size, then this should not be a problem.

`(trim-hard max-size expr)`

Takes an expresion and a max-size, and trims the expression if it is too big. The trimming is done by returning a randomly selected sub-expression, which is guaranteed to be smaller than the size limit.

`(trim-soft max-size expr)`

Takes an expresion and a max-size, and trims the expression if it is too big. The trimming is done by returning a randomly selected sub-expression. There is no guarantee that this sub-expression is smaller than the size limit, or indeed smaller than the original expression. But if applied each generation it will tend to keep the population size under control.

Private

`(twiddle-constant const)`

Takes a constant and returns a slightly different constant. Adds uniform noise to the constant with spread +-0.05 of the constant's value.