alogos.systems.cfggp.mutation
¶
Mutation functions for CFG-GP.
Functions¶
|
Change a randomly chosen node by attaching a randomly generated subtree. |
Detailed object descriptions¶
- alogos.systems.cfggp.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_depth
(int
) : Maximum tree depth.
- Returns:
genotype (
Genotype
) – Mutated genotype.
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.”