• Main Page
  • Modules
  • Classes
  • Files
  • File List

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

00001 #ifndef BINARY_H_
00002 #define BINARY_H_
00003 
00004 #include "BinaryCrsOnePoint.h"
00005 #include "BinaryCrsTwoPoint.h"
00006 #include "BinaryMutSimple.h"
00007 #include "BinaryMutMix.h"
00008 #include "BinaryCrsUniform.h"
00009 #include "BinaryCrsHalfUniform.h"
00010 #include "BinaryCrsReducedSurrogate.h"
00011 #include "BinaryCrsSegmented.h"
00012 #include "BinaryCrsShuffle.h"
00013 #include "../RealValueGenotype.h"
00014 
00015 namespace Binary
00016 {
00017 
00034 class Binary: public RealValueGenotype {
00035     friend class BinaryMutSimple;   // za potrebe ad-hoc lokalnog operatora!
00036 protected:
00037     uint nDecimal_;                   
00038     uint nBits_;                      
00039     long potention_;
00040     bool bRounding_;                  
00041     typedef std::vector<bool> v_bool;
00042     v_bool vBool_;                    
00043 
00044     double logbase(double a, double base);
00045     double round(double, int);
00046 
00047 public:
00048     std::vector<long int> decValue;    
00049     std::vector<v_bool> variables;     
00050 
00051     Binary ()
00052     {   name_ = "Binary";   }
00053 
00055     uint getNumBits()
00056     {   return nBits_;  }
00057 
00058     bool initialize (StateP state);
00059 
00060     void registerParameters(StateP state);
00061 
00063     bool update (void);
00064 
00065     Binary* copy()
00066     {
00067         Binary *newObject = new Binary(*this);
00068         return newObject;
00069     }
00070 
00071     std::vector<CrossoverOpP> getCrossoverOp()
00072     {
00073         std::vector<CrossoverOpP> crx;
00074         crx.push_back(static_cast<CrossoverOpP> (new BinaryCrsOnePoint));
00075         crx.push_back(static_cast<CrossoverOpP> (new BinaryCrsTwoPoint));
00076         crx.push_back(static_cast<CrossoverOpP> (new BinaryCrsUniform));
00077         crx.push_back(static_cast<CrossoverOpP> (new BinaryCrsHalfUniform));
00078         crx.push_back(static_cast<CrossoverOpP> (new BinaryCrsReducedSurrogate));
00079         crx.push_back(static_cast<CrossoverOpP> (new BinaryCrsSegmented));
00080         crx.push_back(static_cast<CrossoverOpP> (new BinaryCrsShuffle));
00081         return crx;
00082     }
00083 
00084     std::vector<MutationOpP> getMutationOp()
00085     {   
00086         std::vector<MutationOpP> mut;
00087         mut.push_back(static_cast<MutationOpP> (new BinaryMutSimple));
00088         mut.push_back(static_cast<MutationOpP> (new BinaryMutMix));
00089         return mut;
00090     }
00091 
00092     void write(XMLNode& xBinary);
00093 
00094     void read(XMLNode& xBinary);
00095 };
00096 
00097 }
00098 typedef boost::shared_ptr<Binary::Binary> BinaryP;
00099 #endif

Generated on Fri Jul 5 2013 09:34:23 for ECF by  doxygen 1.7.1