Public Member Functions | Public Attributes | Protected Attributes

Tree::Primitives::ERC< T > Class Template Reference
[TreeGenotypesTree Primitives]

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).
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, e.g. in crossover). The default behaviour just returns the same pointer (common primitives). (ERC's should override and make a new copy of the original 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 is a Primitive that represents a single value (of type double by default) that can assume values from the interval or from the set. Value of an ERC instance is defined once - when assigning to a node in a new tree. Only double-typed ERC instances may change value (with Gaussian mutation).

ERC's are distinguished from regular terminals by the prefix denoting their type, e.g.: D_3.14, I_5, B_true, C_a

Definition at line 85 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 161 of file Terminal.h.

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

Copy primitive (when copying a node, e.g. in crossover). The default behaviour just returns the same pointer (common primitives). (ERC's should override and make a new copy of the original object).

Parameters:
sptr to this primitive

Reimplemented from Tree::Primitives::Primitive.

Definition at line 152 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 125 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 146 of file Terminal.h.

template<class T>
bool Tree::Primitives::ERC< T >::initialize ( StateP  state  )  [inline, virtual]

Initialize ERC value(s).

Read given values from config and store in vector.

Reimplemented from Tree::Primitives::Primitive.

Reimplemented in Tree::Primitives::ERCD.

Definition at line 104 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 136 of file Terminal.h.


Member Data Documentation

template<class T>
std::vector<T>* Tree::Primitives::ERC< T >::values_ [protected]

Placeholder for predefined values that this type of ERC may assume. Each ERC instance holds only a single value.

Definition at line 177 of file Terminal.h.


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