ECF 1.5
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cartesian::Cartesian Class Reference
Inheritance diagram for cartesian::Cartesian:
Genotype

Public Member Functions

bool initialize (StateP state)
 
Cartesiancopy ()
 
vector< CrossoverOpP > getCrossoverOp ()
 
vector< MutationOpP > getMutationOp ()
 
void registerParameters (StateP state)
 
void read (XMLNode &xCart)
 
void write (XMLNode &xCart)
 
uint getRowNumber (uint index)
 
uint getGenomeSize ()
 
uint randomConnectionGenerator (uint rowNumber)
 
std::set< uint > allPossibleConnection (uint rowNumber)
 
void buildRandomGenome ()
 
std::vector< uint > getActiveTrail (uint output_number)
 
std::vector< std::vector< uint > > getActiveTrails ()
 
void evaluate (const vector< double > &inputData, vector< double > &results)
 
int get_random_int (int from, int to)
 
double get_random_double (int from, int to)
 
- Public Member Functions inherited from Genotype
virtual bool initialize (StateP state)=0
 Initialize a genotype object (read parameters, perform sanity check, build data) More...
 
virtual Genotypecopy ()=0
 Create an identical copy of the genotype object. More...
 
virtual std::vector< CrossoverOpP > getCrossoverOp ()
 Create and return a vector of crossover operators. More...
 
virtual std::vector< MutationOpP > getMutationOp ()
 Create and return a vector of mutation operators. More...
 
virtual void registerParameters (StateP)
 Register genotype's parameters (called before Genotype::initialize) More...
 
bool registerParameter (StateP state, std::string name, voidP value, enum ECF::type T, std::string description="")
 Register a single parameter. More...
 
voidP getParameterValue (StateP state, std::string name)
 Read single parameter value from Registry. More...
 
bool setParameterValue (StateP state, std::string name, voidP value)
 Write single parameter value to Registry. More...
 
bool isParameterDefined (StateP state, std::string name)
 Check if parameter is defined in the configuration. More...
 
virtual void read (XMLNode &)=0
 Read genotype data from XMLNode. More...
 
virtual void write (XMLNode &)=0
 Write genotype data to XMLNode. More...
 
virtual uint getGenomeSize ()
 
std::string getName ()
 Return genotype's name (each genotype is uniquely identified with its name). More...
 
uint getGenotypeId ()
 Return this genotype's index in individual structure. More...
 
void setGenotypeId (uint id)
 Set genotype index in an individual. More...
 
std::string toString ()
 Output genotype to string. More...
 

Static Public Member Functions

static double static_random_double (int from, int to)
 

Public Attributes

StateP state_
 local copy of state More...
 
uint nVariables
 number of input variables More...
 
uint nConstants
 number of input constants More...
 
uint nOutputs
 number of final outputs More...
 
uint nRows
 number of rows More...
 
uint nCols
 number of columns More...
 
uint nLevelsBack
 levels back parameter More...
 
uint nFunctions
 number of functions More...
 
uint nInputs
 total number of inputs (including constants) More...
 
uint maxArity
 max number of inputs for all function nodes (gates) More...
 
FunctionSetP functionSet_
 

Additional Inherited Members

- Protected Attributes inherited from Genotype
std::string name_
 genotype's name More...
 
uint genotypeId_
 this genotype's unique index in individual structure More...
 

Detailed Description

Definition at line 12 of file Cartesian_genotype.h.

Constructor & Destructor Documentation

◆ Cartesian()

cartesian::Cartesian::Cartesian ( void  )

Definition at line 7 of file Cartesian.cpp.

◆ ~Cartesian()

cartesian::Cartesian::~Cartesian ( void  )
inline

Definition at line 16 of file Cartesian_genotype.h.

Member Function Documentation

◆ allPossibleConnection()

std::set< uint > cartesian::Cartesian::allPossibleConnection ( uint  rowNumber)

Definition at line 228 of file Cartesian.cpp.

◆ buildRandomGenome()

void cartesian::Cartesian::buildRandomGenome ( )

Build random genotype choosing input connections, outputs and functions

Definition at line 284 of file Cartesian.cpp.

◆ copy()

Cartesian * cartesian::Cartesian::copy ( )
virtual

Create an identical copy of the genotype object

Implements Genotype.

Definition at line 13 of file Cartesian.cpp.

◆ evaluate()

void cartesian::Cartesian::evaluate ( const vector< double > &  inputData,
vector< double > &  results 
)

Return result for required inputs (optional: from node with index funcNum)

◆ get_random_double()

double cartesian::Cartesian::get_random_double ( int  from,
int  to 
)

Definition at line 309 of file Cartesian.cpp.

◆ get_random_int()

int cartesian::Cartesian::get_random_int ( int  from,
int  to 
)

Definition at line 304 of file Cartesian.cpp.

◆ getActiveTrail()

std::vector< uint > cartesian::Cartesian::getActiveTrail ( uint  output_number)

Returns a vector of integers which contain indexes of elements of genotype. These indexes are those operators which make connection from and output (specified with output_number) to inputs.

output_number is 0 indexed. Returned vector contains indexes of Cartesian object. All CartesianGenes contribute in calculation of an output numbered output_number.

Definition at line 251 of file Cartesian.cpp.

◆ getActiveTrails()

std::vector< std::vector< uint > > cartesian::Cartesian::getActiveTrails ( )

Returns all trails.

Definition at line 275 of file Cartesian.cpp.

◆ getCrossoverOp()

std::vector< CrossoverOpP > cartesian::Cartesian::getCrossoverOp ( )
virtual

Create and return a vector of crossover operators

Reimplemented from Genotype.

Definition at line 20 of file Cartesian.cpp.

◆ getGenomeSize()

uint cartesian::Cartesian::getGenomeSize ( )
virtual

Reimplemented from Genotype.

Definition at line 195 of file Cartesian.cpp.

◆ getMutationOp()

std::vector< MutationOpP > cartesian::Cartesian::getMutationOp ( )
virtual

Create and return a vector of mutation operators

Reimplemented from Genotype.

Definition at line 29 of file Cartesian.cpp.

◆ getRowNumber()

uint cartesian::Cartesian::getRowNumber ( uint  index)

Definition at line 200 of file Cartesian.cpp.

◆ initialize()

bool cartesian::Cartesian::initialize ( StateP  state)
virtual

Initialize a genotype object (read parameters, perform sanity check, build data)

Implements Genotype.

Definition at line 53 of file Cartesian.cpp.

◆ randomConnectionGenerator()

uint cartesian::Cartesian::randomConnectionGenerator ( uint  rowNumber)

CGP layout: On top is 1st row, on bottom is nth row. Depending on which row we wish to connect we need its number to check valid connections(only rows before it, depending on levelsback).

ROWS AND COLUMNS ARE 0 indexed!!!

Definition at line 213 of file Cartesian.cpp.

◆ read()

void cartesian::Cartesian::read ( XMLNode &  xCart)
virtual

Read genotype data from XMLNode

Implements Genotype.

Definition at line 147 of file Cartesian.cpp.

◆ registerParameters()

void cartesian::Cartesian::registerParameters ( StateP  state)
virtual

Register genotype's parameters (called before Genotype::initialize)

Reimplemented from Genotype.

Definition at line 41 of file Cartesian.cpp.

◆ static_random_double()

double cartesian::Cartesian::static_random_double ( int  from,
int  to 
)
static

Definition at line 335 of file Cartesian.cpp.

◆ write()

void cartesian::Cartesian::write ( XMLNode &  xCart)
virtual

Write genotype data to XMLNode

Implements Genotype.

Definition at line 178 of file Cartesian.cpp.

Member Data Documentation

◆ functionSet_

FunctionSetP cartesian::Cartesian::functionSet_

Definition at line 104 of file Cartesian_genotype.h.

◆ maxArity

uint cartesian::Cartesian::maxArity

max number of inputs for all function nodes (gates)

Definition at line 102 of file Cartesian_genotype.h.

◆ nCols

uint cartesian::Cartesian::nCols

number of columns

Definition at line 96 of file Cartesian_genotype.h.

◆ nConstants

uint cartesian::Cartesian::nConstants

number of input constants

Definition at line 93 of file Cartesian_genotype.h.

◆ nFunctions

uint cartesian::Cartesian::nFunctions

number of functions

Definition at line 98 of file Cartesian_genotype.h.

◆ nInputs

uint cartesian::Cartesian::nInputs

total number of inputs (including constants)

Definition at line 101 of file Cartesian_genotype.h.

◆ nLevelsBack

uint cartesian::Cartesian::nLevelsBack

levels back parameter

Definition at line 97 of file Cartesian_genotype.h.

◆ nOutputs

uint cartesian::Cartesian::nOutputs

number of final outputs

Definition at line 94 of file Cartesian_genotype.h.

◆ nRows

uint cartesian::Cartesian::nRows

number of rows

Definition at line 95 of file Cartesian_genotype.h.

◆ nVariables

uint cartesian::Cartesian::nVariables

number of input variables

Definition at line 92 of file Cartesian_genotype.h.

◆ state_

StateP cartesian::Cartesian::state_

local copy of state

Definition at line 89 of file Cartesian_genotype.h.


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