Go to the documentation of this file.00001 #ifndef NSGA_
00002 #define NSGA_
00003
00004 #include <map>
00005 #include "MixedIntegerES.h"
00006
00007
00008 typedef enum {_Dominating, _Dominated, _Nondominated, _Equals} MOComparison;
00009
00010 class NSGA_II
00011 {
00012 public:
00013 NSGA_II(unsigned n_f__ = 3);
00014 virtual ~NSGA_II() {}
00015
00017 void setNadirIdeal(vector<double>& nadir_, vector<double>& ideal_)
00018 {
00019 fixedNadirIdeal = true;
00020 nadir = nadir_;
00021 ideal = ideal_;
00022 }
00023
00025 void select(vector<Individual*>& P, vector<Individual*>& O, unsigned mu, unsigned kappa, unsigned lambda,
00026 vector<int>& direction, vector<double>& bestF);
00027 protected:
00029 unsigned n_f_, selectDimension;
00030
00032 vector<unsigned> selectFunction;
00033
00034 vector<double> nadir, ideal;
00035
00037 bool fixedNadirIdeal, dpSelection;
00038
00040 void fastNondominatedSort(vector<Individual*>& Q, vector<vector<int> >& front, vector<int>& direction, vector<double>& bestF);
00041
00043 MOComparison compare(Individual* A, Individual* B, vector<int>& direction, vector<double>& bestWorstF, bool determineValues, bool worst);
00044
00046 virtual void frontSort(vector<int>& currFront, vector<Individual*>& Q, vector<int>& direction);
00047
00049 void determineNadirIdeal(vector<int>& currFront, int frontSize, vector<Individual*>& Q, vector<int>& direction);
00050
00052 void quickSort(vector<int>& currFront, int top, int bottom,
00053 vector<Individual*>* Q, int objective, map<int, double>* distance);
00054 int partition(vector<int>& currFront, int top, int bottom,
00055 vector<Individual*>* Q, int objective, map<int, double>* distance);
00056 };
00057
00058 #endif