00001 #ifndef FLOATINGPOINT_H_ 00002 #define FLOATINGPOINT_H_ 00003 00004 #include "../Genotype.h" 00005 #include "FloatingPointMutSimple.h" 00006 #include "FloatingPointCrsOnePoint.h" 00007 #include "FloatingPointCrsArithmetic.h" 00008 00009 namespace FloatingPoint 00010 { 00011 00026 class FloatingPoint: public Genotype { 00027 00028 protected: 00029 double minValue_; 00030 double maxValue_; 00031 uint nDimension_; 00032 00033 00034 public: 00035 std::vector<double> realValue; 00036 00037 FloatingPoint () 00038 { name_="FloatingPoint"; } 00039 00040 bool initialize (StateP state); 00041 00042 void registerParameters(StateP state); 00043 00045 double getLBound () 00046 { return minValue_; } 00047 00049 double getUBound () 00050 { return maxValue_; } 00051 00052 FloatingPoint* copy() 00053 { 00054 FloatingPoint *newObject = new FloatingPoint(*this); 00055 return newObject; 00056 } 00057 00058 std::vector<CrossoverOpP> getCrossoverOp() 00059 { 00060 std::vector<CrossoverOpP> crx; 00061 crx.push_back(static_cast<CrossoverOpP> (new FloatingPointCrsOnePoint)); 00062 crx.push_back(static_cast<CrossoverOpP> (new FloatingPointCrsArithmetic)); 00063 return crx; 00064 } 00065 00066 std::vector<MutationOpP> getMutationOp() 00067 { 00068 std::vector<MutationOpP> mut; 00069 mut.push_back(static_cast<MutationOpP> (new FloatingPointMutSimple)); 00070 return mut; 00071 } 00072 00073 void write(XMLNode& xFloatingPoint); 00074 void read(XMLNode& xFloatingPoint); 00075 }; 00076 } 00077 00078 typedef boost::shared_ptr<FloatingPoint::FloatingPoint> FloatingPointP; 00079 #endif
1.7.1