00001 00020 #ifndef _SIMPLEX_H 00021 00022 #define _SIMPLEX_H 1 00023 00024 #include <realea/common/ilocalsearch.h> 00025 00026 namespace realea { 00027 00033 class Simplex : public ILocalSearch { 00034 public: 00035 Simplex(void); 00036 protected: 00037 00038 private: 00039 unsigned apply(ILSParameters *opt, tChromosomeReal &sol, tFitness &fitness, unsigned itera); 00040 ILSParameters *getInitOptions(tChromosomeReal &sol); 00041 private: 00042 00047 void calculateCentroide(void); 00048 00056 void getExtremes(ILSParameters *params, int &best_index, int &next_worst_index, int &worst_index); 00057 00065 virtual unsigned initParams(tChromosomeReal &sol, tFitness fitness, ILSParameters *param)=0; 00066 00078 tFitness move(ILSParameters *p, int posi, double factor); 00079 00080 unsigned restart_simplex(ILSParameters *params, int best, unsigned max); 00081 }; 00082 00088 class SimplexDim : public Simplex { 00097 unsigned initParams(tChromosomeReal &sol, tFitness fitness, ILSParameters *param); 00098 }; 00099 00105 class SimplexNeigh: public Simplex { 00114 unsigned initParams(tChromosomeReal &sol, tFitness fitness, ILSParameters *param); 00115 }; 00116 00117 } 00118 #endif