GeneralSelect.h

Go to the documentation of this file.
00001 #ifndef CGENERALSELECT_H
00002 #define CGENERALSELECT_H
00003 #include "gentypes.h"
00004 namespace gplib
00005   {
00006     /** \addtogroup gainv Genetic algorithm optimization */
00007     /* @{ */
00008 
00009     //!GeneralSelect is the abstract base class for any selection mechanism in genetic algorithms
00010     /*!GeneralSelect defines to abstract functions: Init and GetOne. Init has to be called once per iteration
00011      * and sets all the necessary parameters depending on probabilities and crowding distance
00012      * GetOne then returns the index of a selected population member and is called every time a population
00013      * member has to be selected by a selection operator.
00014      * There is no default implementation ! */
00015 
00016     class GeneralSelect
00017       {
00018     private:
00019       bool initialized;
00020       //! The abstract definition of the Init function, has to overriden
00021       virtual void DoInit()= 0;
00022       //! The abstract definition of GetOne, has to be overriden
00023       virtual size_t DoGetOne()=0;
00024     public:
00025       void Init()
00026         {
00027           DoInit();
00028           initialized = true;
00029         }
00030       size_t GetOne();
00031       GeneralSelect();
00032       virtual ~GeneralSelect();
00033       };
00034   /* @} */
00035   }
00036 #endif // CGENERALSELECT_H

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