Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

GrayCodeChromosome.h

Go to the documentation of this file.
00001 
00010 /*
00011  * GALib v2.0- A simple C++ library for Genetic Algorithms
00012  * Arthur van Dam <dam@math.uu.nl>
00013  * $Id: GrayCodeChromosome.h 441 2007-11-15 16:55:50Z adam $
00014  */
00015 #ifndef __GAL_GRAYCODECHROMOSOME_H
00016 #define __GAL_GRAYCODECHROMOSOME_H
00017 
00018 #include <string>
00019 #include <sstream>
00020 #include "Chromosome.h"
00021 #include "Util.h"
00022 
00023 namespace gal {
00032     template <class T> class GrayCodeChromosome : public Chromosome<T> {
00033     public:
00034 
00038         GrayCodeChromosome(int length) : Chromosome<T>(length){}
00039 
00044         std::list<char> const getInterpretedBitstring()
00045         {
00046             /* The bitstring list (_bits) is stored with least significant
00047                bit at the first position.
00048                The Gray decoding algorithm starts at the most significant
00049                bit, so take special care of the loop direction.
00050              */
00051 
00052             /*** Decode the raw bitstring (Gray encoded) into its binary bitstring ***/
00053             return _bits;
00054         }
00055     };
00056 }
00057 #endif /* __GAL_INTCHROMOSOME_H */

Generated on Tue Oct 20 12:59:20 2009 for LabSci GALib optimisation by genetic algorithms, student version by  doxygen 1.3.9.1