ECF 1.5
|
Ephemereal random constant (ERC) node class (Tree genotype). More...
#include <Terminal.h>
Public Member Functions | |
bool | initialize (StateP state) |
Initialize ERC value(s). More... | |
void | execute (void *result, Tree &tree) |
Execute the primitive. More... | |
void | setValue (void *value) |
Set terminal's value. More... | |
void | getValue (void *value) |
Get terminal's value. More... | |
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). More... | |
PrimitiveP | assignToNode (PrimitiveP primitive) |
Create (or choose) new unique ERC value and assign to tree node. More... | |
Public Member Functions inherited from Tree::Primitives::Primitive | |
virtual void | execute (void *result, Tree &tree)=0 |
Execute the primitive. More... | |
virtual bool | initialize (StateP state) |
Initialize the primitive (default just sets the StateP pointer). More... | |
virtual void | setValue (void *value) |
virtual void | getValue (void *value) |
virtual PrimitiveP | copyWithNode (PrimitiveP) |
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). More... | |
virtual PrimitiveP | assignToNode (PrimitiveP) |
Assign primitive to node (when building a tree). The default behaviour just returns the same pointer (common primitives). ERC's should override and generate a new object with a new value. More... | |
void | getNextArgument (void *result, Tree &tree) |
Execute next child node's primitive (execute next subtree). More... | |
void | skipNextArgument (Tree &tree) |
Skip next child subtree (doesn't execute the subtree). More... | |
int | getNumberOfArguments () |
Return primitive's number of arguments. More... | |
void | setName (std::string name) |
Set primitive's name. More... | |
std::string | getName () |
Get primitive's name. More... | |
std::string | getComplementName () |
Get complement's name. More... | |
Public Attributes | |
std::string | baseName_ |
T | value_ |
Public Attributes inherited from Tree::Primitives::Primitive | |
StateP | state_ |
Protected Attributes | |
std::vector< T > * | values_ |
Protected Attributes inherited from Tree::Primitives::Primitive | |
std::string | name_ |
int | nArguments_ |
std::string | complementName_ |
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.
|
inline |
Definition at line 91 of file Terminal.h.
|
inlinevirtual |
Create (or choose) new unique ERC value and assign to tree node.
pointer | to destination |
Reimplemented from Tree::Primitives::Primitive.
Definition at line 161 of file Terminal.h.
|
inlinevirtual |
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).
sptr | to this primitive |
Reimplemented from Tree::Primitives::Primitive.
Definition at line 152 of file Terminal.h.
|
inlinevirtual |
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.
|
inlinevirtual |
Get terminal's value.
pointer | to destination |
Reimplemented from Tree::Primitives::Primitive.
Definition at line 146 of file Terminal.h.
|
inlinevirtual |
Initialize ERC value(s).
Read given values from config and store in vector.
Reimplemented from Tree::Primitives::Primitive.
Definition at line 104 of file Terminal.h.
|
inlinevirtual |
Set terminal's value.
value | pointer to new value |
Reimplemented from Tree::Primitives::Primitive.
Definition at line 136 of file Terminal.h.
std::string Tree::Primitives::ERC< T >::baseName_ |
Definition at line 88 of file Terminal.h.
T Tree::Primitives::ERC< T >::value_ |
Definition at line 89 of file Terminal.h.
|
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.