geneticengine.representations.tree.initializations

Module Contents

Functions

apply_metahandler(r, g, receiver, new_symbol, depth, ...)

This method applies a metahandler to use a custom generator for things

grow_method(r, g, depth[, starting_symbol])

Implements the standard Grow tree-initialization method, where trees are

full_method(r, g, depth[, starting_symbol])

Full tree-initialization method.

pi_grow_method(r, g, depth[, starting_symbol])

PI Grow tree-initialization method.

random_list(r, receiver, new_symbol, depth, ty, ctx[, ...])

expand_node(r, g, new_symbol, filter_choices, ...)

Creates a random node of a given type (starting_symbol).

mk_save_init(starting_symbol, receiver)

Saves a child as a member of the parent node.

Attributes

InitializationMethodType

T

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:
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:
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:
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:
geneticengine.representations.tree.initializations.T
geneticengine.representations.tree.initializations.random_list(r, receiver, new_symbol, depth, ty, ctx, prod='')
Parameters:
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:
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)