ECF 1.7
Tree::PrimitiveSet Class Reference

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.
void addTerminal (PrimitiveP terminalPrimitive)
 Add a terminal primitive to the set of active primitives.
PrimitiveP getRandomTerminal ()
 Get random terminal from the set of active terminals.
PrimitiveP getRandomFunction ()
 Get random function from the set of active functions.
PrimitiveP getRandomPrimitive ()
 Get random primitive (function or terminal) from the set of active primitives.
PrimitiveP getTerminalByName (std::string name)
 Access terminal by name (active terminals only).
PrimitiveP getFunctionByName (std::string name)
 Access function by name (active functions only).
PrimitiveP getPrimitiveByName (std::string name)
 Access primitive by name (active functions or terminals only).
uint getFunctionSetSize ()
 Get the number of active functions.
uint getTerminalSetSize ()
 Get the number of active terminals.
uint getPrimitivesSize ()
 Get the number of active primitives (functions and terminals).

Public Attributes

std::map< std::string, PrimitiveP > mAllPrimitives_
 map of all registered primitive functions
std::map< std::string, Primitives::terminal_type > mTypeNames_
std::vector< PrimitiveP > terminalSet_
 vector of active (actual used) terminals
std::map< std::string, PrimitiveP > mTerminalSet_
 map of active (actual used) terminals
std::vector< PrimitiveP > functionSet_
 vector of active (actual used) functions
std::map< std::string, PrimitiveP > mFunctionSet_
 map of active (actual used) functions
std::vector< PrimitiveP > primitives_
 vector of active (actual used) primitives
std::map< std::string, PrimitiveP > mPrimitiveSet_
 map of active (actual used) primitives

Protected Attributes

StateP state_

Friends

class Tree

Detailed Description

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.

Constructor & Destructor Documentation

◆ PrimitiveSet()

Tree::PrimitiveSet::PrimitiveSet ( )

Definition at line 8 of file PrimitiveSet.cpp.

◆ ~PrimitiveSet()

Tree::PrimitiveSet::~PrimitiveSet ( )
virtual

Definition at line 12 of file PrimitiveSet.cpp.

Member Function Documentation

◆ addFunction()

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 137 of file PrimitiveSet.cpp.

◆ addTerminal()

void Tree::PrimitiveSet::addTerminal ( PrimitiveP terminalPrimitive)

Add a terminal primitive to the set of active primitives.

Definition at line 162 of file PrimitiveSet.cpp.

◆ getFunctionByName()

PrimitiveP Tree::PrimitiveSet::getFunctionByName ( std::string name)

Access function by name (active functions only).

Definition at line 85 of file PrimitiveSet.cpp.

◆ getFunctionSetSize()

uint Tree::PrimitiveSet::getFunctionSetSize ( )

Get the number of active functions.

Definition at line 173 of file PrimitiveSet.cpp.

◆ getPrimitiveByName()

PrimitiveP Tree::PrimitiveSet::getPrimitiveByName ( std::string name)

Access primitive by name (active functions or terminals only).

Definition at line 107 of file PrimitiveSet.cpp.

◆ getPrimitivesSize()

uint Tree::PrimitiveSet::getPrimitivesSize ( )

Get the number of active primitives (functions and terminals).

Definition at line 187 of file PrimitiveSet.cpp.

◆ getRandomFunction()

PrimitiveP Tree::PrimitiveSet::getRandomFunction ( )

Get random function from the set of active functions.

Definition at line 64 of file PrimitiveSet.cpp.

◆ getRandomPrimitive()

PrimitiveP Tree::PrimitiveSet::getRandomPrimitive ( )

Get random primitive (function or terminal) from the set of active primitives.

Definition at line 78 of file PrimitiveSet.cpp.

◆ getRandomTerminal()

PrimitiveP Tree::PrimitiveSet::getRandomTerminal ( )

Get random terminal from the set of active terminals.

Definition at line 71 of file PrimitiveSet.cpp.

◆ getTerminalByName()

PrimitiveP Tree::PrimitiveSet::getTerminalByName ( std::string name)

Access terminal by name (active terminals only).

Definition at line 96 of file PrimitiveSet.cpp.

◆ getTerminalSetSize()

uint Tree::PrimitiveSet::getTerminalSetSize ( )

Get the number of active terminals.

Definition at line 180 of file PrimitiveSet.cpp.

◆ initialize()

bool Tree::PrimitiveSet::initialize ( StateP state)

Definition at line 16 of file PrimitiveSet.cpp.

◆ Tree

friend class Tree
friend

Definition at line 19 of file PrimitiveSet.h.

Member Data Documentation

◆ functionSet_

std::vector<PrimitiveP> Tree::PrimitiveSet::functionSet_

vector of active (actual used) functions

Definition at line 47 of file PrimitiveSet.h.

◆ mAllPrimitives_

std::map<std::string, PrimitiveP> Tree::PrimitiveSet::mAllPrimitives_

map of all registered primitive functions

Definition at line 42 of file PrimitiveSet.h.

◆ mFunctionSet_

std::map<std::string, PrimitiveP> Tree::PrimitiveSet::mFunctionSet_

map of active (actual used) functions

Definition at line 48 of file PrimitiveSet.h.

◆ mPrimitiveSet_

std::map<std::string, PrimitiveP> Tree::PrimitiveSet::mPrimitiveSet_

map of active (actual used) primitives

Definition at line 50 of file PrimitiveSet.h.

◆ mTerminalSet_

std::map<std::string, PrimitiveP> Tree::PrimitiveSet::mTerminalSet_

map of active (actual used) terminals

Definition at line 46 of file PrimitiveSet.h.

◆ mTypeNames_

std::map<std::string, Primitives::terminal_type> Tree::PrimitiveSet::mTypeNames_

Definition at line 43 of file PrimitiveSet.h.

◆ primitives_

std::vector<PrimitiveP> Tree::PrimitiveSet::primitives_

vector of active (actual used) primitives

Definition at line 49 of file PrimitiveSet.h.

◆ state_

StateP Tree::PrimitiveSet::state_
protected

Definition at line 53 of file PrimitiveSet.h.

◆ terminalSet_

std::vector<PrimitiveP> Tree::PrimitiveSet::terminalSet_

vector of active (actual used) terminals

Definition at line 45 of file PrimitiveSet.h.


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