00001
00020 #include "funcec08.h"
00021 #include "problemcec2008f6.h"
00022
00023 using namespace realea;
00024
00025 double eval_cec2008(const tGen *x, int dim);
00026
00027
00028 ProblemCEC2008F6::ProblemCEC2008F6(unsigned int dim) {
00029 if (dim > 1000) {
00030 dim = 1000;
00031 }
00032
00033 m_ndim = dim;
00034 m_init = false;
00035 }
00036
00037 ProblemCEC2008F6::~ProblemCEC2008F6(void) {
00038 if (m_init) {
00039 finish_cec2008();
00040 }
00041 }
00042
00043
00044 void ProblemCEC2008F6::init(unsigned int fun) {
00045 if (m_init) {
00046 finish_cec2008();
00047 m_init = false;
00048 }
00049
00050 init_cec2008(fun);
00051 m_init = true;
00052 }
00053
00054 tFitness eval_pobcec2008(const tGen *x, int dim) {
00055 double result = eval_cec2008(x, dim);
00056 return result;
00057 }
00058
00059
00060 ProblemPtr ProblemCEC2008F6::get(unsigned int fun) {
00061 string name;
00062 double min, max, optime;
00063
00064
00065 init(fun);
00066 getInfo_cec2008(fun, name, min, max, optime);
00067
00068 ProblemPtr prob (new Problem());
00069 prob->setDimension(m_ndim);
00070
00071 for (unsigned i = 0; i < m_ndim; ++i) {
00072 prob->setDomainValues(i, min, max, true);
00073 }
00074
00075
00076 prob->setOptimize(0, 0);
00077 prob->setMaxEval(5000*m_ndim);
00078 prob->setMinimize();
00079
00080
00081
00082 prob->setEval(eval_pobcec2008);
00083 return prob;
00084 }