00001
00020 #ifndef _EA_H
00021
00022 #define _EA_H 1
00023
00024 #include "iea.h"
00025 #include "statistics.h"
00026 #include "cross.h"
00027
00028 using namespace std;
00029
00030
00031 namespace realea {
00032
00040 class EAlgorithm : public Resetable {
00041 public:
00047 EAlgorithm(IEAlgorithm *alg, ProblemParamPtr problem);
00048
00052 virtual ~EAlgorithm(void);
00053
00059 void setMaxEval(unsigned int maxeval);
00060
00066 virtual void setPopsize(unsigned int popsize);
00067
00071 RunningPtr getRunning(void);
00072
00081 unsigned apply(tChromosomeReal &sol, tFitness *pfitness);
00082
00083
00089 void setShow(Statistics *stat);
00090 private:
00096 void setProblem(ProblemParamPtr problem);
00097
00103 void setEval(IEval *eval);
00104
00105
00109 void setDefaultPopsize(void);
00110
00111
00112 protected:
00118
00119
00120
00121
00122 protected:
00123 IEAlgorithm *m_alg;
00124 Problem *m_problem;
00125 IEval *m_eval;
00126 const unsigned default_popsize;
00127 internal::CrossBinaryPtr m_cross;
00128 Statistics *m_stat;
00129 RunningPtr m_running;
00130 };
00131
00132 typedef EAlgorithm EA;
00133 }
00134
00135 #endif