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
00020 class FloatingPoint: public Genotype {
00021
00022 protected:
00023 double minValue_;
00024 double maxValue_;
00025 uint nDimension_;
00026
00027
00028 public:
00029 std::vector<double> realValue;
00030
00031 FloatingPoint ()
00032 { name_="FloatingPoint"; }
00033
00034 bool initialize (StateP state);
00035
00036 void registerParameters(StateP state);
00037
00038 double getLBound ()
00039 { return minValue_; }
00040
00041 double getUBound ()
00042 { return maxValue_; }
00043
00044 FloatingPoint* copy()
00045 {
00046 FloatingPoint *newObject = new FloatingPoint(*this);
00047 return newObject;
00048 }
00049
00050 std::vector<CrossoverOpP> getCrossoverOp()
00051 {
00052 std::vector<CrossoverOpP> crx;
00053 crx.push_back(static_cast<CrossoverOpP> (new FloatingPointCrsOnePoint));
00054 crx.push_back(static_cast<CrossoverOpP> (new FloatingPointCrsArithmetic));
00055 return crx;
00056 }
00057
00058 std::vector<MutationOpP> getMutationOp()
00059 {
00060 std::vector<MutationOpP> mut;
00061 mut.push_back(static_cast<MutationOpP> (new FloatingPointMutSimple));
00062 return mut;
00063 }
00064
00065 void write(XMLNode& xFloatingPoint);
00066 void read(XMLNode& xFloatingPoint);
00067 };
00068 }
00069
00070 typedef boost::shared_ptr<FloatingPoint::FloatingPoint> FloatingPointP;
00071 #endif