00001 /* 00002 * @file BinaryRealGene.h 00003 * @author Antonio Jesus Nebro Urbaneja 00004 * @version 1.0 00005 * @date 29 January 2004 00006 * @brief Header file of BinaryRealGene.cpp 00007 */ 00008 00009 #include <Configuration.h> 00010 #include <Gene.h> 00011 00012 #ifndef __BINARY_REAL_GENE__ 00013 #define __BINARY_REAL_GENE__ 00014 00019 class BinaryRealGene : public Gene { 00020 private: 00021 double decodeToReal() ; 00022 public: 00023 char * binaryAllele_ ; 00024 int numberOfBits_ ; 00025 double realAllele_ ; 00026 double lowerBound_ ; 00027 double upperBound_ ; 00028 00029 // Constructors 00030 BinaryRealGene(int numberOfBits, 00031 double lowerBound, 00032 double upperBound, 00033 Random * random) ; 00034 BinaryRealGene(BinaryRealGene & binaryRealGene) ; 00035 BinaryRealGene(BinaryRealGene * binaryRealGene) ; 00036 00037 // Destructor 00038 virtual ~BinaryRealGene() ; 00039 00040 // Methods 00041 int bitFlipMutation(double mutationProbability) ; 00042 double getRealAllele() ; 00043 void writeGenotype(ofstream &outputFile) ; 00044 00045 // Operators 00046 BinaryRealGene & operator=(const BinaryRealGene& gene) ; 00047 friend ostream& operator<< (ostream& outputStream, BinaryRealGene& gene) ; 00048 00049 } ; // BinaryRealGene 00050 00051 #endif 00052