00001 00005 #ifndef GENETIK_GA_INDIVIDUAL 00006 #define GENETIK_GA_INDIVIDUAL 00007 00008 /*Include the standard genetiK::Individual*/ 00009 #include "../Individual.h" 00010 00011 #include <iostream> 00012 #include <string> 00013 00014 namespace genetiK 00015 { 00016 namespace ga 00017 { 00018 00026 class Individual : public genetiK::Individual 00027 { 00028 protected: 00030 unsigned int length; 00032 unsigned int* bitArray; 00034 unsigned char blockNum; 00035 public: 00043 Individual(unsigned int length); 00044 00052 Individual(const Individual& individual); 00053 00059 virtual ~Individual(void); 00060 00066 virtual double fitness()=0; 00067 00074 virtual genetiK::Individual* copy()const=0; 00075 00083 virtual int mutate(const double mutationProbability); 00084 00095 virtual int crossOver(genetiK::Individual* i, genetiK::Individual** child1, genetiK::Individual** child2); 00096 00101 unsigned int getLength() { return length; } 00102 00109 bool operator[] (unsigned int index) const; 00110 00115 virtual std::string toString()const; 00116 }; 00117 00118 } 00119 } 00120 00121 #endif