geneticengine.representations.tree.treebased ============================================ .. py:module:: geneticengine.representations.tree.treebased Attributes ---------- .. autoapisummary:: geneticengine.representations.tree.treebased.T Classes ------- .. autoapisummary:: geneticengine.representations.tree.treebased.TreeBasedRepresentation Functions --------- .. autoapisummary:: geneticengine.representations.tree.treebased.random_node geneticengine.representations.tree.treebased.random_tree geneticengine.representations.tree.treebased.get_weighted_nodes geneticengine.representations.tree.treebased.find_in_tree geneticengine.representations.tree.treebased.mutate geneticengine.representations.tree.treebased.tree_mutate geneticengine.representations.tree.treebased.tree_crossover Module Contents --------------- .. py:data:: T .. py:function:: random_node(random, grammar, starting_symbol, decider) .. py:function:: random_tree(random, grammar, decider) .. py:function:: get_weighted_nodes(e) .. py:function:: find_in_tree(ty, o) .. py:function:: mutate(global_context, i, ty, dependent_values = None, source_material = None) Generates all nodes that can be mutable in a program. .. py:function:: tree_mutate(r, g, i, target_type, decider) .. py:function:: tree_crossover(r, g, p1, p2, decider) Given the two input trees [p1] and [p2], the grammar and the random source, this function returns two trees that are created by crossing over. [p1] and [p2]. The first tree returned has [p1] as the base, and the second tree has [p2] as a base. .. py:class:: TreeBasedRepresentation(grammar, decider) Bases: :py:obj:`geneticengine.representations.api.Representation`\ [\ :py:obj:`geneticengine.solutions.tree.TreeNode`\ , :py:obj:`geneticengine.solutions.tree.TreeNode`\ ], :py:obj:`geneticengine.representations.api.RepresentationWithMutation`\ [\ :py:obj:`geneticengine.solutions.tree.TreeNode`\ ], :py:obj:`geneticengine.representations.api.RepresentationWithCrossover`\ [\ :py:obj:`geneticengine.solutions.tree.TreeNode`\ ] This class represents the tree representation of an individual. In this approach, the genotype and the phenotype are exactly the same. .. py:attribute:: grammar .. py:attribute:: decider .. py:method:: create_genotype(random, **kwargs) .. py:method:: genotype_to_phenotype(genotype) .. py:method:: mutate(random, genotype, **kwargs) .. py:method:: crossover(random, parent1, parent2, **kwargs)