ParetoGA.h
Go to the documentation of this file.00001 #ifndef CPARETOGA_H
00002 #define CPARETOGA_H
00003
00004 #include "GeneralGA.h"
00005 #include <iostream>
00006 #include <vector>
00007 #include "VecMat.h"
00008
00009 namespace gplib
00010 {
00011
00012
00013
00014
00015
00016
00017 class ParetoGA: public GeneralGA
00018 {
00019 private:
00020 typedef ublas::matrix_row<gplib::rmat>::const_iterator tMisfitIterator;
00021 void CalcCrowdingDistance(gplib::rmat &LocalMisFit,
00022 GeneralPopulation &LocalPopulation);
00023 std::vector<std::vector<int> > Ranks;
00024 int MaxRanks;
00025 protected:
00026
00027 void virtual Elitism(const int iterationnumber);
00028 public:
00029
00030 unsigned int virtual GetNBestmodels()
00031 {
00032 return Ranks.front().size();
00033 }
00034
00035 std::vector<int> virtual GetBestModelIndices()
00036 {
00037 return Ranks.front();
00038 }
00039
00040 void virtual CalcProbabilities(const int iterationnumber,
00041 gplib::rmat &LocalMisFit, GeneralPopulation &LocalPopulation);
00042
00043 void PrintRanks(std::ostream &output);
00044
00045 void PrintFront(std::ostream &output);
00046
00047 ParetoGA(GeneralPropagation* const LocalPropagation,
00048 GeneralPopulation* const LocalPopulation,
00049 GeneralTranscribe* const LocalTranscribe,
00050 const tObjectiveVector &IndObjective, const int nthreads = 1) :
00051 GeneralGA(LocalPropagation, LocalPopulation, LocalTranscribe,
00052 IndObjective, nthreads)
00053 {
00054 }
00055 virtual ~ParetoGA();
00056 };
00057
00058 }
00059 #endif // CPARETOGA_H