• Main Page
  • Classes
  • Files
  • File List

D:/Radagast_D/Projekt/ECF_trunk/ECF/tree/Tree_c.h

00001 #ifndef Tree_c_h
00002 #define Tree_c_h
00003 #include "Node.h"
00004 #include "../Genotype.h"
00005 #include <vector>
00006 #define MAX_ARGS 10
00007 
00008 
00009 namespace Tree
00010 {
00011 
00012 class PrimitiveSet;
00013 typedef boost::shared_ptr<PrimitiveSet> PrimitiveSetP;
00014 
00018 class Tree : public std::vector<NodeP>, public Genotype
00019 {
00020 protected:
00021     uint growBuild(PrimitiveSetP primitiveSet, int myDepth);
00022     uint fullBuild(PrimitiveSetP primitiveSet, int myDepth);
00023     uint setSize(int);
00024     void setDepth(int myDepth);
00025     void initializeFirst(Tree* hometree);
00026 
00027     std::vector<PrimitiveP> userFunctions_; // dinamically added functions
00028     std::vector<PrimitiveP> userTerminals_; // dinamically added terminals
00029     StateP state_;
00030 
00031 public:
00032     Tree();
00033     ~Tree();
00034     Tree* copy();
00035 
00036     void growBuild(PrimitiveSetP primitiveSet);
00037     void fullBuild(PrimitiveSetP primitiveSet);
00038     void update();
00039     void execute(void*);
00040     void addNode(Node* node);
00041     void addNode(NodeP node);
00042     void setTerminalValue(std::string, void*);
00043     void write(XMLNode&);
00044     void read(XMLNode&);
00045     void registerParameters(StateP);
00046     bool initialize (StateP state);
00047 
00048     std::vector<MutationOpP> getMutationOp();
00049     std::vector<CrossoverOpP> getCrossoverOp();
00050 
00051     bool addFunction(PrimitiveP);
00052     bool addTerminal(PrimitiveP);
00053 
00054     uint getMaxDepth()
00055     {   return maxDepth_;   }
00056 
00057     uint getMinDepth()
00058     {   return minDepth_;   }
00059 
00060     uint getStartDepth()
00061     {   return startDepth_; }
00062 
00063     PrimitiveSetP primitiveSet_;
00064     uint iNode_;
00065     uint startDepth_;
00066     uint maxDepth_;
00067     uint minDepth_;
00068     uint initMaxDepth_;
00069     uint initMinDepth_;
00070 };
00071 }
00072 typedef boost::shared_ptr<Tree::Tree> TreeP;
00073 
00074 #endif
00075 

Generated on Wed Sep 1 2010 14:31:21 for ECF by  doxygen 1.7.1