devolve



class  BaseNode(T);

Genome used with the TreeGA. 'T' must be the type of the parameters and return values from the functions composing the tree.


const T  eval();

Evaluate the node by calling the wrapped function with  eval of each child


const uint  getNumChildren();

Get the number of children


const string  toString();




BaseNode!T  getChild(uint index);

Get the child at index by reference


const const(BaseNode!T)  getChild(uint index);

Get the child at index by const reference


void  setChild(BaseNode!T node, uint index);

Set the child at index to node


void  setChildren(BaseNode!T[] children);

Set the children. The length of children should equal getNumChildren()


const uint  getHeight();

Get the maximum number of nodes from this node to a leaf.


const BaseNode!T  clone(bool = false);

Get a deep copy of this node


string  name;




struct  TreeGenerator(T);

Generator used to create new trees for the population. A generator will also be passed to the mutator and crossover functions of the GA.


const auto  opCall(uint height);

Create a new Tree with a height of height


void  register(A)(A func, string name) if (is(ReturnType!A == T) && EraseAll!(T, staticMap!(Unqual, ParameterTypeTuple!A)).length == 0);

Register a function which cannot be known at compile time


void  register(alias func)(string name);

Register a compile time known function


void  registerConstant(T constant)();

Register a constant value (this will strip the '()' when printing the tree)


void  registerConstantRange(A)(A lower, A upper);

Register constants in the range [lower, upper).


void  registerInput(alias input)();

Register an input to the grown algorithm.

Examples
   int x;
   TreeGenerator!int gen;

   //Same effect as 'register!( () {return x;})("x");
   gen.registerInput!x;

const BaseNode!T  getRandomTree(uint height);

Create a random tree with height of exactly height


const auto  getRandomNode();

Create a random node

WARNING:
It is not safe to 'eval' this note immediately

const auto  getRandomTerminator();

Create a random terminator from the set of registered terminators

NOTE:
This set includes any registered function with 0 parameters, constants, and inputs