![]() |
ECF 1.7
|
#include <Cartesian_c.h>
Public Member Functions | |
| Cartesian (const Cartesian &other)=default | |
| bool | initialize (StateP state) |
| Cartesian * | copy () |
| std::vector< CrossoverOpP > | getCrossoverOp () |
| std::vector< MutationOpP > | getMutationOp () |
| void | registerParameters (StateP state) |
| void | read (XMLNode &xCart) |
| void | write (XMLNode &xCart) |
| uint | getGenomeSize () |
| void | buildRandomGenome () |
| void | evaluate (std::vector< double > &inputData, std::vector< double > &results) |
| uint | randomNodeInputConnection (uint column) |
| uint | randomOutputConnection () |
| void | getActiveFunctionNodes (std::vector< uint > &) |
| Cartesian (const Cartesian &other)=default | |
| bool | initialize (StateP state) |
| Cartesian * | copy () |
| std::vector< CrossoverOpP > | getCrossoverOp () |
| std::vector< MutationOpP > | getMutationOp () |
| void | registerParameters (StateP state) |
| void | read (XMLNode &xCart) |
| void | write (XMLNode &xCart) |
| uint | getGenomeSize () |
| void | buildRandomGenome () |
| void | evaluate (std::vector< double > &inputData, std::vector< double > &results) |
| uint | randomNodeInputConnection (uint column) |
| uint | randomOutputConnection () |
| void | getActiveFunctionNodes (std::vector< uint > &) |
| Public Member Functions inherited from Genotype | |
| bool | registerParameter (StateP state, std::string name, voidP value, enum ECF::type T, std::string description="") |
| Register a single parameter. | |
| voidP | getParameterValue (StateP state, std::string name) |
| Read single parameter value from Registry. | |
| bool | setParameterValue (StateP state, std::string name, voidP value) |
| Write single parameter value to Registry. | |
| bool | isParameterDefined (StateP state, std::string name) |
| Check if parameter is defined in the configuration. | |
| std::string | getName () |
| Return genotype's name (each genotype is uniquely identified with its name). | |
| uint | getGenotypeId () |
| Return this genotype's index in individual structure. | |
| void | setGenotypeId (uint id) |
| Set genotype index in an individual. | |
| std::string | toString () |
| Output genotype to string. | |
Public Attributes | |
| StateP | state_ |
| local copy of state | |
| FunctionSetP | functionSet_ |
| pointer to function set | |
| std::vector< Node > | nodes_ |
| genotype nodes (input nodes and function nodes) | |
| std::vector< uint > | outputs_ |
| output nodes | |
| std::vector< double > | constants_ |
| input nodes with constant values | |
| uint | nVariables_ |
| number of input variables | |
| uint | nConstants_ |
| number of input constants | |
| uint | nOutputs_ |
| number of final outputs | |
| uint | nRows_ |
| number of rows | |
| uint | nCols_ |
| number of columns | |
| uint | nLevelsBack_ |
| levels back parameter | |
| uint | nFunctions_ |
| number of used functions | |
| uint | nInputs_ |
| total number of inputs (variables and constants) | |
| uint | maxArity_ |
| max number of inputs for all function nodes | |
Protected Member Functions | |
| void | addRecursivelyActiveFunctionNodes (std::vector< bool > &activeFlags, uint node) |
| void | addRecursivelyActiveFunctionNodes (std::vector< bool > &activeFlags, uint node) |
Additional Inherited Members | |
| Protected Attributes inherited from Genotype | |
| std::string | name_ |
| genotype's name | |
| uint | genotypeId_ |
| this genotype's unique index in individual structure | |
CGP (Cartesian genetic programming) is implemented as a vector of Nodes and final output connections.
Nodes can be input nodes (variables and constants) or function nodes. A function Node points to a function primitive which has a predefined number of arguments.
Definition at line 27 of file Cartesian_c.h.
| Cartesian::Cartesian::Cartesian | ( | void | ) |
Definition at line 20 of file Cartesian.cpp.
| Cartesian::Cartesian::~Cartesian | ( | void | ) |
Definition at line 27 of file Cartesian.cpp.
|
protected |
Definition at line 367 of file Cartesian.cpp.
| void Cartesian::Cartesian::buildRandomGenome | ( | ) |
Build random genotype choosing functions and argument connections
Definition at line 256 of file Cartesian.cpp.
| void Cartesian::Cartesian::buildRandomGenome | ( | ) |
Build random genotype choosing functions and argument connections
|
virtual |
Create an identical copy of the genotype object
Implements Genotype.
Definition at line 31 of file Cartesian.cpp.
|
virtual |
Create an identical copy of the genotype object
Implements Genotype.
| void Cartesian::Cartesian::evaluate | ( | std::vector< double > & | inputData, |
| std::vector< double > & | results ) |
Calculate CGP results for given inputs
Definition at line 319 of file Cartesian.cpp.
| void Cartesian::Cartesian::evaluate | ( | std::vector< double > & | inputData, |
| std::vector< double > & | results ) |
Calculate CGP results for given inputs
| void Cartesian::Cartesian::getActiveFunctionNodes | ( | std::vector< uint > & | activeNodes | ) |
Build a vector with indexes of active function nodes (excluding input nodes)
Definition at line 348 of file Cartesian.cpp.
| void Cartesian::Cartesian::getActiveFunctionNodes | ( | std::vector< uint > & | ) |
Build a vector with indexes of active function nodes (excluding input nodes)
|
virtual |
Create and return a vector of crossover operators
Reimplemented from Genotype.
Definition at line 38 of file Cartesian.cpp.
|
virtual |
Create and return a vector of crossover operators
Reimplemented from Genotype.
|
virtual |
Returns number of mutable genotype elements (function and output nodes)
Reimplemented from Genotype.
Definition at line 250 of file Cartesian.cpp.
|
virtual |
Returns number of mutable genotype elements (function and output nodes)
Reimplemented from Genotype.
|
virtual |
Create and return a vector of mutation operators
Reimplemented from Genotype.
Definition at line 48 of file Cartesian.cpp.
|
virtual |
Create and return a vector of mutation operators
Reimplemented from Genotype.
|
virtual |
Initialize a genotype object (read parameters, perform sanity check, build data)
Implements Genotype.
Definition at line 70 of file Cartesian.cpp.
|
virtual |
Initialize a genotype object (read parameters, perform sanity check, build data)
Implements Genotype.
| uint Cartesian::Cartesian::randomNodeInputConnection | ( | uint | column | ) |
Return a random connection from given column, considering levels_back
Definition at line 288 of file Cartesian.cpp.
| uint Cartesian::Cartesian::randomNodeInputConnection | ( | uint | column | ) |
Return a random connection from given column, considering levels_back
| uint Cartesian::Cartesian::randomOutputConnection | ( | ) |
Return a random connection for the output (currently excludes input nodes)
Definition at line 313 of file Cartesian.cpp.
| uint Cartesian::Cartesian::randomOutputConnection | ( | ) |
Return a random connection for the output (currently excludes input nodes)
|
virtual |
|
virtual |
Read genotype data from XMLNode
Implements Genotype.
|
virtual |
Register genotype's parameters (called before Genotype::initialize)
Reimplemented from Genotype.
Definition at line 58 of file Cartesian.cpp.
|
virtual |
Register genotype's parameters (called before Genotype::initialize)
Reimplemented from Genotype.
|
virtual |
|
virtual |
Write genotype data to XMLNode
Implements Genotype.
| std::vector< double > Cartesian::Cartesian::constants_ |
input nodes with constant values
Definition at line 108 of file Cartesian_c.h.
| FunctionSetP Cartesian::Cartesian::functionSet_ |
pointer to function set
Definition at line 105 of file Cartesian_c.h.
| uint Cartesian::Cartesian::maxArity_ |
max number of inputs for all function nodes
Definition at line 121 of file Cartesian_c.h.
| uint Cartesian::Cartesian::nCols_ |
number of columns
Definition at line 115 of file Cartesian_c.h.
| uint Cartesian::Cartesian::nConstants_ |
number of input constants
Definition at line 112 of file Cartesian_c.h.
| uint Cartesian::Cartesian::nFunctions_ |
number of used functions
Definition at line 117 of file Cartesian_c.h.
| uint Cartesian::Cartesian::nInputs_ |
total number of inputs (variables and constants)
Definition at line 120 of file Cartesian_c.h.
| uint Cartesian::Cartesian::nLevelsBack_ |
levels back parameter
Definition at line 116 of file Cartesian_c.h.
| std::vector< Node > Cartesian::Cartesian::nodes_ |
genotype nodes (input nodes and function nodes)
Definition at line 106 of file Cartesian_c.h.
| uint Cartesian::Cartesian::nOutputs_ |
number of final outputs
Definition at line 113 of file Cartesian_c.h.
| uint Cartesian::Cartesian::nRows_ |
number of rows
Definition at line 114 of file Cartesian_c.h.
| uint Cartesian::Cartesian::nVariables_ |
number of input variables
Definition at line 111 of file Cartesian_c.h.
| std::vector< uint > Cartesian::Cartesian::outputs_ |
output nodes
Definition at line 107 of file Cartesian_c.h.
| StateP Cartesian::Cartesian::state_ |
local copy of state
Definition at line 104 of file Cartesian_c.h.