ECF 1.5
Cartesian_genotype.h
1#ifndef ECF_CARTESIAN_CARTESIAN_GENOTYPE_H
2#define ECF_CARTESIAN_CARTESIAN_GENOTYPE_H
3#include <vector>
4#include <set>
5#include <ECF_base.h>
6#include <Genotype.h>
7#include "CartesianGene.h"
8namespace cartesian
9{
10 class FunctionSet;
11 typedef boost::shared_ptr<FunctionSet> FunctionSetP;
12 class Cartesian : public std::vector<CartesianGene>, public Genotype
13 {
14 public:
15 Cartesian(void);
16 ~Cartesian(void){};
17
21 bool initialize(StateP state);
25 Cartesian* copy();
26
30 vector<CrossoverOpP> getCrossoverOp();
31
35 vector<MutationOpP> getMutationOp();
36
40 void registerParameters(StateP state);
41
45 void read(XMLNode &xCart);
46
50 void write(XMLNode &xCart);
51
52 uint getRowNumber(uint index);
53
54 uint getGenomeSize();
55
56 uint randomConnectionGenerator(uint rowNumber);
57
58 std::set<uint> allPossibleConnection(uint rowNumber);
59
63 void buildRandomGenome();
64
70 std::vector<uint> getActiveTrail(uint output_number);
71
75 std::vector<std::vector<uint> > getActiveTrails();
76
80 void evaluate(const vector<double>& inputData, vector<double>& results);
81
82 int get_random_int(int from, int to);
83
84 double get_random_double(int from, int to);
85
86 static double static_random_double(int from, int to);
87
88 public:
89 StateP state_;
90
91 // user defined parameters
94 uint nOutputs;
95 uint nRows;
96 uint nCols;
99
100 // derived parameters
101 uint nInputs;
102 uint maxArity;
103
104 FunctionSetP functionSet_;
105
106 };
107}
108typedef boost::shared_ptr<cartesian::Cartesian> CartesianP;
109#endif //ECF_CARTESIAN_CARTESIAN_GENOTYPE_H
Genotype base class.
Definition: Genotype.h:36
Cartesian * copy()
Definition: Cartesian.cpp:13
uint nInputs
total number of inputs (including constants)
uint randomConnectionGenerator(uint rowNumber)
Definition: Cartesian.cpp:213
uint nVariables
number of input variables
void write(XMLNode &xCart)
Definition: Cartesian.cpp:178
void evaluate(const vector< double > &inputData, vector< double > &results)
vector< MutationOpP > getMutationOp()
Definition: Cartesian.cpp:29
std::vector< uint > getActiveTrail(uint output_number)
Definition: Cartesian.cpp:251
void read(XMLNode &xCart)
Definition: Cartesian.cpp:147
vector< CrossoverOpP > getCrossoverOp()
Definition: Cartesian.cpp:20
uint nLevelsBack
levels back parameter
uint nRows
number of rows
uint maxArity
max number of inputs for all function nodes (gates)
bool initialize(StateP state)
Definition: Cartesian.cpp:53
uint nOutputs
number of final outputs
uint nCols
number of columns
StateP state_
local copy of state
std::vector< std::vector< uint > > getActiveTrails()
Definition: Cartesian.cpp:275
uint nFunctions
number of functions
uint nConstants
number of input constants
void registerParameters(StateP state)
Definition: Cartesian.cpp:41