00001 #ifndef APRIORI_MIES 00002 #define APRIORI_MIES 00003 00004 #include <map> 00005 00006 #ifdef PARALLEL 00007 #include "../ParallelES/MixedIntegerES_P.h" 00009 class APriori_MIES:public MixedIntegerES_P 00010 { 00011 public: 00012 APriori_MIES(unsigned n_r_, unsigned n_z_, unsigned n_d_, unsigned n_sigma_r_, unsigned n_sigma_z_, unsigned n_prob_, unsigned n_f_, 00013 unsigned mu_, unsigned rho_, unsigned kappa_, unsigned lambda_, 00014 vector<double>& lBound_r_, vector<double>& uBound_r_, vector<int>& lBound_z_, vector<int>& uBound_z_, 00015 vector<int>& lBound_d_, vector<int>& uBound_d_, double prob_min_, double prob_max_, 00016 bool disRec_r_, bool disRec_z_, bool disRec_sigma_r_, bool disRec_sigma_z_, bool disRec_prob_, 00017 bool selfAdaptation_, vector<int>& direction_, 00018 unsigned evaluations_, vector<double>& optimalF_, 00019 double initialSigma_r_, double initialSigma_z_, double initialProb_, 00020 ifstream* initialPopFile_, int randomSeed_, bool feedback_, 00021 unsigned timeOutVal_, 00022 unsigned selectDimension_, vector<unsigned>& selectFunction_) 00023 :MixedIntegerES_P(n_r_, n_z_, n_d_, n_sigma_r_, n_sigma_z_, n_prob_, n_f_, 00024 mu_, rho_, kappa_, lambda_, 00025 lBound_r_, uBound_r_, lBound_z_, uBound_z_, 00026 lBound_d_, uBound_d_, prob_min_, prob_max_, 00027 disRec_r_, disRec_z_, disRec_sigma_r_, disRec_sigma_z_, disRec_prob_, 00028 selfAdaptation_, direction_, 00029 evaluations_, optimalF_, initialSigma_r_, initialSigma_z_, initialProb_, 00030 initialPopFile_, randomSeed_, feedback_, timeOutVal_) 00031 { selectDimension = selectDimension_; 00032 selectFunction = selectFunction_; 00033 selectFunctionActual = (selectDimension == 1) ? selectFunction[0] : n_f; } 00034 #else 00035 #include "MixedIntegerES.h" 00037 class APriori_MIES:public MixedIntegerES 00038 { 00039 public: 00040 APriori_MIES(unsigned n_r_, unsigned n_z_, unsigned n_d_, unsigned n_sigma_r_, unsigned n_sigma_z_, unsigned n_prob_, unsigned n_f_, 00041 unsigned mu_, unsigned rho_, unsigned kappa_, unsigned lambda_, 00042 vector<double>& lBound_r_, vector<double>& uBound_r_, vector<int>& lBound_z_, vector<int>& uBound_z_, 00043 vector<int>& lBound_d_, vector<int>& uBound_d_, double prob_min_, double prob_max_, 00044 bool disRec_r_, bool disRec_z_, bool disRec_sigma_r_, bool disRec_sigma_z_, bool disRec_prob_, 00045 bool selfAdaptation_, vector<int>& direction_, 00046 unsigned evaluations_, vector<double>& optimalF_, 00047 double initialSigma_r_, double initialSigma_z_, double initialProb_, 00048 ifstream* initialPopFile_, int randomSeed_, bool feedback_, 00049 unsigned timeOutVal_, 00050 unsigned selectDimension_, vector<unsigned>& selectFunction_) 00051 :MixedIntegerES(n_r_, n_z_, n_d_, n_sigma_r_, n_sigma_z_, n_prob_, n_f_, 00052 mu_, rho_, kappa_, lambda_, 00053 lBound_r_, uBound_r_, lBound_z_, uBound_z_, 00054 lBound_d_, uBound_d_, prob_min_, prob_max_, 00055 disRec_r_, disRec_z_, disRec_sigma_r_, disRec_sigma_z_, disRec_prob_, 00056 selfAdaptation_, direction_, 00057 evaluations_, optimalF_, initialSigma_r_, initialSigma_z_, initialProb_, 00058 initialPopFile_, randomSeed_, feedback_) 00059 { selectDimension = selectDimension_; 00060 selectFunction = selectFunction_; 00061 selectFunctionActual = (selectDimension == 1) ? selectFunction[0] : n_f; } 00062 #endif 00063 virtual ~APriori_MIES() {} 00064 00065 protected: 00067 unsigned selectDimension; 00068 00070 vector<unsigned> selectFunction; 00071 00075 unsigned selectFunctionActual; 00076 00078 virtual void simulate(Individual* I) = 0; 00079 00081 virtual void writePop(time_t id) = 0; 00082 00084 void select(); 00085 00087 void quickSort(vector<int>& indices, int top, int bottom, vector<Individual*>* Q, int objective); 00088 int partition(vector<int>& indices, int top, int bottom, vector<Individual*>* Q, int objective); 00089 00091 void determineBestF(); 00092 00094 virtual void writeLog(time_t elapsed, time_t id) = 0; 00095 00097 bool optimumReached(); 00098 }; 00099 00100 #endif