00001 #ifndef Genotype_h
00002 #define Genotype_h
00003
00004 #include<string>
00005
00006
00007 class CrossoverOp;
00008 typedef boost::shared_ptr<CrossoverOp> CrossoverOpP;
00009 class MutationOp;
00010 typedef boost::shared_ptr<MutationOp> MutationOpP;
00011
00012
00013 class State;
00014 typedef boost::shared_ptr<State> StateP;
00015
00024 class Genotype
00025 {
00026 protected:
00027
00028 public:
00029 Genotype()
00030 { }
00031 virtual ~Genotype()
00032 { }
00033
00037 virtual bool initialize(StateP state) = 0;
00038
00042 virtual Genotype* copy() = 0;
00043
00047 virtual std::vector<CrossoverOpP> getCrossoverOp()
00048 {
00049 std::vector<CrossoverOpP> empty;
00050 return empty;
00051 }
00052
00056 virtual std::vector<MutationOpP> getMutationOp()
00057 {
00058 std::vector<MutationOpP> empty;
00059 return empty;
00060 }
00061
00065 virtual void registerParameters(StateP) {}
00066
00067 bool registerParameter(StateP state, std::string name, voidP value, enum ECF::type T);
00068
00069 voidP getParameterValue(StateP state, std::string name);
00070
00071 bool setParameterValue(StateP state, std::string name, voidP value);
00072
00073 bool isParameterDefined(StateP state, std::string name);
00074
00078 virtual void read(XMLNode&) = 0;
00079
00083 virtual void write(XMLNode&) = 0;
00084
00085 virtual uint getGenomeSize()
00086 { return 0; }
00087
00091 std::string getName()
00092 { return name_; }
00093
00097 uint getGenotypeId()
00098 { return genotypeId_; }
00099
00103 void setGenotypeId(uint id)
00104 { genotypeId_ = id; }
00105
00106 protected:
00107 std::string name_;
00108 uint genotypeId_;
00109 };
00110 typedef boost::shared_ptr<Genotype> GenotypeP;
00111
00112 #endif // Genotype_h
00113