Trait jeepers::tree::Tree
[−]
[src]
pub trait Tree where Self: Sized { const TERMINAL_PROPORTION: f32; fn rand_terminal<R: Rng>(tg: &mut TreeGen<R>, current_depth: usize) -> Self; fn rand_nonterminal<R: Rng>(tg: &mut TreeGen<R>,
current_depth: usize)
-> Self; fn rand_tree<R: Rng>(tg: &mut TreeGen<R>) -> Self { ... } fn rand_node<R: Rng>(tg: &mut TreeGen<R>, current_depth: usize) -> Self { ... } }
The Tree trait will be implemented by the trees of all Genetic Programs.
Generally only rand_terminal
and rand_nonterminal
will need redefining
as other methods have default implementations.
Associated Constants
const TERMINAL_PROPORTION: f32
What proportion of possible tree nodes are terminals? 0.0 to 1.0.
Required Methods
fn rand_terminal<R: Rng>(tg: &mut TreeGen<R>, current_depth: usize) -> Self
Generate a Terminal node (a leaf) to go into a tree.
fn rand_nonterminal<R: Rng>(tg: &mut TreeGen<R>, current_depth: usize) -> Self
Generate a Non-Terminal node to go into a tree.
Provided Methods
fn rand_tree<R: Rng>(tg: &mut TreeGen<R>) -> Self
Generate a new tree within the bounds specified by TreeGen.
fn rand_node<R: Rng>(tg: &mut TreeGen<R>, current_depth: usize) -> Self
Generate a random new node to go into a tree.