Trait evco::gp::tree::Tree [] [src]

pub trait Tree where Self: Sized + Debug + Clone {
    type Environment;
    type Action;
    fn branch<R: Rng>(tg: &mut TreeGen<R>,
                      current_depth: usize)
                      -> BoxTree<Self>; fn leaf<R: Rng>(tg: &mut TreeGen<R>, current_depth: usize) -> BoxTree<Self>; fn count_children(&mut self) -> usize; fn children(&self) -> Vec<&BoxTree<Self>>; fn children_mut(&mut self) -> Vec<&mut BoxTree<Self>>; fn evaluate(&self, env: &Self::Environment) -> Self::Action; fn tree<R: Rng>(tg: &mut TreeGen<R>) -> BoxTree<Self> { ... } fn child<R: Rng>(tg: &mut TreeGen<R>, current_depth: usize) -> BoxTree<Self> { ... } }

Trait to be implemented by Genetic Programs trees.

Associated Types

Type of input when evaluating the tree.

The type the tree will evaluate to.

Required Methods

Generate a branch node (a node with at least one Tree child).

Generate a leaf node (a node without any Tree children).

Count Self children of this node.

Get children of this node.

Get mutable children of this node.

Get indexed child of this node. Number children from 0; suggested to go left-to-right. Used to evaluate the root node of a tree.

Provided Methods

Generate a new tree within the bounds specified by TreeGen.

Generate a random new node to go into a tree.

Implementors