00001 #ifndef CSTANDARDTRANSCRIBE_H 00002 #define CSTANDARDTRANSCRIBE_H 00003 #include "GeneralTranscribe.h" 00004 00005 namespace gplib 00006 { 00007 /** \addtogroup gainv Genetic algorithm optimization */ 00008 /* @{ */ 00009 00010 //! BinaryTranscibe implements transcription for standard binary populations 00011 /*! It works for simple binary string populations with the "canonic" decoding of the bit string 00012 * For each parameter a basevalue, stepsize and genesize has to be specified 00013 * upon construction. 00014 */ 00015 class BinaryTranscribe: public GeneralTranscribe 00016 { 00017 protected: 00018 const ttranscribed basevalues;//!< The minimum value for each parameter 00019 const ttranscribed stepsizes;//!< The stepsize associated to a bit change for each parameter 00020 const tsizev genesizes; //!< The number of bits for each parameter 00021 public: 00022 virtual ttranscribed GetValues(const tpopmember &member); //!< Implements the abstract function from GeneralTranscribe 00023 //! Without basevalues, stepsizes and genesizes BinaryTranscribe does not work, so we inforce their use by 00024 //! including them in the constructor 00025 BinaryTranscribe(const ttranscribed &base, const ttranscribed &step, 00026 const tsizev &gene); 00027 virtual int GetNparams() 00028 { 00029 return basevalues.size(); 00030 } 00031 ; 00032 //! We declare a copy constructor that copies the private variables; 00033 BinaryTranscribe(const BinaryTranscribe &Old); 00034 BinaryTranscribe(const GeneralTranscribe &Old); 00035 virtual ~BinaryTranscribe(); 00036 }; 00037 /* @} */ 00038 } 00039 #endif // CSTANDARDTRANSCRIBE_H
1.5.8