alogos.systems.cfggpst.mutation
¶
Mutation functions for CFG-GP-ST.
Functions¶
|
Change a randomly chosen node by attaching a randomly generated subtree. |
Detailed object descriptions¶
- alogos.systems.cfggpst.mutation.subtree_replacement(grammar, genotype, parameters=None)[source]¶
Change a randomly chosen node by attaching a randomly generated subtree.
- Parameters:
grammar (
Grammar
)genotype (
Genotype
)parameters (
dict
orParameterCollection
, optional) – Following keyword-value pairs are considered by this function:max_nodes
(int
) : Maximum number of nodes in a tree.
- Returns:
genotype (
Genotype
) – Mutated genotype.
Notes
The limiation of the tree size via
max_nodes
is only a soft constraint, because the tree branches are grown randomly and independently from each other. To finish each branch it can be necessary to go beyond the node limit, because it is checked when opening a branch, but only considering existing nodes and not all nodes still required for each other unfinished branch. It is possible to make it a hard constraint, but would require more computation and memory, as well as likely not improving the sampling of the search space.References
Grammatically-based Genetic Programming (1995)
“Mutation applies to a single program. A program is selected for mutation, and one non-terminal is randomly selected as the site for mutation. The tree below this non-terminal is deleted, and a new tree randomly generated from the grammar using this non-terminal as a starting point. The tree is limited in total depth by the current maximum allowable program depth (MAX-TREE-DEPTH), in an operation similar to creating the initial population.”