00001 00005 #ifndef GENETIK_GP_INDIVIDUALFACTORY 00006 #define GENETIK_GP_INDIVIDUALFACTORY 00007 00008 #include "../IndividualFactory.h" 00009 00010 namespace genetiK 00011 { 00012 00013 namespace gp 00014 { 00015 00016 00024 typedef enum{ 00027 GROW=0, 00030 FULL 00031 }ETreeInitialization; 00032 00033 class Gene; 00034 00041 class IndividualFactory : public genetiK::IndividualFactory 00042 { 00043 private: 00044 00045 unsigned char maxHeight; 00046 ETreeInitialization treeInitialization; 00047 public: 00054 IndividualFactory(unsigned char maxHeight,ETreeInitialization treeInitialization); 00058 virtual ~IndividualFactory(); 00059 00065 genetiK::Individual* generate()=0; 00066 00073 typedef enum{ 00077 TERMINAL=1, 00081 FUNCTION=2 00082 }EGenerateGeneFlags; 00090 virtual Gene* generateGene(EGenerateGeneFlags flags)=0; 00098 virtual Gene* generateBranch(unsigned char height,ETreeInitialization treeInitialization); 00106 virtual Gene* generateTree(); 00107 00114 unsigned char getMaxHeight() const{ return maxHeight;} 00115 00122 ETreeInitialization getTreeInitialization() const{ return treeInitialization;} 00123 protected: 00124 00131 virtual void generateChildren(Gene* branchRoot, unsigned char height); 00132 00133 }; 00134 00135 } 00136 } 00137 00138 #endif