00001
00020 #include "funcec08f7.h"
00021 #include "problemcec2008.h"
00022
00023 using namespace realea;
00024
00025 double eval_cec2008(const tGen *x, int dim);
00026
00027
00028 ProblemCEC2008::ProblemCEC2008(unsigned int dim) {
00029 if (dim > 1000) {
00030 dim = 1000;
00031 }
00032
00033 m_ndim = dim;
00034 m_init = false;
00035 }
00036
00037 ProblemCEC2008::~ProblemCEC2008(void) {
00038 if (m_init) {
00039 finish_cec2008();
00040 }
00041 }
00042
00043
00044 void ProblemCEC2008::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_cec2008f7(x, dim);
00056 return result;
00057 }
00058
00059
00060 ProblemPtr ProblemCEC2008::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 if (fun < 7) {
00076
00077 prob->setOptimize(0, 0);
00078 }
00079 else {
00080 prob->setOptimize(-8e5, 0);
00081 }
00082 prob->setMaxEval(5000*m_ndim);
00083 prob->setMinimize();
00084
00085
00086
00087 prob->setEval(eval_pobcec2008);
00088 return prob;
00089 }