00001 #ifndef GLBASEMUTATOR_H_ 00002 #define GLBASEMUTATOR_H_ 00003 00004 class GLBaseOrganism; 00005 00009 class GLBaseMutator 00010 { 00011 public: 00020 GLBaseMutator(double mutation_rate = 0.5, 00021 bool check_range = false) 00022 { setMutationRate(mutation_rate, check_range); } 00023 00028 GLBaseMutator(const GLBaseMutator& mutator); 00029 00033 virtual ~GLBaseMutator(){}; 00034 00040 virtual GLBaseMutator* copy() const = 0; 00041 00047 double getMutationRate() const 00048 { return m_mutation_rate; } 00049 00056 virtual bool mutateOrganism(GLBaseOrganism* organism) = 0; 00057 00061 virtual void reset(); 00062 00071 void setMutationRate(double mutation_rate, bool checkRange = false); 00072 00073 private: 00074 double m_mutation_rate; //mutation rate -- interpretation of this value 00075 //is upto concrete mutator implementation. 00076 00077 }; 00078 00079 #endif /*GLBASEMUTATOR_H_*/