ECF 1.5
|
Primitive set class: collects all Tree Primitives. More...
#include <PrimitiveSet.h>
Public Member Functions | |
bool | initialize (StateP state) |
bool | addFunction (std::string name) |
Add a function primitive to the set of active primitives - if found by name in collection of all primitives. If a function takes 0 arguments, it is added to the terminal set. More... | |
void | addTerminal (PrimitiveP terminalPrimitive) |
Add a terminal primitive to the set of active primitives. More... | |
PrimitiveP | getRandomTerminal () |
Get random terminal from the set of active terminals. More... | |
PrimitiveP | getRandomFunction () |
Get random function from the set of active functions. More... | |
PrimitiveP | getRandomPrimitive () |
Get random primitive (function or terminal) from the set of active primitives. More... | |
PrimitiveP | getTerminalByName (std::string name) |
Access terminal by name (active terminals only). More... | |
PrimitiveP | getFunctionByName (std::string name) |
Access function by name (active functions only). More... | |
PrimitiveP | getPrimitiveByName (std::string name) |
Access primitive by name (active functions or terminals only). More... | |
uint | getFunctionSetSize () |
Get the number of active functions. More... | |
uint | getTerminalSetSize () |
Get the number of active terminals. More... | |
uint | getPrimitivesSize () |
Get the number of active primitives (functions and terminals). More... | |
Public Attributes | |
std::map< std::string, PrimitiveP > | mAllPrimitives_ |
map of all registered primitive functions More... | |
std::map< std::string, Primitives::terminal_type > | mTypeNames_ |
Protected Attributes | |
StateP | state_ |
std::vector< PrimitiveP > | terminalSet_ |
vector of active (actual used) terminals More... | |
std::map< std::string, PrimitiveP > | mTerminalSet_ |
map of active (actual used) terminals More... | |
std::vector< PrimitiveP > | functionSet_ |
vector of active (actual used) functions More... | |
std::map< std::string, PrimitiveP > | mFunctionSet_ |
map of active (actual used) functions More... | |
std::vector< PrimitiveP > | primitives_ |
vector of active (actual used) primitives More... | |
std::map< std::string, PrimitiveP > | mPrimitiveSet_ |
map of active (actual used) primitives More... | |
Friends | |
class | Tree |
Primitive set class: collects all Tree Primitives.
Each Tree genotype (if there are more Trees in the Individual) has a unique PrimitiveSet. Each unique instance is linked to the appropriate Tree object in State (the 'hometree' variable name).
Definition at line 17 of file PrimitiveSet.h.
Tree::PrimitiveSet::PrimitiveSet | ( | ) |
Definition at line 8 of file PrimitiveSet.cpp.
|
virtual |
Definition at line 12 of file PrimitiveSet.cpp.
bool Tree::PrimitiveSet::addFunction | ( | std::string | name | ) |
Add a function primitive to the set of active primitives - if found by name in collection of all primitives. If a function takes 0 arguments, it is added to the terminal set.
Definition at line 131 of file PrimitiveSet.cpp.
void Tree::PrimitiveSet::addTerminal | ( | PrimitiveP | terminalPrimitive | ) |
Add a terminal primitive to the set of active primitives.
Definition at line 156 of file PrimitiveSet.cpp.
PrimitiveP Tree::PrimitiveSet::getFunctionByName | ( | std::string | name | ) |
Access function by name (active functions only).
Definition at line 79 of file PrimitiveSet.cpp.
uint Tree::PrimitiveSet::getFunctionSetSize | ( | ) |
Get the number of active functions.
Definition at line 167 of file PrimitiveSet.cpp.
PrimitiveP Tree::PrimitiveSet::getPrimitiveByName | ( | std::string | name | ) |
Access primitive by name (active functions or terminals only).
Definition at line 101 of file PrimitiveSet.cpp.
uint Tree::PrimitiveSet::getPrimitivesSize | ( | ) |
Get the number of active primitives (functions and terminals).
Definition at line 181 of file PrimitiveSet.cpp.
PrimitiveP Tree::PrimitiveSet::getRandomFunction | ( | ) |
Get random function from the set of active functions.
Definition at line 58 of file PrimitiveSet.cpp.
PrimitiveP Tree::PrimitiveSet::getRandomPrimitive | ( | ) |
Get random primitive (function or terminal) from the set of active primitives.
Definition at line 72 of file PrimitiveSet.cpp.
PrimitiveP Tree::PrimitiveSet::getRandomTerminal | ( | ) |
Get random terminal from the set of active terminals.
Definition at line 65 of file PrimitiveSet.cpp.
PrimitiveP Tree::PrimitiveSet::getTerminalByName | ( | std::string | name | ) |
Access terminal by name (active terminals only).
Definition at line 90 of file PrimitiveSet.cpp.
uint Tree::PrimitiveSet::getTerminalSetSize | ( | ) |
Get the number of active terminals.
Definition at line 174 of file PrimitiveSet.cpp.
bool Tree::PrimitiveSet::initialize | ( | StateP | state | ) |
Definition at line 16 of file PrimitiveSet.cpp.
|
friend |
Definition at line 19 of file PrimitiveSet.h.
|
protected |
vector of active (actual used) functions
Definition at line 50 of file PrimitiveSet.h.
std::map<std::string, PrimitiveP> Tree::PrimitiveSet::mAllPrimitives_ |
map of all registered primitive functions
Definition at line 42 of file PrimitiveSet.h.
|
protected |
map of active (actual used) functions
Definition at line 51 of file PrimitiveSet.h.
|
protected |
map of active (actual used) primitives
Definition at line 53 of file PrimitiveSet.h.
|
protected |
map of active (actual used) terminals
Definition at line 49 of file PrimitiveSet.h.
std::map<std::string, Primitives::terminal_type> Tree::PrimitiveSet::mTypeNames_ |
Definition at line 43 of file PrimitiveSet.h.
|
protected |
vector of active (actual used) primitives
Definition at line 52 of file PrimitiveSet.h.
|
protected |
Definition at line 46 of file PrimitiveSet.h.
|
protected |
vector of active (actual used) terminals
Definition at line 48 of file PrimitiveSet.h.