geneticengine.representations.tree.initializations
Module Contents
Functions
|
This method applies a metahandler to use a custom generator for things |
|
Implements the standard Grow tree-initialization method, where trees are |
|
Full tree-initialization method. |
|
PI Grow tree-initialization method. |
|
|
|
Creates a random node of a given type (starting_symbol). |
|
Saves a child as a member of the parent node. |
Attributes
- geneticengine.representations.tree.initializations.apply_metahandler(r, g, receiver, new_symbol, depth, ty, context)
This method applies a metahandler to use a custom generator for things of a given type.
As an example, AnnotatedType[int, IntRange(3,10)] will use the IntRange.generate(r, recursive_generator). The generator is the annotation on the type (“__metadata__”).
- Parameters:
depth (int)
ty (type[Any])
context (dict[str, str])
- Return type:
Any
- geneticengine.representations.tree.initializations.InitializationMethodType
- geneticengine.representations.tree.initializations.grow_method(r, g, depth, starting_symbol=int)
Implements the standard Grow tree-initialization method, where trees are naturally grown from the grammar.
- Parameters:
depth (int)
starting_symbol (type[Any])
- geneticengine.representations.tree.initializations.full_method(r, g, depth, starting_symbol=int)
Full tree-initialization method.
Trees are grown from the grammar with all branches as deep as possible, making full trees.
- Parameters:
depth (int)
starting_symbol (type[Any])
- geneticengine.representations.tree.initializations.pi_grow_method(r, g, depth, starting_symbol=int)
PI Grow tree-initialization method.
(http://ncra.ucd.ie/papers/Exploring%20Position%20Independent%20Initialisation%20in%20Grammatical.%20Evolution.pdf), where trees are grown to have at least one branchas deep as possible.
- Parameters:
depth (int)
starting_symbol (type[Any])
- geneticengine.representations.tree.initializations.T
- geneticengine.representations.tree.initializations.random_list(r, receiver, new_symbol, depth, ty, ctx, prod='')
- Parameters:
depth (int)
ty (type[list[T]])
ctx (dict[str, str])
prod (str)
- geneticengine.representations.tree.initializations.expand_node(r, g, new_symbol, filter_choices, receiver, depth, starting_symbol, id, ctx)
Creates a random node of a given type (starting_symbol).
- Parameters:
starting_symbol (type)
id (str)
ctx (dict[str, str])
- Return type:
Any
- geneticengine.representations.tree.initializations.mk_save_init(starting_symbol, receiver)
Saves a child as a member of the parent node.
- Parameters:
starting_symbol (Any)
receiver (Callable)