Tree specifically formatted for optimization of genetic programming operations. The tree is represented with a list where the nodes are appended in a depth-first order. The nodes appended to the tree are required to have an attribute arity which defines the arity of the primitive. An arity of 0 is expected from terminals nodes.
Class that encapsulates a primitive and when called with arguments it returns the Python code to call the primitive with the arguments.
Class that encapsulates terminal primitive in expression. Terminals can be values or 0-arity functions.
Class that encapsulates a terminal which value is set when the object is created. To mutate the value, a new object has to be generated. This is an abstract base class. When subclassing, a staticmethod 'func' must be defined.
Class that contains the primitives that can be used to solve a Strongly Typed GP problem. The set also defined the researched function return type, and input arguments type and number.
Class same as PrimitiveSetTyped_, except there is no definition of type.
Generate a Tree as a list of lists. The tree is built from the root to the leaves, and it stop growing when the condition is fulfilled.
Generate an expression where each leaf has a the same depth between min and max.
Generate an expression where each leaf might have a different depth between min and max.
Generate an expression with a PrimitiveSet pset.
Half the time, the expression is generated with :func:~deap.gp.genGrow
,
the other half, the expression is generated with :func:~deap.gp.genFull
.
Randomly select in each individual and exchange each subtree with the point as root between each individual.
Randomly select a crossover point in each individual and exchange each subtree between each individual.
The parameter termpb sets the probability to choose between a terminal or non-terminal crossover point. For instance, as defined by Koza, non- terminal primitives are selected for 90% of the crossover points, and terminals for 10%, so termpb should be set to 0.1.
Randomly select a point in the tree, then replace the subtree at that point as a root by the expression generated by the given function
Replaces a randomly chosen primitive from individual by a randomly
chosen primitive with the same number of arguments from the :attr:pset
attribute of the individual.
This operator works on the constants of the tree individual. In
mode "one"
, it will change the value of one of the individual
ephemeral constants by calling its generator function. In mode
"all"
, it will change the value of all the ephemeral constants.
Inserts a new branch at a random position in individual. The subtree at the chosen position is used as child node of the created subtree, in that way, it is really an insertion rather than a replacement. Note that the original subtree will become one of the children of the new primitive inserted, but not perforce the first (its position is randomly selected if the new primitive has more than one child).
This operator shrinks the individual by chosing randomly a branch and replacing it with one of the branch's arguments (also randomly chosen).
Compile an expression. It can either be a PrimitiveTree, a string of Python code or any object that when converted into string produced a valid Python code expression.
Compile the expression represented by a list of trees. The first element of the list is the main tree, and the following elements are automatically defined functions (ADF) that can be called by the first tree.
This algorithm reproduces the simplest evolutionary algorithm as presented in chapter 7 of [Back2000]_. The algorithm takes in a population and evolves it in place using the both mutation and crossover.
This is the (\mu + \lambda)
evolutionary algorithm.
This variation is named Plus because of its propention to apply both
crossover and mutation on the individuals. Note that both operators are
not applied systematically, the resulting individuals can be generated from
crossover only, mutation only, crossover and mutation, and reproduction
according to the given probabilities. Both probabilities should be in
:math:[0, 1]
.
This is the (\mu~,~\lambda)
evolutionary algorithm.
This variation will never result from both operations crossover and mutation.
The sum of both probabilities shall be in :math:[0, 1]
, the reproduction probability is
1 - cxpb - mutpb.
This is algorithm implements the ask-tell model proposed in
[Colette2010]_, where ask is called generate
and tell is called update
.
The algorithm generates the individuals using the toolbox.generate
function and updates the generation method with the toolbox.update
function.