00001 00005 #ifndef GENETIK_EVOLUTIONARYALGORITHM 00006 #define GENETIK_EVOLUTIONARYALGORITHM 00007 00008 namespace genetiK 00009 { 00010 00011 class StopCriterion; 00012 class Population; 00013 class IndividualFactory; 00014 class SelectionMethod; 00015 00020 class EvolutionaryAlgorithm 00021 { 00022 00023 protected: 00026 StopCriterion* stopCriterion; 00029 Population* population; 00034 IndividualFactory* individualFactory; 00035 00038 SelectionMethod* selectionMethod; 00039 00042 unsigned int populationSize; 00043 00046 double crossOverProbabilty; 00047 00050 double mutationProbabilty; 00051 00056 bool elitism; 00057 00058 public: 00059 00070 EvolutionaryAlgorithm(const unsigned int populationSize,IndividualFactory* factory, 00071 StopCriterion* stopCriterion=NULL,SelectionMethod* selectionMethod = NULL, 00072 const double mutationProbability = 0.01,const double crossOverProbability = 0.7, 00073 const bool elitism=true); 00074 virtual ~EvolutionaryAlgorithm(void); 00075 00080 virtual int run(); 00081 00086 virtual int generatePopulation(); 00092 virtual int evolve(); 00097 virtual Population* getPopulation() const { return population; }; 00098 00099 }; 00100 00101 } 00102 00103 #endif