00001 00006 #ifndef GENETIK_INDIVIDUAL 00007 #define GENETIK_INDIVIDUAL 00008 00009 #include <string> 00010 00011 00012 /* 00013 This class rapresents the individual. 00014 */ 00015 namespace genetiK{ 00016 00025 class Individual 00026 { 00027 protected: 00028 public: 00033 Individual(void); 00034 00039 Individual(const Individual& individual); 00040 00045 virtual ~Individual(void); 00046 00052 virtual double fitness()=0; 00053 00060 virtual Individual* copy()const=0; 00061 00069 virtual int mutate(const double mutationProbability)=0; 00070 00082 virtual int crossOver(Individual* i,Individual** child1,Individual** child2)=0; 00083 00084 00091 virtual std::string toString()const; 00092 00101 virtual bool operator < (Individual& i2) { return this->fitness() < i2.fitness(); } 00102 }; 00103 00113 std::ostream& operator<<(std::ostream& os, const Individual& ind); 00114 00115 } 00116 00117 00118 #endif