geneticengine.representations.tree.initializations ================================================== .. py:module:: geneticengine.representations.tree.initializations Attributes ---------- .. autoapisummary:: geneticengine.representations.tree.initializations.T Classes ------- .. autoapisummary:: geneticengine.representations.tree.initializations.GlobalSynthesisContext geneticengine.representations.tree.initializations.SynthesisDecider geneticengine.representations.tree.initializations.BaseDecider geneticengine.representations.tree.initializations.MaxDepthDecider geneticengine.representations.tree.initializations.FullDecider geneticengine.representations.tree.initializations.PositionIndependentGrowDecider geneticengine.representations.tree.initializations.ProgressivelyTerminalDecider Functions --------- .. autoapisummary:: geneticengine.representations.tree.initializations.wrap_result geneticengine.representations.tree.initializations.apply_constructor geneticengine.representations.tree.initializations.number_of_nodes geneticengine.representations.tree.initializations.create_node Module Contents --------------- .. py:class:: GlobalSynthesisContext .. py:attribute:: random :type: geneticengine.random.sources.RandomSource .. py:attribute:: grammar :type: geneticengine.grammar.grammar.Grammar .. py:attribute:: decider :type: SynthesisDecider .. py:data:: T .. py:class:: SynthesisDecider Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:method:: random_int(min_int=-sys.maxsize, max_int=sys.maxsize) :abstractmethod: .. py:method:: random_float() :abstractmethod: .. py:method:: random_str() :abstractmethod: .. py:method:: random_bool() :abstractmethod: .. py:method:: choose_production_alternatives(ty, alternatives, ctx) :abstractmethod: .. py:method:: choose_options(alternatives, ctx) :abstractmethod: .. py:class:: BaseDecider(random, grammar) Bases: :py:obj:`SynthesisDecider` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: random .. py:attribute:: grammar .. py:method:: random_int(min_int=-(sys.maxsize - 1), max_int=sys.maxsize) .. py:method:: random_float() .. py:method:: random_str() .. py:method:: random_bool() .. py:method:: choose_options(alternatives, ctx) .. py:class:: MaxDepthDecider(random, grammar, max_depth = 10) Bases: :py:obj:`BaseDecider` MaxDecider will generate random trees up to a maximum depth. .. py:attribute:: max_depth :value: 10 .. py:method:: choose_production_alternatives(ty, alternatives, ctx) .. py:method:: validate() .. py:class:: FullDecider(random, grammar, max_depth = 10) Bases: :py:obj:`MaxDepthDecider` FullDecider will always preffer non-terminal productions within a maximum depth. .. py:method:: choose_production_alternatives(ty, alternatives, ctx) .. py:class:: PositionIndependentGrowDecider(random, grammar, max_depth = 10) Bases: :py:obj:`MaxDepthDecider` PositionIndependentGrowDecider will always randomly expand one path of the tree to get to the max depth, and others randomly. .. py:attribute:: expanding :value: True .. py:method:: choose_production_alternatives(ty, alternatives, ctx) .. py:class:: ProgressivelyTerminalDecider(random, grammar) Bases: :py:obj:`BaseDecider` Decides whether to restrict to non-recursive symbols based on the current depth, probabilistically. .. py:method:: choose_production_alternatives(ty, alternatives, ctx) .. py:function:: wrap_result(v, global_context, context) .. py:function:: apply_constructor(ty, args) .. py:function:: number_of_nodes(v) .. py:function:: create_node(global_context, starting_symbol, context, dependent_values = None, parent_values = None, initial_values = None)