AnnealingGA.h

Go to the documentation of this file.
00001 #ifndef CANNEALINGGA_H
00002 #define CANNEALINGGA_H
00003 #include <vector>
00004 #include "GeneralGA.h"
00005 #include "VecMat.h"
00006 
00007 namespace gplib
00008   {
00009     /** \addtogroup gainv Genetic algorithm optimization */
00010     /* @{ */
00011     //! AnnealingGA implements a genetic algorithm with an annealing style objective function
00012     /*! For the first AnnealingGeneration iterations the objective function is kept constant
00013      * after that the misfit is stretched  with an exponential annealing function  to focus on the minimum
00014      */
00015     class AnnealingGA: public GeneralGA
00016       {
00017     private:
00018       //! The initial "Temperature" for the Annealing function
00019       double InitTemperature;
00020       //! Before AnnealingGeneration iterations the objective function stays constant
00021       int AnnealingGeneration;
00022       //! The ratio by which the temperature is decreased
00023       double AnnealingRatio;
00024     protected:
00025       //! The implementation of Elitism for the AnnealingGA, in this case this function has no effect
00026       void virtual Elitism(const int iterationnumber);
00027     public:
00028       //! The index of the best population member
00029       int GetBestIndex();
00030       //! Set the parameters for the annealing process
00031       void SetParams(const double InitT, const int AnnealG,
00032           const double AnnealR);
00033       //! How many best models exist in this iteration, for this GA it is always 1
00034       unsigned int virtual GetNBestmodels()
00035         {
00036           return 1;
00037         } // there is one best model in each iteration
00038       //! Return the vector containing the best indices, here it has always one component equal to GetBestIndex
00039       std::vector<int> virtual GetBestModelIndices()
00040         {
00041           return std::vector<int>(1, GetBestIndex());
00042         }
00043       //! Calculate the selection probabilities given the iterationnumber, misfit and population to store the results
00044       void virtual CalcProbabilities(const int iterationnumber,
00045           gplib::rmat &LocalMisFit, GeneralPopulation &LocalPopulation);
00046       //! The constructor only passes on the parameters to GeneralGA
00047       AnnealingGA(GeneralPropagation* const LocalPropagation,
00048           GeneralPopulation* const LocalPopulation,
00049           GeneralTranscribe* const LocalTranscribe,
00050           const tObjectiveVector &IndObjective, const int nthreads = 1);
00051       virtual ~AnnealingGA();
00052       };
00053   /* @} */
00054   }
00055 #endif // CANNEALINGGA_H

Generated on Tue May 4 16:52:14 2010 for GPLIB++ by  doxygen 1.5.8