00001 #ifndef Cartesian_h
00002 #define Cartesian_h
00003 #include "../ECF_base.h"
00004 #include "../Genotype.h"
00005
00006 typedef unsigned int uint;
00007 using namespace std;
00008
00009 namespace cart {
00010
00011 class FunctionSet;
00012 typedef boost::shared_ptr<FunctionSet> FunctionSetP;
00013
00014 class Cartesian : public vector<uint>, public Genotype
00015 {
00016 public:
00017 Cartesian(void);
00018 ~Cartesian(void);
00022 bool initialize(StateP state);
00023
00027 Cartesian* copy();
00028
00032 vector<CrossoverOpP> getCrossoverOp();
00033
00037 vector<MutationOpP> getMutationOp();
00038
00042 void registerParameters(StateP state);
00043
00047 void read(XMLNode &xCart);
00048
00052 void write(XMLNode &xCart);
00053
00054 uint getGenomeSize();
00055
00060 void makeGenotype();
00065 uint randInputConn(uint currCol);
00069 uint randOutput();
00073 uint randFunction();
00077 void evaluate(voidP inputs, void* result, uint funcNum);
00081 void printGenotype();
00085 uint getNumOfInputs();
00089 uint getNumOfOutputs();
00093 uint getNumOfInputConn();
00097 voidP getConstantNames();
00101 uint getNumOfRows();
00105 uint getNumOfCols();
00110 uint getLevelsBack();
00114 uint getNumVars();
00115
00116 FunctionSetP funcSet;
00117
00118 protected:
00119 StateP state_;
00120
00121 uint inputs;
00122 uint outputs;
00123 uint inputConns;
00124 uint rows;
00125 uint cols;
00126 uint levelsBack;
00127 uint numVars;
00128 uint numFunc;
00129 voidP constantset;
00130
00131
00132 };
00133 typedef boost::shared_ptr<Cartesian> CartesianP;
00134 }
00135
00136 #endif // Cartesian_h