00001 #ifndef CGENERALPROPAGATION_H 00002 #define CGENERALPROPAGATION_H 00003 #include "GeneralSelect.h" 00004 #include "GeneralPopulation.h" 00005 #include "GeneralRNG.h" 00006 namespace gplib 00007 { 00008 /** \addtogroup gainv Genetic algorithm optimization */ 00009 /* @{ */ 00010 00011 //! The base class for genetic algorithm propagation methods 00012 /*! This class defines the common functionality that is necessary 00013 * to generate a new population from the current generation. The implementation 00014 * details depend on the type of GA and Population encoding and those classes 00015 * have to match to do anything useful. 00016 */ 00017 class GeneralPropagation 00018 { 00019 protected: 00020 virtual void Crossover(tpopmember &father, tpopmember &mother); 00021 virtual void Mutation(tpopmember &child); 00022 GeneralSelect* const Select; 00023 GeneralPopulation* const Population; 00024 GeneralRNG* const Random; 00025 double MutationProb; 00026 double CrossoverProb; 00027 public: 00028 virtual void NextGeneration() = 0; 00029 void SetParams(const double mutation, const double crossover) 00030 { 00031 MutationProb = mutation; 00032 CrossoverProb = crossover; 00033 } 00034 ; 00035 GeneralPropagation(GeneralSelect* const LocalSelect, 00036 GeneralPopulation* const LocalPopulation, 00037 GeneralRNG* const LocalRandom); 00038 virtual ~GeneralPropagation(); 00039 GeneralPropagation(GeneralPropagation &Old); 00040 }; 00041 /* @} */ 00042 } 00043 #endif // CGENERALPROPAGATION_H
1.5.8