geneticengine.representations.tree.initializations
Attributes
Classes
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
MaxDecider will generate random trees up to a maximum depth. |
|
FullDecider will always preffer non-terminal productions within a |
|
PositionIndependentGrowDecider will always randomly expand one path of |
|
Decides whether to restrict to non-recursive symbols based on the |
Functions
|
|
|
|
|
Module Contents
- class geneticengine.representations.tree.initializations.GlobalSynthesisContext
-
- decider: SynthesisDecider
- geneticengine.representations.tree.initializations.T
- class geneticengine.representations.tree.initializations.SynthesisDecider
Bases:
abc.ABCHelper class that provides a standard way to create an ABC using inheritance.
- abstractmethod random_int(min_int=-sys.maxsize, max_int=sys.maxsize)
- Return type:
int
- abstractmethod random_float()
- Return type:
float
- abstractmethod random_str()
- Return type:
str
- abstractmethod random_bool()
- Return type:
bool
- abstractmethod choose_production_alternatives(ty, alternatives, ctx)
- Parameters:
ty (type)
alternatives (list[type])
- Return type:
type
- abstractmethod choose_options(alternatives, ctx)
- Parameters:
alternatives (list[T])
- Return type:
T
- class geneticengine.representations.tree.initializations.BaseDecider(random, grammar)
Bases:
SynthesisDeciderHelper class that provides a standard way to create an ABC using inheritance.
- Parameters:
grammar (geneticengine.grammar.grammar.Grammar)
- random
- grammar
- random_int(min_int=-sys.maxsize - 1, max_int=sys.maxsize)
- Return type:
int
- random_float()
- Return type:
float
- random_str()
- Return type:
str
- random_bool()
- Return type:
bool
- choose_options(alternatives, ctx)
- Parameters:
alternatives (list[T])
- Return type:
T
- class geneticengine.representations.tree.initializations.MaxDepthDecider(random, grammar, max_depth=10)
Bases:
BaseDeciderMaxDecider will generate random trees up to a maximum depth.
- Parameters:
grammar (geneticengine.grammar.grammar.Grammar)
max_depth (int)
- max_depth = 10
- choose_production_alternatives(ty, alternatives, ctx)
- Parameters:
ty (type)
alternatives (list[type])
- Return type:
type
- validate()
- Return type:
None
- class geneticengine.representations.tree.initializations.FullDecider(random, grammar, max_depth=10)
Bases:
MaxDepthDeciderFullDecider will always preffer non-terminal productions within a maximum depth.
- Parameters:
grammar (geneticengine.grammar.grammar.Grammar)
max_depth (int)
- choose_production_alternatives(ty, alternatives, ctx)
- Parameters:
ty (type)
alternatives (list[type])
- Return type:
type
- class geneticengine.representations.tree.initializations.PositionIndependentGrowDecider(random, grammar, max_depth=10)
Bases:
MaxDepthDeciderPositionIndependentGrowDecider will always randomly expand one path of the tree to get to the max depth, and others randomly.
- Parameters:
grammar (geneticengine.grammar.grammar.Grammar)
max_depth (int)
- expanding = True
- choose_production_alternatives(ty, alternatives, ctx)
- Parameters:
ty (type)
alternatives (list[type])
- Return type:
type
- class geneticengine.representations.tree.initializations.ProgressivelyTerminalDecider(random, grammar)
Bases:
BaseDeciderDecides whether to restrict to non-recursive symbols based on the current depth, probabilistically.
- Parameters:
grammar (geneticengine.grammar.grammar.Grammar)
- choose_production_alternatives(ty, alternatives, ctx)
- Parameters:
ty (type)
alternatives (list[type])
- Return type:
type
- geneticengine.representations.tree.initializations.wrap_result(v, global_context, context)
- Parameters:
v (Any)
global_context (GlobalSynthesisContext)
context (geneticengine.solutions.tree.LocalSynthesisContext)
- Return type:
- geneticengine.representations.tree.initializations.apply_constructor(ty, args)
- Parameters:
ty (Type)
args (list[Any])
- geneticengine.representations.tree.initializations.number_of_nodes(v)
- Parameters:
- geneticengine.representations.tree.initializations.create_node(global_context, starting_symbol, context, dependent_values=None, parent_values=None, initial_values=None)
- Parameters:
global_context (GlobalSynthesisContext)
starting_symbol (type[Any])
context (geneticengine.solutions.tree.LocalSynthesisContext)
dependent_values (dict[str, Any] | None)
parent_values (list[dict[str, Any]] | None)
initial_values (dict[str, geneticengine.solutions.tree.TreeNode] | None)
- Return type:
Any