00001 00005 #ifndef GENETIK_GP_ST_INDIVIDUALFACTORY 00006 #define GENETIK_GP_ST_INDIVIDUALFACTORY 00007 00008 #include "../IndividualFactory.h" 00009 00010 namespace genetiK 00011 { 00012 namespace gp 00013 { 00014 namespace st 00015 { 00016 00017 00018 typedef unsigned char GeneType; 00019 00029 class IndividualFactory : public gp::IndividualFactory 00030 { 00031 00032 private: 00033 GeneType rootType; 00034 GeneType nextGeneType; 00035 00036 unsigned char maxHeight; 00037 public: 00038 00047 IndividualFactory(unsigned char maxHeight,gp::ETreeInitialization treeInitialization,GeneType rootType); 00050 virtual ~IndividualFactory(); 00051 00057 genetiK::Individual* generate()=0; 00058 00059 00066 GeneType getNextType() const{ return nextGeneType; } 00067 00074 void setNextType(const GeneType nextGeneType) { this->nextGeneType = nextGeneType; } 00075 00083 virtual gp::Gene* generateBranch(unsigned char height,ETreeInitialization treeInitialization); 00084 00085 00086 protected: 00087 00098 virtual gp::Gene* generateGene(EGenerateGeneFlags flags)=0; 00099 00105 virtual gp::Gene* generateTree(); 00106 00112 virtual void generateChildren(gp::Gene* branchRoot, unsigned char height); 00113 00114 }; 00115 00116 } 00117 } 00118 } 00119 00120 #endif