• Main Page
  • Classes
  • Files
  • File List

D:/Radagast_D/Projekt/ECF_trunk/ECF/binary/Binary.h

00001 #ifndef BINARY_H_
00002 #define BINARY_H_
00003 
00004 #include "BinaryCrsOnePoint.h"
00005 #include "BinaryMutSimple.h"
00006 #include "BinaryMutMix.h"
00007 #include "BinaryCrsUniform.h"
00008 #include "../Genotype.h"
00009 
00010 namespace Binary
00011 {
00012 
00023 class Binary: public Genotype {
00024     friend class BinaryMutSimple;   // za potrebe ad-hoc lokalnog operatora!
00025 protected:
00026     double minValue_;                 
00027     double maxValue_;                 
00028     uint nDecimal_;                   
00029     uint nDimension_;                 
00030     uint nBits_;                      
00031     long potention_;
00032     bool bRounding_;                  
00033     typedef std::vector<bool> v_bool;
00034     v_bool vBool_;
00035 
00036     double logbase(double a, double base);
00037     double round(double, int);
00038 
00039 public:
00040     std::vector<long int> decValue;    
00041     std::vector<double> realValue;     
00042     std::vector<v_bool> variables;     
00043 
00044     Binary ()
00045     {   name_ = "Binary";   }
00046 
00050     uint getNumBits()
00051     {   return nBits_;  }
00052 
00053     bool initialize (StateP state);
00054 
00055     void registerParameters(StateP state);
00056 
00060     bool update (void);
00061 
00062     Binary* copy()
00063     {
00064         Binary *newObject = new Binary(*this);
00065         return newObject;
00066     }
00067 
00068     std::vector<CrossoverOpP> getCrossoverOp()
00069     {
00070         std::vector<CrossoverOpP> crx;
00071         crx.push_back(static_cast<CrossoverOpP> (new BinaryCrsOnePoint));
00072         crx.push_back(static_cast<CrossoverOpP> (new BinaryCrsUniform));
00073         return crx;
00074     }
00075 
00076     std::vector<MutationOpP> getMutationOp()
00077     {   
00078         std::vector<MutationOpP> mut;
00079         mut.push_back(static_cast<MutationOpP> (new BinaryMutSimple));
00080         mut.push_back(static_cast<MutationOpP> (new BinaryMutMix));
00081         return mut;
00082     }
00083 
00084     void write(XMLNode& xBinary);
00085 
00086     void read(XMLNode& xBinary);
00087 };
00088 
00089 }
00090 typedef boost::shared_ptr<Binary::Binary> BinaryP;
00091 #endif

Generated on Wed Sep 1 2010 14:31:21 for ECF by  doxygen 1.7.1