Public Member Functions | Public Attributes | Protected Attributes

Tree::Primitives::ERC< T > Class Template Reference

Ephemereal random constant (ERC) node class (Tree genotype). More...

#include <Terminal.h>

Inheritance diagram for Tree::Primitives::ERC< T >:
Tree::Primitives::Primitive

List of all members.

Public Member Functions

bool initialize (StateP state)
 Initialize ERC value(s). Read given values from config and store in vector.
void execute (void *result, Tree &tree)
 Execute the primitive.
void setValue (void *value)
 Set terminal's value.
void getValue (void *value)
 Get terminal's value.
PrimitiveP copyWithNode (PrimitiveP primitive)
 Copy primitive (when copying a node). The default behaviour just returns the same pointer (common primitives). (ERC's should make a new object).
PrimitiveP assignToNode (PrimitiveP primitive)
 Create (or choose) new unique ERC value and assign to tree node.

Public Attributes

std::string baseName_
value_

Protected Attributes

std::vector< T > * values_

Detailed Description

template<class T>
class Tree::Primitives::ERC< T >

Ephemereal random constant (ERC) node class (Tree genotype).

ERC represents a single value (of type double by default) that can assume values from the interval or from the set. ERC's value is defined once - when assigning to a node in a new tree. Only double-typed ERC's may change value with Gaussian mutation.

Definition at line 80 of file Terminal.h.


Member Function Documentation

template<class T>
PrimitiveP Tree::Primitives::ERC< T >::assignToNode ( PrimitiveP  primitive  )  [inline, virtual]

Create (or choose) new unique ERC value and assign to tree node.

Parameters:
pointer to destination

Reimplemented from Tree::Primitives::Primitive.

Reimplemented in Tree::Primitives::ERCD.

Definition at line 155 of file Terminal.h.

template<class T>
PrimitiveP Tree::Primitives::ERC< T >::copyWithNode ( PrimitiveP  primitive  )  [inline, virtual]

Copy primitive (when copying a node). The default behaviour just returns the same pointer (common primitives). (ERC's should make a new object).

Parameters:
sptr to this primitive

Reimplemented from Tree::Primitives::Primitive.

Definition at line 146 of file Terminal.h.

template<class T>
void Tree::Primitives::ERC< T >::execute ( void *  result,
Tree tree 
) [inline, virtual]

Execute the primitive.

Function primitives gather arguments and return a value; terminal primitives return current value.

Implements Tree::Primitives::Primitive.

Definition at line 119 of file Terminal.h.

template<class T>
void Tree::Primitives::ERC< T >::getValue ( void *  value  )  [inline, virtual]

Get terminal's value.

Parameters:
pointer to destination

Reimplemented from Tree::Primitives::Primitive.

Definition at line 140 of file Terminal.h.

template<class T>
void Tree::Primitives::ERC< T >::setValue ( void *  value  )  [inline, virtual]

Set terminal's value.

Parameters:
value pointer to new value

Reimplemented from Tree::Primitives::Primitive.

Definition at line 130 of file Terminal.h.


The documentation for this class was generated from the following file: