• Main Page
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members

MultiObjectiveFunctions.cpp

Go to the documentation of this file.
00001 //===========================================================================
00037 //===========================================================================
00038 
00039 
00040 #include <EALib/MultiObjectiveFunctions.h>
00041 #include <LinAlg/LinAlg.h>
00042 
00043 
00044 bool BhinKornConstraintHandler::isFeasible(double* const& point) const
00045 {
00046     unsigned int i;
00047     for (i = 0; i < m_dimension; i++) if (point[i] > 20.0 || point[i] < -20.0) return false;
00048     if ((pow(point[0], 2) + pow(point[1], 2) - 255.0) > 0) return false;
00049     else if (point[0] + 3*point[1] + 10.0 > 0) return false;
00050 
00051     return true;
00052 }
00053 
00054 
00056 
00057 
00058 BhinKorn::BhinKorn() : ObjectiveFunctionVS<double>(2, new BhinKornConstraintHandler())
00059 {
00060     m_name = "BhinKorn";
00061 }
00062 
00063 BhinKorn::~BhinKorn()
00064 {
00065     if (constrainthandler != NULL)
00066         delete constrainthandler;
00067 }
00068 
00069 
00070 unsigned int BhinKorn::objectives() const
00071 {
00072     return 2;
00073 }
00074 
00075 void BhinKorn::result(double* const& point, std::vector<double>& value)
00076 {
00077 
00078     value.resize(2);
00079     value[0] = pow(point[0] - 2.0, 2) + pow(point[1] - 1.0, 2) + 2.0;
00080     value[1] = 9 * point[0] - pow(point[1] - 1.0, 2);
00081 
00082     m_timesCalled++;
00083 }
00084 
00085 bool BhinKorn::ProposeStartingPoint(double*& point) const
00086 {
00087     for (unsigned int i = 0; i < m_dimension; i++)
00088         point[i] = Rng::uni(-6.0, 6.0);
00089 
00090     return true;
00091 }
00092 
00093 bool BhinKorn::utopianFitness(std::vector<double>& value) const
00094 {
00095     return false;       // TODO
00096 }
00097 
00098 bool BhinKorn::nadirFitness(std::vector<double>& value) const
00099 {
00100     value.resize(2);
00101     value[0] = 0.0;
00102     value[1] = 144.0;
00103     return true;
00104 }
00105 
00106 
00108 
00109 
00110 Schaffer::Schaffer() : ObjectiveFunctionVS<double>(1, new BoxConstraintHandler(1, -6.0, 6.0))
00111 {
00112     m_name = "Schaffer`s f2";
00113 }
00114 
00115 Schaffer::~Schaffer()
00116 {
00117     if (constrainthandler != NULL)
00118         delete constrainthandler;
00119 }
00120 
00121 
00122 unsigned int Schaffer::objectives() const
00123 {
00124     return 2;
00125 }
00126 
00127 void Schaffer::result(double* const& point, std::vector<double>& value)
00128 {
00129 
00130     value.resize(2);
00131     value[0] = pow(point[0], 2);
00132     value[1] = pow((point[0] - 2), 2);
00133 
00134     m_timesCalled++;
00135 }
00136 
00137 bool Schaffer::ProposeStartingPoint(double*& point) const
00138 {
00139 
00140     for (unsigned int i = 0; i < m_dimension; i++)
00141         point[i] = Rng::uni(-6.0, 6.0);
00142 
00143     return true;
00144 }
00145 
00146 bool Schaffer::utopianFitness(std::vector<double>& value) const
00147 {
00148     return false;       // TODO
00149 }
00150 
00151 bool Schaffer::nadirFitness(std::vector<double>& value) const
00152 {
00153     value.resize(2);
00154     value[0] = 36.0;
00155     value[1] = 64.0;
00156     return true;
00157 }
00158 
00159 
00161 
00162 
00163 ZDT1::ZDT1(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
00164 {
00165     m_name = "ZDT1";
00166 }
00167 
00168 ZDT1::~ZDT1()
00169 {
00170     if (constrainthandler != NULL)
00171         delete constrainthandler;
00172 }
00173 
00174 
00175 unsigned int ZDT1::objectives() const
00176 {
00177     return 2;
00178 }
00179 
00180 void ZDT1::result(double* const& point, std::vector<double>& value)
00181 {
00182 
00183     value.resize(2);
00184     value[0] = point[0];
00185 
00186     double g, h, sum = 0.0;
00187 
00188     for (unsigned i = 1; i < m_dimension; i++)
00189         sum += point[i];
00190 
00191     sum /= (m_dimension - 1.0);
00192 
00193     g = 1.0 + (9.0 * sum);
00194     h = 1.0 - sqrt(point[0] / g);
00195 
00196     value[1] = g * h;
00197 
00198     m_timesCalled++;
00199 }
00200 
00201 bool ZDT1::ProposeStartingPoint(double*& point) const
00202 {
00203 
00204     for (unsigned int i = 0; i < m_dimension; i++)
00205         point[i] = Rng::uni(0.0, 1.0);
00206 
00207     return true;
00208 }
00209 
00210 bool ZDT1::utopianFitness(std::vector<double>& value) const
00211 {
00212     return false;       // TODO
00213 }
00214 
00215 bool ZDT1::nadirFitness(std::vector<double>& value) const
00216 {
00217     value.resize(2);
00218     value[0] = 1.0;
00219     value[1] = 10.0;
00220     return true;
00221 }
00222 
00223 
00225 
00226 
00227 ZDT2::ZDT2(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
00228 {
00229     m_name = "ZDT2";
00230 }
00231 
00232 ZDT2::~ZDT2()
00233 {
00234     if (constrainthandler != NULL)
00235         delete constrainthandler;
00236 }
00237 
00238 
00239 unsigned int ZDT2::objectives() const
00240 {
00241     return 2;
00242 }
00243 
00244 void ZDT2::result(double* const& point, std::vector<double>& value)
00245 {
00246 
00247     value.resize(2);
00248     value[0] = point[0];
00249 
00250     double g, h, sum = 0.0;
00251 
00252     for (unsigned i = 1; i < m_dimension; i++)
00253         sum += point[i];
00254 
00255     sum /= (m_dimension - 1.0);
00256 
00257     g = 1.0 + (9.0 * sum);
00258     h = 1.0 - pow((point[0] / g), 2);
00259 
00260     value[1] = g * h;
00261 
00262     m_timesCalled++;
00263 }
00264 
00265 bool ZDT2::ProposeStartingPoint(double*& point) const
00266 {
00267 
00268     for (unsigned int i = 0; i < m_dimension; i++)
00269         point[i] = Rng::uni(0.0, 1.0);
00270 
00271     return true;
00272 }
00273 
00274 bool ZDT2::utopianFitness(std::vector<double>& value) const
00275 {
00276     return false;       // TODO
00277 }
00278 
00279 bool ZDT2::nadirFitness(std::vector<double>& value) const
00280 {
00281     value.resize(2);
00282     value[0] = 1.0;
00283     value[1] = 10.0;
00284     return true;
00285 }
00286 
00287 
00289 
00290 
00291 ZDT3::ZDT3(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
00292 {
00293     m_name = "ZDT3";
00294 }
00295 
00296 ZDT3::~ZDT3()
00297 {
00298     if (constrainthandler != NULL)
00299         delete constrainthandler;
00300 }
00301 
00302 
00303 unsigned int ZDT3::objectives() const
00304 {
00305     return 2;
00306 }
00307 
00308 void ZDT3::result(double* const& point, std::vector<double>& value)
00309 {
00310 
00311     value.resize(2);
00312     value[0] = point[0];
00313 
00314     double g, h, sum = 0.0;
00315 
00316     for (unsigned i = 1; i < m_dimension; i++)
00317         sum += point[i];
00318 
00319     sum /= (m_dimension - 1.0);
00320 
00321     g = 1.0 + (9.0 * sum);
00322     h = 1.0 - sqrt(point[0] / g) - (point[0] / g) * sin(10 * M_PI * point[0]);
00323 
00324     value[1] = g * h;
00325 
00326     m_timesCalled++;
00327 }
00328 
00329 bool ZDT3::ProposeStartingPoint(double*& point) const
00330 {
00331     for (unsigned int i = 0; i < m_dimension; i++)
00332         point[i] = Rng::uni(0.0, 1.0);
00333 
00334     return true;
00335 }
00336 
00337 bool ZDT3::utopianFitness(std::vector<double>& value) const
00338 {
00339     return false;       // TODO
00340 }
00341 
00342 bool ZDT3::nadirFitness(std::vector<double>& value) const
00343 {
00344     value.resize(2);
00345     value[0] = 1.0;
00346     value[1] = 10.0;
00347     return true;
00348 }
00349 
00350 
00352 
00353 
00354 ZDT4::ZDT4(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, -5.0, 5.0, 0, 0.0, 1.0))
00355 {
00356     m_name = "ZDT4";
00357 }
00358 
00359 ZDT4::~ZDT4()
00360 {
00361     if (constrainthandler != NULL)
00362         delete constrainthandler;
00363 }
00364 
00365 unsigned int ZDT4::objectives() const
00366 {
00367     return 2;
00368 }
00369 
00370 void ZDT4::result(double* const& point, std::vector<double>& value)
00371 {
00372 
00373     value.resize(2);
00374     value[0] = point[0];
00375 
00376     double g, h, sum = 0.0;
00377 
00378     for (unsigned i = 1; i < m_dimension; i++)
00379         sum += pow(point[i], 2) - (10.0 * cos(4 * M_PI * point[i]));
00380 
00381     g = 1.0 + (10.0 * (m_dimension - 1.0)) + sum;
00382     h = 1.0 - sqrt(point[0] / g);
00383 
00384     value[1] = g * h;
00385 
00386     m_timesCalled++;
00387 }
00388 
00389 bool ZDT4::ProposeStartingPoint(double*& point) const
00390 {
00391 
00392     point[0] = Rng::uni(0.0, 1.0);
00393 
00394     for (unsigned int i = 1; i < m_dimension; i++)
00395         point[i] = Rng::uni(-5.0, 5.0);
00396 
00397     return true;
00398 }
00399 
00400 bool ZDT4::utopianFitness(std::vector<double>& value) const
00401 {
00402     return false;       // TODO
00403 }
00404 
00405 bool ZDT4::nadirFitness(std::vector<double>& value) const
00406 {
00407     value.resize(2);
00408     value[0] = 1.0;
00409     value[1] = 1.0 + 10.0 * m_dimension;
00410     return true;
00411 }
00412 
00413 
00415 
00416 
00417 // /**
00418 //  * \todo grenzen richtigrum?
00419 //  */
00420 // bool CuboidConstraintHandler::isFeasible(const double*& point) const
00421 // {
00422 //  if (point[0] < m_lower_1 || point[0] > m_upper_1)
00423 //      return false;
00424 // 
00425 //  for (unsigned i = 1; i < m_dimension; i++)
00426 //      if (point[i] < m_lower_2 || point[i] > m_upper_2)
00427 //          return false;
00428 // 
00429 //  return true;
00430 // }
00431 
00432 // /**
00433 //  * \todo grenzen richtigrum?
00434 //  */
00435 // bool CuboidConstraintHandler::closestFeasible(double*& point) const
00436 // {
00437 //  if (point[0] < m_lower_1)
00438 //      point[0] = m_lower_1;
00439 //  else if (point[0] > m_upper_1)
00440 //      point[0] = m_upper_1;
00441 // 
00442 //  for (unsigned i = 1; i < m_dimension; i++)
00443 //  {
00444 //      if (point[i] < m_lower_2)
00445 //          point[i] = m_lower_2;
00446 //      else if (point[i] > m_upper_2)
00447 //          point[i] = m_upper_2;
00448 //  }
00449 // 
00450 //  return true;
00451 // }
00452 
00453 
00455 
00456 
00457 ZDT5::ZDT5(unsigned d) : ObjectiveFunctionVS<long>(d, new ZDT5ConstraintHandler(d, 0, long(0x3fffffff), 0, long(0x0000001f)))
00458 {
00459     m_name = "ZDT5";
00460 }
00461 
00462 ZDT5::~ZDT5()
00463 {
00464     if (constrainthandler != NULL)
00465         delete constrainthandler;
00466 }
00467 
00468 
00469 unsigned int ZDT5::objectives() const
00470 {
00471     return 2;
00472 }
00473 
00474 void ZDT5::result(long* const& point, std::vector<double>& value)
00475 {
00476 
00477     value.resize(2);
00478     value[0] = 1.0 + u(point[0]);
00479 
00480     double sum = 0.0;
00481 
00482     for (unsigned i = 1; i < m_dimension; i++)
00483     {
00484         if (u(point[i]) < 5)
00485             sum += 2 + u(point[i]);
00486         else
00487             sum += 1;
00488     }
00489 
00490     value[1] = sum * 1 / value[0];
00491 
00492     m_timesCalled++;
00493 }
00494 
00495 bool ZDT5::ProposeStartingPoint(long*& point) const
00496 {
00497 
00498     point[0] = (int) Rng::uni(0, 0x3fffffff);
00499 
00500     for (unsigned i = 1; i < m_dimension; i++)
00501         point[i] = (int) Rng::uni(0, 0x0000001f);
00502 
00503     return true;
00504 }
00505 
00506 unsigned ZDT5::u(long x) const
00507 {
00508 
00509     unsigned bits = 0;
00510 
00511     for (unsigned i = 0; i < 8 * sizeof(x); i++, x >>= 1)
00512         if (x % 2)
00513             bits++;
00514 
00515     return bits;
00516 }
00517 
00518 
00520 
00521 
00522 bool ZDT5ConstraintHandler::isFeasible(long* const& point) const
00523 {
00524     if (point[0] < m_lower_1 || point[0] > m_upper_1)
00525         return false;
00526 
00527     for (unsigned i = 1; i < m_dimension; i++)
00528         if (point[i] < m_lower_2 || point[i] > m_upper_2)
00529             return false;
00530 
00531     return true;
00532 }
00533 
00534 bool ZDT5ConstraintHandler::closestFeasible(long*& point) const
00535 {
00536     if (point[0] < m_lower_1)
00537         point[0] = m_lower_1;
00538     else if (point[0] > m_upper_1)
00539         point[0] = m_upper_1;
00540 
00541     for (unsigned i = 1; i < m_dimension; i++)
00542     {
00543         if (point[i] < m_lower_2)
00544             point[i] = m_lower_2;
00545         else if (point[i] > m_upper_2)
00546             point[i] = m_upper_2;
00547     }
00548 
00549     return true;
00550 }
00551 
00552 
00554 
00555 
00556 ZDT6::ZDT6(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
00557 {
00558     m_name = "ZDT6";
00559 }
00560 
00561 ZDT6::~ZDT6()
00562 {
00563     if (constrainthandler != NULL)
00564         delete constrainthandler;
00565 }
00566 
00567 
00568 unsigned int ZDT6::objectives() const
00569 {
00570     return 2;
00571 }
00572 
00573 void ZDT6::result(double* const& point, std::vector<double>& value)
00574 {
00575 
00576     value.resize(2);
00577 
00578     value[0] = 1.0 - exp(-4.0 * point[0]) * pow(sin(6 * M_PI * point[0]), 6);
00579 
00580     double g, h, sum = 0.0;
00581 
00582     for (unsigned i = 1; i < m_dimension; i++)
00583         sum += point[i];
00584 
00585     sum /= (m_dimension - 1.0);
00586 
00587     g = 1.0 + 9.0 * pow(sum, 0.25);
00588     h = 1.0 - pow(value[0] / g, 2);
00589 
00590     value[1] = g * h;
00591 
00592     m_timesCalled++;
00593 }
00594 
00595 bool ZDT6::ProposeStartingPoint(double*& point) const
00596 {
00597 
00598     for (unsigned int i = 0; i < m_dimension; i++)
00599         point[i] = Rng::uni(0.0, 1.0);
00600 
00601     return true;
00602 }
00603 
00604 bool ZDT6::utopianFitness(std::vector<double>& value) const
00605 {
00606     return false;       // TODO
00607 }
00608 
00609 bool ZDT6::nadirFitness(std::vector<double>& value) const
00610 {
00611     value.resize(2);
00612     value[0] = 1.0;
00613     value[1] = 10.0;
00614     return true;
00615 }
00616 
00617 
00619 
00620 
00621 IHR1::IHR1(unsigned d): ObjectiveFunctionVS<double>(d , new BoxConstraintHandler(d, -1, 1)), m_Transformation(0, 0)
00622 {
00623     m_name = "IHR1";
00624     initRandomRotation();
00625 }
00626 
00627 IHR1::~IHR1()
00628 {
00629     if (constrainthandler != NULL)
00630         delete constrainthandler;
00631 }
00632 
00633 
00634 unsigned int IHR1::objectives() const
00635 {
00636     return 2;
00637 }
00638 
00639 void IHR1::result(double* const& point, std::vector<double>& value)
00640 {
00641 
00642     value.resize(2);
00643 
00644     std::vector<double> y(m_dimension);
00645     transform(point, y);
00646 
00647     value[0] = fabs(y[0]);
00648 
00649     double g = 0;
00650     double ymax = fabs(m_Transformation(0, 0));
00651 
00652     for (unsigned i = 1; i < m_dimension; i++)
00653         ymax = std::max(fabs(m_Transformation(0, i)), ymax);
00654     ymax = 1 / ymax;
00655 
00656     for (unsigned i = 1; i < m_dimension; i++)
00657         g += hg(y[i]);
00658     g = 9 * g / (m_dimension - 1.) + 1.;
00659 
00660     value[1] = g * hf(1. - sqrt(h(y[0], m_dimension) / g), y[0], ymax);
00661 
00662     m_timesCalled++;
00663 }
00664 
00665 bool IHR1::ProposeStartingPoint(double*& point) const
00666 {
00667 
00668     for (unsigned int i = 0; i < m_dimension; i++)
00669         point[i] = Rng::uni(-1.0, 1.0);
00670 
00671     return true;
00672 }
00673 
00674 bool IHR1::utopianFitness(std::vector<double>& value) const
00675 {
00676     return false;       // TODO
00677 }
00678 
00679 bool IHR1::nadirFitness(std::vector<double>& value) const
00680 {
00681     value.resize(2);
00682     value[0] = 1.0;
00683     value[1] = 10.0;
00684     return true;
00685 }
00686 
00687 void IHR1::initRandomRotation()
00688 {
00689 
00690     unsigned i, j, c;
00691     Matrix H(m_dimension, m_dimension);
00692     m_Transformation.resize(m_dimension, m_dimension);
00693     for (i = 0; i < m_dimension; i++)
00694     {
00695         for (c = 0; c < m_dimension; c++)
00696         {
00697             H(i, c) = Rng::gauss(0, 1);
00698         }
00699     }
00700     m_Transformation = H;
00701     for (i = 0; i < m_dimension; i++)
00702     {
00703         for (j = 0; j < i; j++)
00704             for (c = 0; c < m_dimension; c++)
00705 //              m_Transformation(i, c) -= scalarProduct(H[i], H[j]) * H(j, c) / scalarProduct(H[j], H[j]);
00706                 m_Transformation(i, c) -= (H[i] * H[j]) * H(j, c) / (H[j].norm2());
00707         H = m_Transformation;
00708     }
00709     for (i = 0; i < m_dimension; i++)
00710     {
00711         double normB = m_Transformation[i].norm();
00712         for (j = 0; j < m_dimension; j++)
00713             m_Transformation(i, j) = m_Transformation(i, j) / normB;
00714     }
00715 }
00716 
00717 void IHR1::transform(const double* in, std::vector<double>& out) const
00718 {
00719     unsigned i, j;
00720     out.resize(m_dimension);
00721     for (i = 0; i < m_dimension; i++)
00722     {
00723         out[i] = 0.0;
00724         for (j = 0; j < m_dimension; j++)
00725             out[i] += m_Transformation(j, i) * in[j];
00726     }
00727 }
00728 
00729 double IHR1::h(double x, double n)
00730 {
00731     return 1 / (1 + exp(-x / sqrt(n)));
00732 }
00733 
00734 double IHR1::hf(double x, double y0, double ymax)
00735 {
00736     if (fabs(y0) <=  ymax)
00737         return x;
00738     return fabs(y0) + 1;
00739 }
00740 
00741 double IHR1::hg(double x)
00742 {
00743     return (x*x) / (fabs(x) + 0.1);
00744 }
00745 
00746 
00748 
00749 
00750 IHR2::IHR2(unsigned d): ObjectiveFunctionVS<double>(d , new BoxConstraintHandler(d, -1.0, 1.0)), m_Transformation(0, 0)
00751 {
00752     m_name = "IHR2";
00753     initRandomRotation();
00754 }
00755 
00756 IHR2::~IHR2()
00757 {
00758     if (constrainthandler != NULL)
00759         delete constrainthandler;
00760 }
00761 
00762 
00763 unsigned int IHR2::objectives() const
00764 {
00765     return 2;
00766 }
00767 
00768 void IHR2::result(double* const& point, std::vector<double>& value)
00769 {
00770 
00771     value.resize(2);
00772 
00773     std::vector<double> y(m_dimension);
00774     transform(point, y);
00775 
00776     value[0] = fabs(y[0]);
00777 
00778     double g = 0;
00779     double ymax = fabs(m_Transformation(0, 0));
00780 
00781     for (unsigned i = 1; i < m_dimension; i++)
00782         ymax = std::max(fabs(m_Transformation(0, i)), ymax);
00783     ymax = 1 / ymax;
00784 
00785     for (unsigned i = 1; i < m_dimension; i++)
00786         g += hg(y[i]);
00787     g = 9 * g / (m_dimension - 1.) + 1.;
00788 
00789 
00790     value[1] = g * hf(1. - Shark::sqr(y[0] / g), y[0], ymax);
00791 
00792     m_timesCalled++;
00793 }
00794 
00795 bool IHR2::ProposeStartingPoint(double*& point) const
00796 {
00797 
00798     for (unsigned int i = 0; i < m_dimension; i++)
00799         point[i] = Rng::uni(-1.0, 1.0);
00800 
00801     return true;
00802 }
00803 
00804 bool IHR2::utopianFitness(std::vector<double>& value) const
00805 {
00806     return false;       // TODO
00807 }
00808 
00809 bool IHR2::nadirFitness(std::vector<double>& value) const
00810 {
00811     value.resize(2);
00812     value[0] = 1.0;
00813     value[1] = 10.0;
00814     return true;
00815 }
00816 
00817 void IHR2::initRandomRotation()
00818 {
00819 
00820     unsigned i, j, c;
00821     Matrix H(m_dimension, m_dimension);
00822     m_Transformation.resize(m_dimension, m_dimension);
00823     for (i = 0; i < m_dimension; i++)
00824     {
00825         for (c = 0; c < m_dimension; c++)
00826         {
00827             H(i, c) = Rng::gauss(0, 1);
00828         }
00829     }
00830     m_Transformation = H;
00831     for (i = 0; i < m_dimension; i++)
00832     {
00833         for (j = 0; j < i; j++)
00834             for (c = 0; c < m_dimension; c++)
00835 //              m_Transformation(i, c) -= scalarProduct(H[i], H[j]) * H(j, c) / scalarProduct(H[j], H[j]);
00836                 m_Transformation(i, c) -= (H[i] * H[j]) * H(j, c) / (H[j].norm2());
00837         H = m_Transformation;
00838     }
00839     for (i = 0; i < m_dimension; i++)
00840     {
00841         double normB = m_Transformation[i].norm();
00842         for (j = 0; j < m_dimension; j++)
00843             m_Transformation(i, j) = m_Transformation(i, j) / normB;
00844     }
00845 }
00846 
00847 void IHR2::transform(const double* in, std::vector<double>& out) const
00848 {
00849     unsigned i, j;
00850     out.resize(m_dimension);
00851     for (i = 0; i < m_dimension; i++)
00852     {
00853         out[i] = 0.0;
00854         for (j = 0; j < m_dimension; j++)
00855             out[i] += m_Transformation(j, i) * in[j];
00856     }
00857 }
00858 
00859 double IHR2::hf(double x, double y0, double ymax)
00860 {
00861     if (fabs(y0) <=  ymax)
00862         return x;
00863     return fabs(y0) + 1;
00864 }
00865 
00866 double IHR2::hg(double x)
00867 {
00868     return (x*x) / (fabs(x) + 0.1);
00869 }
00870 
00871 
00873 
00874 
00875 IHR3::IHR3(unsigned d): ObjectiveFunctionVS<double>(d , new BoxConstraintHandler(d, -1.0, 1.0)), m_Transformation(0, 0)
00876 {
00877     m_name = "IHR3";
00878     initRandomRotation();
00879 }
00880 
00881 IHR3::~IHR3()
00882 {
00883     if (constrainthandler != NULL)
00884         delete constrainthandler;
00885 }
00886 
00887 
00888 unsigned int IHR3::objectives() const
00889 {
00890     return 2;
00891 }
00892 
00893 void IHR3::result(double* const& point, std::vector<double>& value)
00894 {
00895 
00896     value.resize(2);
00897 
00898     std::vector<double> y(m_dimension);
00899     transform(point, y);
00900 
00901     value[0] = fabs(y[0]);
00902 
00903     double g = 0;
00904     double ymax = fabs(m_Transformation(0, 0));
00905 
00906     for (unsigned i = 1; i < m_dimension; i++)
00907         ymax = std::max(fabs(m_Transformation(0, i)), ymax);
00908     ymax = 1 / ymax;
00909 
00910     for (unsigned i = 1; i < m_dimension; i++)
00911         g += hg(y[i]);
00912     g = 9 * g / (m_dimension - 1.) + 1.;
00913 
00914 
00915     value[1] = g * hf(1. - sqrt(h(y[0], m_dimension) / g) - h(y[0], m_dimension) / g * sin(10 * M_PI * y[0]), y[0], ymax);
00916 
00917     m_timesCalled++;
00918 }
00919 
00920 bool IHR3::ProposeStartingPoint(double*& point) const
00921 {
00922 
00923     for (unsigned int i = 0; i < m_dimension; i++)
00924         point[i] = Rng::uni(-1.0, 1.0);
00925 
00926     return true;
00927 }
00928 
00929 bool IHR3::utopianFitness(std::vector<double>& value) const
00930 {
00931     return false;       // TODO
00932 }
00933 
00934 bool IHR3::nadirFitness(std::vector<double>& value) const
00935 {
00936     value.resize(2);
00937     value[0] = 1.0;
00938     value[1] = 10.0;
00939     return true;
00940 }
00941 
00942 void IHR3::initRandomRotation()
00943 {
00944 
00945     unsigned i, j, c;
00946     Matrix H(m_dimension, m_dimension);
00947     m_Transformation.resize(m_dimension, m_dimension);
00948     for (i = 0; i < m_dimension; i++)
00949     {
00950         for (c = 0; c < m_dimension; c++)
00951         {
00952             H(i, c) = Rng::gauss(0, 1);
00953         }
00954     }
00955     m_Transformation = H;
00956     for (i = 0; i < m_dimension; i++)
00957     {
00958         for (j = 0; j < i; j++)
00959             for (c = 0; c < m_dimension; c++)
00960 //              m_Transformation(i, c) -= scalarProduct(H[i], H[j]) * H(j, c) / scalarProduct(H[j], H[j]);
00961                 m_Transformation(i, c) -= (H[i] * H[j]) * H(j, c) / (H[j].norm2());
00962         H = m_Transformation;
00963     }
00964     for (i = 0; i < m_dimension; i++)
00965     {
00966         double normB = m_Transformation[i].norm();
00967         for (j = 0; j < m_dimension; j++)
00968             m_Transformation(i, j) = m_Transformation(i, j) / normB;
00969     }
00970 }
00971 
00972 void IHR3::transform(const double* in, std::vector<double>& out) const
00973 {
00974     unsigned i, j;
00975     out.resize(m_dimension);
00976     for (i = 0; i < m_dimension; i++)
00977     {
00978         out[i] = 0.0;
00979         for (j = 0; j < m_dimension; j++)
00980             out[i] += m_Transformation(j, i) * in[j];
00981     }
00982 }
00983 
00984 double IHR3::h(double x, double n)
00985 {
00986     return 1 / (1 + exp(-x / sqrt(n)));
00987 }
00988 
00989 double IHR3::hf(double x, double y0, double ymax)
00990 {
00991     if (fabs(y0) <=  ymax)
00992         return x;
00993     return fabs(y0) + 1;
00994 }
00995 
00996 double IHR3::hg(double x)
00997 {
00998     return (x*x) / (fabs(x) + 0.1);
00999 }
01000 
01001 
01003 
01004 
01005 IHR6::IHR6(unsigned d): ObjectiveFunctionVS<double>(d , new BoxConstraintHandler(d, -1.0, 1.0)), m_Transformation(0, 0)
01006 {
01007     m_name = "IHR6";
01008     initRandomRotation();
01009 }
01010 
01011 IHR6::~IHR6()
01012 {
01013     if (constrainthandler != NULL)
01014         delete constrainthandler;
01015 }
01016 
01017 
01018 unsigned int IHR6::objectives() const
01019 {
01020     return 2;
01021 }
01022 
01023 void IHR6::result(double* const& point, std::vector<double>& value)
01024 {
01025 
01026     value.resize(2);
01027 
01028     std::vector<double> y(m_dimension);
01029     transform(point, y);
01030 
01031     value[0] = 1 - exp(-4 * fabs(y[0])) * pow(sin(6 * M_PI * y[0]), 6);
01032 
01033     double g = 0;
01034     double ymax = fabs(m_Transformation(0, 0));
01035 
01036     for (unsigned i = 1; i < m_dimension; i++)
01037         ymax = std::max(fabs(m_Transformation(0, i)), ymax);
01038     ymax = 1 / ymax;
01039 
01040     for (unsigned i = 1; i < m_dimension; i++)
01041         g += hg(y[i]);
01042 
01043     g = 1 + 9 * pow(g / (m_dimension - 1.0), 0.25);
01044 
01045     value[1] = g * hf(1. - Shark::sqr(value[0] / g), y[0], ymax);
01046 
01047     m_timesCalled++;
01048 }
01049 
01050 bool IHR6::ProposeStartingPoint(double*& point) const
01051 {
01052 
01053     for (unsigned int i = 0; i < m_dimension; i++)
01054         point[i] = Rng::uni(-1.0, 1.0);
01055 
01056     return true;
01057 }
01058 
01059 bool IHR6::utopianFitness(std::vector<double>& value) const
01060 {
01061     return false;       // TODO
01062 }
01063 
01064 bool IHR6::nadirFitness(std::vector<double>& value) const
01065 {
01066     value.resize(2);
01067     value[0] = 1.0;
01068     value[1] = 10.0;
01069     return true;
01070 }
01071 
01072 void IHR6::initRandomRotation()
01073 {
01074 
01075     unsigned i, j, c;
01076     Matrix H(m_dimension, m_dimension);
01077     m_Transformation.resize(m_dimension, m_dimension);
01078     for (i = 0; i < m_dimension; i++)
01079     {
01080         for (c = 0; c < m_dimension; c++)
01081         {
01082             H(i, c) = Rng::gauss(0, 1);
01083         }
01084     }
01085     m_Transformation = H;
01086     for (i = 0; i < m_dimension; i++)
01087     {
01088         for (j = 0; j < i; j++)
01089             for (c = 0; c < m_dimension; c++)
01090 //              m_Transformation(i, c) -= scalarProduct(H[i], H[j]) * H(j, c) / scalarProduct(H[j], H[j]);
01091                 m_Transformation(i, c) -= (H[i] * H[j]) * H(j, c) / (H[j].norm2());
01092         H = m_Transformation;
01093     }
01094     for (i = 0; i < m_dimension; i++)
01095     {
01096         double normB = m_Transformation[i].norm();
01097         for (j = 0; j < m_dimension; j++)
01098             m_Transformation(i, j) = m_Transformation(i, j) / normB;
01099     }
01100 }
01101 
01102 void IHR6::transform(const double* in, std::vector<double>& out) const
01103 {
01104     unsigned i, j;
01105     out.resize(m_dimension);
01106     for (i = 0; i < m_dimension; i++)
01107     {
01108         out[i] = 0.0;
01109         for (j = 0; j < m_dimension; j++)
01110             out[i] += m_Transformation(j, i) * in[j];
01111     }
01112 }
01113 
01114 double IHR6::hf(double x, double y0, double ymax)
01115 {
01116     if (fabs(y0) <=  ymax)
01117         return x;
01118     return fabs(y0) + 1;
01119 }
01120 
01121 double IHR6::hg(double x)
01122 {
01123     return (x*x) / (fabs(x) + 0.1);
01124 }
01125 
01126 
01128 
01129 
01130 ZZJ07_F1 :: ZZJ07_F1(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01131 {
01132     m_name = "ZZJ07_F1";
01133 }
01134 
01135 ZZJ07_F1::~ZZJ07_F1()
01136 {
01137     if (constrainthandler != NULL)
01138         delete constrainthandler;
01139 }
01140 
01141 
01142 unsigned int ZZJ07_F1::objectives() const
01143 {
01144     return 2;
01145 }
01146 
01147 void ZZJ07_F1::result(double* const& point, std::vector<double>& value)
01148 {
01149 
01150     value.resize(2);
01151     value[0] = point[0];
01152 
01153     double g, h, sum = 0.0;
01154 
01155     for (unsigned i = 1; i < m_dimension; i++)
01156         sum += (point[i] - point[0]) * (point[i] - point[0]);
01157 
01158     sum /= (m_dimension - 1.0);
01159 
01160     g = 1.0 + (9.0 * sum);
01161     h = 1.0 - sqrt(point[0] / g);
01162 
01163     value[1] = g * h;
01164 
01165     m_timesCalled++;
01166 }
01167 
01168 bool ZZJ07_F1::ProposeStartingPoint(double*& point) const
01169 {
01170 
01171     for (unsigned int i = 0; i < m_dimension; i++)
01172         point[i] = Rng::uni(0.0, 1.0);
01173 
01174     return true;
01175 }
01176 
01177 bool ZZJ07_F1::utopianFitness(std::vector<double>& value) const
01178 {
01179     return false;       // TODO
01180 }
01181 
01182 bool ZZJ07_F1::nadirFitness(std::vector<double>& value) const
01183 {
01184     value.resize(2);
01185     value[0] = 1.0;
01186     value[1] = 10.0;
01187     return true;
01188 }
01189 
01190 
01192 
01193 
01194 ZZJ07_F2 :: ZZJ07_F2(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01195 {
01196     m_name = "ZZJ07_F2";
01197 }
01198 
01199 ZZJ07_F2::~ZZJ07_F2()
01200 {
01201     if (constrainthandler != NULL)
01202         delete constrainthandler;
01203 }
01204 
01205 
01206 unsigned int ZZJ07_F2::objectives() const
01207 {
01208     return 2;
01209 }
01210 
01211 void ZZJ07_F2::result(double* const& point, std::vector<double>& value)
01212 {
01213 
01214     value.resize(2);
01215     value[0] = point[0];
01216 
01217     double g, h, sum = 0.0;
01218 
01219     for (unsigned i = 1; i < m_dimension; i++)
01220         sum += (point[i] - point[0]) * (point[i] - point[0]);
01221 
01222     sum /= (m_dimension - 1.0);
01223 
01224     g = 1.0 + (9.0 * sum);
01225     h = 1.0 -  pow((point[0] / g), 2);
01226 
01227     value[1] = g * h;
01228 
01229     m_timesCalled++;
01230 }
01231 
01232 bool ZZJ07_F2::ProposeStartingPoint(double*& point) const
01233 {
01234 
01235     for (unsigned int i = 0; i < m_dimension; i++)
01236         point[i] = Rng::uni(0.0, 1.0);
01237 
01238     return true;
01239 }
01240 
01241 bool ZZJ07_F2::utopianFitness(std::vector<double>& value) const
01242 {
01243     return false;       // TODO
01244 }
01245 
01246 bool ZZJ07_F2::nadirFitness(std::vector<double>& value) const
01247 {
01248     value.resize(2);
01249     value[0] = 1.0;
01250     value[1] = 10.0;
01251     return true;
01252 }
01253 
01254 
01256 
01257 
01258 ZZJ07_F3 :: ZZJ07_F3(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01259 {
01260     m_name = "ZZJ07_F3";
01261 }
01262 
01263 ZZJ07_F3::~ZZJ07_F3()
01264 {
01265     if (constrainthandler != NULL)
01266         delete constrainthandler;
01267 }
01268 
01269 
01270 unsigned int ZZJ07_F3::objectives() const
01271 {
01272     return 2;
01273 }
01274 
01275 void ZZJ07_F3::result(double* const& point, std::vector<double>& value)
01276 {
01277 
01278     value.resize(2);
01279     value[0] = 1.0 - exp(-4.0 * point[0]) * pow(sin(6 * M_PI * point[0]), 6);
01280 
01281     double g, h, sum = 0.0;
01282 
01283     for (unsigned i = 1; i < m_dimension; i++)
01284         sum += (point[i] - point[0]) * (point[i] - point[0]);
01285 
01286     sum /= 9;
01287 
01288     g = 1.0 + 9.0 * pow(sum, 0.25);
01289     h = 1.0 -  pow((value[0] / g), 2);
01290 
01291     value[1] = g * h;
01292 
01293     m_timesCalled++;
01294 }
01295 
01296 bool ZZJ07_F3::ProposeStartingPoint(double*& point) const
01297 {
01298 
01299     for (unsigned int i = 0; i < m_dimension; i++)
01300         point[i] = Rng::uni(0.0, 1.0);
01301 
01302     return true;
01303 }
01304 
01305 bool ZZJ07_F3::utopianFitness(std::vector<double>& value) const
01306 {
01307     return false;       // TODO
01308 }
01309 
01310 bool ZZJ07_F3::nadirFitness(std::vector<double>& value) const
01311 {
01312     value.resize(2);
01313     value[0] = 1.0;
01314     value[1] = 10.0;
01315     return true;
01316 }
01317 
01318 
01320 
01321 
01322 ZZJ07_F4 :: ZZJ07_F4(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01323 {
01324     m_name = "ZZJ07_F4";
01325 }
01326 
01327 ZZJ07_F4::~ZZJ07_F4()
01328 {
01329     if (constrainthandler != NULL)
01330         delete constrainthandler;
01331 }
01332 
01333 
01334 unsigned int ZZJ07_F4::objectives() const
01335 {
01336     return 3;
01337 }
01338 
01339 void ZZJ07_F4::result(double* const& point, std::vector<double>& value)
01340 {
01341 
01342     value.resize(3);
01343 
01344     double g = 0.0;
01345 
01346     for (unsigned i = 2; i < m_dimension; i++)
01347         g += (point[i] - point[0]) * (point[i] - point[0]);
01348 
01349     value[0] = cos(0.5 * M_PI * point[0]) * cos(0.5 * M_PI * point[1]) * (1 + g) ;
01350     value[1] = cos(0.5 * M_PI * point[0]) * sin(0.5 * M_PI * point[1]) * (1 + g) ;
01351     value[2] = sin(0.5 * M_PI * point[0]) * (1 + g) ;
01352 
01353     m_timesCalled++;
01354 }
01355 
01356 bool ZZJ07_F4::ProposeStartingPoint(double*& point) const
01357 {
01358 
01359     for (unsigned int i = 0; i < m_dimension; i++)
01360         point[i] = Rng::uni(0.0, 1.0);
01361 
01362     return true;
01363 }
01364 
01365 bool ZZJ07_F4::utopianFitness(std::vector<double>& value) const
01366 {
01367     return false;       // TODO
01368 }
01369 
01370 bool ZZJ07_F4::nadirFitness(std::vector<double>& value) const
01371 {
01372     value.resize(3);
01373     value[0] = m_dimension - 1.0;
01374     value[1] = m_dimension - 1.0;
01375     value[2] = m_dimension - 1.0;
01376     return true;
01377 }
01378 
01379 
01381 
01382 
01383 ZZJ07_F5 :: ZZJ07_F5(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01384 {
01385     m_name = "ZZJ07_F5";
01386 }
01387 
01388 ZZJ07_F5::~ZZJ07_F5()
01389 {
01390     if (constrainthandler != NULL)
01391         delete constrainthandler;
01392 }
01393 
01394 
01395 unsigned int ZZJ07_F5::objectives() const
01396 {
01397     return 2;
01398 }
01399 
01400 void ZZJ07_F5::result(double* const& point, std::vector<double>& value)
01401 {
01402 
01403     value.resize(2);
01404     value[0] = point[0];
01405 
01406     double g, h, sum = 0.0;
01407 
01408     for (unsigned i = 1; i < m_dimension; i++)
01409         sum += (point[i] * point[i] - point[0]) * (point[i] * point[i] - point[0]);
01410 
01411     sum /= (m_dimension - 1.0);
01412 
01413     g = 1.0 + (9.0 * sum);
01414     h = 1.0 - sqrt(point[0] / g);
01415 
01416     value[1] = g * h;
01417 
01418     m_timesCalled++;
01419 }
01420 
01421 bool ZZJ07_F5::ProposeStartingPoint(double*& point) const
01422 {
01423 
01424     for (unsigned int i = 0; i < m_dimension; i++)
01425         point[i] = Rng::uni(0.0, 1.0);
01426 
01427     return true;
01428 }
01429 
01430 bool ZZJ07_F5::utopianFitness(std::vector<double>& value) const
01431 {
01432     return false;       // TODO
01433 }
01434 
01435 bool ZZJ07_F5::nadirFitness(std::vector<double>& value) const
01436 {
01437     value.resize(2);
01438     value[0] = 1.0;
01439     value[1] = 10.0;
01440     return true;
01441 }
01442 
01443 
01445 
01446 
01447 ZZJ07_F6 :: ZZJ07_F6(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01448 {
01449     m_name = "ZZJ07_F6";
01450 }
01451 
01452 ZZJ07_F6::~ZZJ07_F6()
01453 {
01454     if (constrainthandler != NULL)
01455         delete constrainthandler;
01456 }
01457 
01458 
01459 unsigned int ZZJ07_F6::objectives() const
01460 {
01461     return 2;
01462 }
01463 
01464 void ZZJ07_F6::result(double* const& point, std::vector<double>& value)
01465 {
01466 
01467     value.resize(2);
01468     value[0] = sqrt(point[0]);
01469 
01470     double g, h, sum = 0.0;
01471 
01472     for (unsigned i = 1; i < m_dimension; i++)
01473         sum += (point[i] * point[i] - point[0]) * (point[i] * point[i] - point[0]);
01474 
01475     sum /= (m_dimension - 1.0);
01476 
01477     g = 1.0 + (9.0 * sum);
01478     h = 1.0 -  pow((value[0] / g), 2);
01479 
01480     value[1] = g * h;
01481 
01482     m_timesCalled++;
01483 }
01484 
01485 bool ZZJ07_F6::ProposeStartingPoint(double*& point) const
01486 {
01487 
01488     for (unsigned int i = 0; i < m_dimension; i++)
01489         point[i] = Rng::uni(0.0, 1.0);
01490 
01491     return true;
01492 }
01493 
01494 bool ZZJ07_F6::utopianFitness(std::vector<double>& value) const
01495 {
01496     return false;       // TODO
01497 }
01498 
01499 bool ZZJ07_F6::nadirFitness(std::vector<double>& value) const
01500 {
01501     value.resize(2);
01502     value[0] = 1.0;
01503     value[1] = 10.0;
01504     return true;
01505 }
01506 
01507 
01509 
01510 
01511 ZZJ07_F7 :: ZZJ07_F7(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01512 {
01513     m_name = "ZZJ07_F7";
01514 }
01515 
01516 ZZJ07_F7::~ZZJ07_F7()
01517 {
01518     if (constrainthandler != NULL)
01519         delete constrainthandler;
01520 }
01521 
01522 
01523 unsigned int ZZJ07_F7::objectives() const
01524 {
01525     return 2;
01526 }
01527 
01528 void ZZJ07_F7:: result(double* const& point, std::vector<double>& value)
01529 {
01530 
01531     value.resize(2);
01532     value[0] = 1.0 - exp(-4.0 * point[0]) * pow(sin(6 * M_PI * point[0]), 6);
01533 
01534     double g, h, sum = 0.0;
01535 
01536     for (unsigned i = 1; i < m_dimension; i++)
01537         sum += (point[i] * point[i] - point[0]) * (point[i] * point[i] - point[0]);
01538 
01539     sum /= 9;
01540 
01541     g = 1.0 + 9.0 * pow(sum, 0.25);
01542     h = 1.0 -  pow((value[0] / g), 2);
01543 
01544     value[1] = g * h;
01545 
01546     m_timesCalled++;
01547 }
01548 
01549 bool ZZJ07_F7::ProposeStartingPoint(double*& point) const
01550 {
01551 
01552     for (unsigned int i = 0; i < m_dimension; i++)
01553         point[i] = Rng::uni(0.0, 1.0);
01554 
01555     return true;
01556 }
01557 
01558 bool ZZJ07_F7::utopianFitness(std::vector<double>& value) const
01559 {
01560     return false;       // TODO
01561 }
01562 
01563 bool ZZJ07_F7::nadirFitness(std::vector<double>& value) const
01564 {
01565     value.resize(2);
01566     value[0] = 1.0;
01567     value[1] = 10.0;
01568     return true;
01569 }
01570 
01571 
01573 
01574 
01575 ZZJ07_F8 :: ZZJ07_F8(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01576 {
01577     m_name = "ZZJ07_F8";
01578 }
01579 
01580 ZZJ07_F8::~ZZJ07_F8()
01581 {
01582     if (constrainthandler != NULL)
01583         delete constrainthandler;
01584 }
01585 
01586 
01587 unsigned int ZZJ07_F8::objectives() const
01588 {
01589     return 3;
01590 }
01591 
01592 void ZZJ07_F8::result(double* const& point, std::vector<double>& value)
01593 {
01594 
01595     value.resize(3);
01596 
01597     double g = 0.0;
01598 
01599     for (unsigned i = 2; i < m_dimension; i++)
01600         g += (point[i] * point[i] - point[0]) * (point[i] * point[i] - point[0]);
01601 
01602     value[0] = cos(0.5 * M_PI * point[0]) * cos(0.5 * M_PI * point[1]) * (1 + g) ;
01603     value[1] = cos(0.5 * M_PI * point[0]) * sin(0.5 * M_PI * point[1]) * (1 + g) ;
01604     value[2] = sin(0.5 * M_PI * point[0]) * (1 + g) ;
01605 
01606     m_timesCalled++;
01607 }
01608 
01609 bool ZZJ07_F8::ProposeStartingPoint(double*& point) const
01610 {
01611 
01612     for (unsigned int i = 0; i < m_dimension; i++)
01613         point[i] = Rng::uni(0.0, 1.0);
01614 
01615     return true;
01616 }
01617 
01618 bool ZZJ07_F8::utopianFitness(std::vector<double>& value) const
01619 {
01620     return false;       // TODO
01621 }
01622 
01623 bool ZZJ07_F8::nadirFitness(std::vector<double>& value) const
01624 {
01625     value.resize(3);
01626     value[0] = m_dimension - 1.0;
01627     value[1] = m_dimension - 1.0;
01628     value[2] = m_dimension - 1.0;
01629     return true;
01630 }
01631 
01632 
01634 
01635 
01636 ZZJ07_F9 :: ZZJ07_F9(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 10.0, 0, 0.0, 1.0))
01637 {
01638     m_name = "ZZJ07_F9";
01639 }
01640 
01641 ZZJ07_F9::~ZZJ07_F9()
01642 {
01643     if (constrainthandler != NULL)
01644         delete constrainthandler;
01645 }
01646 
01647 
01648 unsigned int ZZJ07_F9::objectives() const
01649 {
01650     return 2;
01651 }
01652 
01653 void ZZJ07_F9::result(double* const& point, std::vector<double>& value)
01654 {
01655 
01656     value.resize(2);
01657     value[0] = point[0];
01658 
01659     double g, h, sum = 0.0, prod = 0.0;
01660 
01661     for (unsigned i = 1; i < m_dimension; i++)
01662         sum += (point[i] * point[i] - point[0]) * (point[i] * point[i] - point[0]);
01663 
01664     for (unsigned i = 1; i < m_dimension; i++)
01665         prod *= cos((point[i] * point[i] - point[0]) / sqrt((double)i));
01666 
01667     g = sum / 4000.0 - prod + 2.0;
01668 
01669     h = 1.0 - sqrt(point[0] / g);
01670 
01671     value[1] = g * h;
01672 
01673     m_timesCalled++;
01674 }
01675 
01676 bool ZZJ07_F9::ProposeStartingPoint(double*& point) const
01677 {
01678 
01679     point[0] = Rng::uni(0.0, 1.0);
01680     for (unsigned int i = 1; i < m_dimension; i++)
01681         point[i] = Rng::uni(0.0, 10.0);
01682 
01683     return true;
01684 }
01685 
01686 bool ZZJ07_F9::utopianFitness(std::vector<double>& value) const
01687 {
01688     return false;       // TODO
01689 }
01690 
01691 bool ZZJ07_F9::nadirFitness(std::vector<double>& value) const
01692 {
01693     value.resize(2);
01694     value[0] = 1.0;
01695     value[1] = m_dimension / 40.0 + 2.0;
01696     return true;
01697 }
01698 
01699 
01701 
01702 
01703 ZZJ07_F10 :: ZZJ07_F10(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 10.0, 0, 0.0, 1.0))
01704 {
01705     m_name = "ZZJ07_F10";
01706 }
01707 
01708 ZZJ07_F10::~ZZJ07_F10()
01709 {
01710     if (constrainthandler != NULL)
01711         delete constrainthandler;
01712 }
01713 
01714 
01715 unsigned int ZZJ07_F10::objectives() const
01716 {
01717     return 2;
01718 }
01719 
01720 void ZZJ07_F10::result(double* const& point, std::vector<double>& value)
01721 {
01722 
01723     value.resize(2);
01724     value[0] = point[0];
01725 
01726     double g, h, sum = 0.0;
01727 
01728     for (unsigned i = 1; i < m_dimension; i++)
01729         sum += (point[i] * point[i] - point[0]) * (point[i] * point[i] - point[0]) - 10 * cos(2.0 * M_PI * (point[i] * point[i] - point[0]));
01730 
01731     g = 1.0 + 10.0 * (m_dimension - 1.0) + sum;
01732     h = 1.0 - sqrt(point[0] / g);
01733 
01734     value[1] = g * h;
01735 
01736     m_timesCalled++;
01737 }
01738 
01739 bool ZZJ07_F10::ProposeStartingPoint(double*& point) const
01740 {
01741 
01742     point[0] = Rng::uni(0.0, 1.0);
01743     for (unsigned int i = 1; i < m_dimension; i++)
01744         point[i] = Rng::uni(0.0, 10.0);
01745 
01746     return true;
01747 }
01748 
01749 bool ZZJ07_F10::utopianFitness(std::vector<double>& value) const
01750 {
01751     return false;       // TODO
01752 }
01753 
01754 bool ZZJ07_F10::nadirFitness(std::vector<double>& value) const
01755 {
01756     value.resize(2);
01757     value[0] = 1.0;
01758     value[1] = 1.0 + 121.0 * (m_dimension - 1.0);
01759     return true;
01760 }
01761 
01762 
01764 
01765 
01766 LZ06_F1::LZ06_F1(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01767 {
01768     m_name = "LZ06_F1";
01769 }
01770 
01771 LZ06_F1::~LZ06_F1()
01772 {
01773     if (constrainthandler != NULL)
01774         delete constrainthandler;
01775 }
01776 
01777 
01778 unsigned int LZ06_F1::objectives() const
01779 {
01780     return 2;
01781 }
01782 
01783 void LZ06_F1::result(double* const& point, std::vector<double>& value)
01784 {
01785 
01786     value.resize(2);
01787     value[0] = point[0];
01788 
01789     double g, h, sum = 0.0;
01790 
01791     for (unsigned i = 1; i < m_dimension; i++)
01792         sum += fabs(point[0] - sin(0.5 * point[i] * M_PI));
01793 
01794     g = 1.0 + sum / (m_dimension - 1.0);
01795     h = 1.0 - sqrt(point[0] / g);
01796 
01797     value[1] = h;
01798 
01799     m_timesCalled++;
01800 }
01801 
01802 bool LZ06_F1::ProposeStartingPoint(double*& point) const
01803 {
01804 
01805     for (unsigned i = 0; i < m_dimension; i++)
01806         point[i] = Rng::uni(0.0, 1.0);
01807 
01808     return true;
01809 }
01810 
01811 bool LZ06_F1::utopianFitness(std::vector<double>& value) const
01812 {
01813     return false;       // TODO
01814 }
01815 
01816 bool LZ06_F1::nadirFitness(std::vector<double>& value) const
01817 {
01818     value.resize(2);
01819     value[0] = 1.0;
01820     value[1] = 1.0;
01821     return true;
01822 }
01823 
01824 
01826 
01827 
01828 LZ06_F2::LZ06_F2(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01829 {
01830     m_name = "LZ06_F2";
01831 }
01832 
01833 LZ06_F2::~LZ06_F2()
01834 {
01835     if (constrainthandler != NULL)
01836         delete constrainthandler;
01837 }
01838 
01839 
01840 unsigned int LZ06_F2::objectives() const
01841 {
01842     return 2;
01843 }
01844 
01845 void LZ06_F2::result(double* const& point, std::vector<double>& value)
01846 {
01847 
01848     value.resize(2);
01849     value[0] = point[0];
01850 
01851     double g, h, sum = 0.0;
01852 
01853     for (unsigned i = 1; i < m_dimension; i++)
01854         sum += fabs(point[0] - sin(0.5 * point[i] * M_PI));
01855 
01856     g = 1.0 + sum / (m_dimension - 1.0);
01857     h = 1.0 - pow(point[0] / g, 2.0);
01858 
01859     value[1] = h;
01860 
01861     m_timesCalled++;
01862 }
01863 
01864 bool LZ06_F2::ProposeStartingPoint(double*& point) const
01865 {
01866 
01867     for (unsigned i = 0; i < m_dimension; i++)
01868         point[i] = Rng::uni(0.0, 1.0);
01869 
01870     return true;
01871 }
01872 
01873 bool LZ06_F2::utopianFitness(std::vector<double>& value) const
01874 {
01875     return false;       // TODO
01876 }
01877 
01878 bool LZ06_F2::nadirFitness(std::vector<double>& value) const
01879 {
01880     value.resize(2);
01881     value[0] = 1.0;
01882     value[1] = 1.0;
01883     return true;
01884 }
01885 
01886 
01888 
01889 
01890 LZ07_F1::LZ07_F1(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
01891 {
01892     m_name = "LZ07_F1";
01893 }
01894 
01895 LZ07_F1::~LZ07_F1()
01896 {
01897     if (constrainthandler != NULL)
01898         delete constrainthandler;
01899 }
01900 
01901 
01902 unsigned int LZ07_F1::objectives() const
01903 {
01904     return 2;
01905 }
01906 
01907 void LZ07_F1::result(double* const& point, std::vector<double>& value)
01908 {
01909 
01910     value.resize(2);
01911 
01912     double cardNum_J1, cardNum_J2 ;
01913     cardNum_J1 = floor((m_dimension - 1.0) / 2.0);
01914     cardNum_J2 = ceil((m_dimension - 1.0) / 2.0);
01915 
01916     double  sum1 = 0.0, sum2 = 0.0;
01917 
01918     for (unsigned i = 2; i < m_dimension; i += 2)
01919         sum1 += pow(point[i] - pow(point[0], 0.5 * (1.0 + 3 * (i - 1) / (m_dimension - 2))), 2);
01920 
01921     for (unsigned i = 1; i < m_dimension; i += 2)
01922         sum2 += pow(point[i] - pow(point[0], 0.5 * (1.0 + 3 * (i - 1) / (m_dimension - 2))), 2);
01923 
01924     value[0] = point[0] + 2 / cardNum_J1 * sum1 ;
01925 
01926     value[1] = 1 - sqrt(point[0]) + 2 / cardNum_J2 * sum2 ;
01927 
01928     m_timesCalled++;
01929 }
01930 
01931 bool LZ07_F1::ProposeStartingPoint(double*& point) const
01932 {
01933 
01934     for (unsigned i = 0; i < m_dimension; i++)
01935         point[i] = Rng::uni(0.0, 1.0);
01936 
01937     return true;
01938 }
01939 
01940 bool LZ07_F1::utopianFitness(std::vector<double>& value) const
01941 {
01942     return false;       // TODO
01943 }
01944 
01945 bool LZ07_F1::nadirFitness(std::vector<double>& value) const
01946 {
01947     value.resize(2);
01948     value[0] = 3.0;
01949     value[1] = 3.0;
01950     return true;
01951 }
01952 
01953 
01955 
01956 
01957 LZ07_F2::LZ07_F2(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, -1.0, 1.0, 0, 0.0, 1.0))
01958 {
01959     m_name = "LZ07_F2";
01960 }
01961 
01962 LZ07_F2::~LZ07_F2()
01963 {
01964     if (constrainthandler != NULL)
01965         delete constrainthandler;
01966 }
01967 
01968 
01969 unsigned int LZ07_F2::objectives() const
01970 {
01971     return 2;
01972 }
01973 
01974 void LZ07_F2::result(double* const& point, std::vector<double>& value)
01975 {
01976 
01977     value.resize(2);
01978 
01979     double cardNum_J1, cardNum_J2 ;
01980     cardNum_J1 = floor((m_dimension - 1.0) / 2.0);
01981     cardNum_J2 = ceil((m_dimension - 1.0) / 2.0);
01982 
01983     double  sum1 = 0.0, sum2 = 0.0;
01984 
01985     for (unsigned i = 2; i < m_dimension; i += 2)
01986         sum1 += pow(point[i] - sin(6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
01987 
01988     for (unsigned i = 1; i < m_dimension; i += 2)
01989         sum2 += pow(point[i] - sin(6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
01990 
01991     value[0] = point[0] + 2 / cardNum_J1 * sum1 ;
01992 
01993     value[1] = 1 - sqrt(point[0]) + 2 / cardNum_J2 * sum2 ;
01994 
01995     m_timesCalled++;
01996 }
01997 
01998 bool LZ07_F2::ProposeStartingPoint(double*& point) const
01999 {
02000 
02001     point[0] = Rng::uni(0.0, 1.0);
02002     for (unsigned i = 1; i < m_dimension; i++)
02003         point[i] = Rng::uni(-1.0, 1.0);
02004 
02005     return true;
02006 }
02007 
02008 bool LZ07_F2::utopianFitness(std::vector<double>& value) const
02009 {
02010     return false;       // TODO
02011 }
02012 
02013 bool LZ07_F2::nadirFitness(std::vector<double>& value) const
02014 {
02015     value.resize(2);
02016     value[0] = 9.0;
02017     value[1] = 9.0;
02018     return true;
02019 }
02020 
02021 
02023 
02024 
02025 LZ07_F3::LZ07_F3(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, -1.0, 1.0, 0, 0.0, 1.0))
02026 {
02027     m_name = "LZ07_F3";
02028 }
02029 
02030 LZ07_F3::~LZ07_F3()
02031 {
02032     if (constrainthandler != NULL)
02033         delete constrainthandler;
02034 }
02035 
02036 
02037 unsigned int LZ07_F3::objectives() const
02038 {
02039     return 2;
02040 }
02041 
02042 void LZ07_F3::result(double* const& point, std::vector<double>& value)
02043 {
02044 
02045     value.resize(2);
02046 
02047     double cardNum_J1, cardNum_J2 ;
02048     cardNum_J1 = floor((m_dimension - 1.0) / 2.0);
02049     cardNum_J2 = ceil((m_dimension - 1.0) / 2.0);
02050 
02051     double  sum1 = 0.0, sum2 = 0.0;
02052 
02053     for (unsigned i = 2; i < m_dimension; i += 2)
02054         sum1 += pow(point[i] - 0.8 * point[0] * cos(6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02055 
02056     for (unsigned i = 1; i < m_dimension; i += 2)
02057         sum2 += pow(point[i] - 0.8 * point[0] * sin(6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02058 
02059     value[0] = point[0] + 2 / cardNum_J1 * sum1 ;
02060 
02061     value[1] = 1 - sqrt(point[0]) + 2 / cardNum_J2 * sum2 ;
02062 
02063     m_timesCalled++;
02064 }
02065 
02066 bool LZ07_F3::ProposeStartingPoint(double*& point) const
02067 {
02068 
02069     point[0] = Rng::uni(0.0, 1.0);
02070     for (unsigned i = 1; i < m_dimension; i++)
02071         point[i] = Rng::uni(-1.0, 1.0);
02072 
02073     return true;
02074 }
02075 
02076 bool LZ07_F3::utopianFitness(std::vector<double>& value) const
02077 {
02078     return false;       // TODO
02079 }
02080 
02081 bool LZ07_F3::nadirFitness(std::vector<double>& value) const
02082 {
02083     value.resize(2);
02084     value[0] = 7.48;
02085     value[1] = 7.48;
02086     return true;
02087 }
02088 
02089 
02091 
02092 
02093 LZ07_F4::LZ07_F4(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, -1.0, 1.0, 0, 0.0, 1.0))
02094 {
02095     m_name = "LZ07_F4";
02096 }
02097 
02098 LZ07_F4::~LZ07_F4()
02099 {
02100     if (constrainthandler != NULL)
02101         delete constrainthandler;
02102 }
02103 
02104 
02105 unsigned int LZ07_F4::objectives() const
02106 {
02107     return 2;
02108 }
02109 
02110 void LZ07_F4::result(double* const& point, std::vector<double>& value)
02111 {
02112 
02113     value.resize(2);
02114 
02115     double cardNum_J1, cardNum_J2 ;
02116     cardNum_J1 = floor((m_dimension - 1.0) / 2.0);
02117     cardNum_J2 = ceil((m_dimension - 1.0) / 2.0);
02118 
02119     double  sum1 = 0.0, sum2 = 0.0;
02120 
02121     for (unsigned i = 2; i < m_dimension; i += 2)
02122         sum1 += pow(point[i] - 0.8 * point[0] * cos((6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension)) / 3, 2);
02123 
02124     for (unsigned i = 1; i < m_dimension; i += 2)
02125         sum2 += pow(point[i] - 0.8 * point[0] * sin(6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02126 
02127     value[0] = point[0] + 2 / cardNum_J1 * sum1 ;
02128 
02129     value[1] = 1 - sqrt(point[0]) + 2 / cardNum_J2 * sum2 ;
02130 
02131     m_timesCalled++;
02132 }
02133 
02134 bool LZ07_F4::ProposeStartingPoint(double*& point) const
02135 {
02136 
02137     point[0] = Rng::uni(0.0, 1.0);
02138     for (unsigned i = 1; i < m_dimension; i++)
02139         point[i] = Rng::uni(-1.0, 1.0);
02140 
02141     return true;
02142 }
02143 
02144 bool LZ07_F4::utopianFitness(std::vector<double>& value) const
02145 {
02146     return false;       // TODO
02147 }
02148 
02149 bool LZ07_F4::nadirFitness(std::vector<double>& value) const
02150 {
02151     value.resize(2);
02152     value[0] = 7.48;
02153     value[1] = 7.48;
02154     return true;
02155 }
02156 
02157 
02159 
02160 
02161 LZ07_F5::LZ07_F5(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, -1.0, 1.0, 0, 0.0, 1.0))
02162 {
02163     m_name = "LZ07_F5";
02164 }
02165 
02166 LZ07_F5::~LZ07_F5()
02167 {
02168     if (constrainthandler != NULL)
02169         delete constrainthandler;
02170 }
02171 
02172 
02173 unsigned int LZ07_F5::objectives() const
02174 {
02175     return 2;
02176 }
02177 
02178 void LZ07_F5::result(double* const& point, std::vector<double>& value)
02179 {
02180 
02181     value.resize(2);
02182 
02183     double cardNum_J1, cardNum_J2 ;
02184     cardNum_J1 = floor((m_dimension - 1.0) / 2.0);
02185     cardNum_J2 = ceil((m_dimension - 1.0) / 2.0);
02186 
02187     double  sum1 = 0.0, sum2 = 0.0;
02188 
02189     for (unsigned i = 2; i < m_dimension; i += 2)
02190         sum1 += pow(point[i] - 0.3 * point[0] * (point[0] * cos(4 * (6 * M_PI * point[0] + (i + 1) *
02191                     M_PI / m_dimension)) + 2) * sin(6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02192 
02193     for (unsigned i = 1; i < m_dimension; i += 2)
02194         sum2 += pow(point[i] - 0.3 * point[0] * (point[0] * cos(4 * (6 * M_PI * point[0] + (i + 1) *
02195                     M_PI / m_dimension)) + 2) * cos(6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02196 
02197     value[0] = point[0] + 2 / cardNum_J1 * sum1 ;
02198 
02199     value[1] = 1 - sqrt(point[0]) + 2 / cardNum_J2 * sum2 ;
02200 
02201     m_timesCalled++;
02202 }
02203 
02204 bool LZ07_F5::ProposeStartingPoint(double*& point) const
02205 {
02206 
02207     point[0] = Rng::uni(0.0, 1.0);
02208     for (unsigned i = 1; i < m_dimension; i++)
02209         point[i] = Rng::uni(-1.0, 1.0);
02210 
02211     return true;
02212 }
02213 
02214 bool LZ07_F5::utopianFitness(std::vector<double>& value) const
02215 {
02216     return false;       // TODO
02217 }
02218 
02219 bool LZ07_F5::nadirFitness(std::vector<double>& value) const
02220 {
02221     value.resize(2);
02222     value[0] = 8.22;
02223     value[1] = 8.22;
02224     return true;
02225 }
02226 
02227 
02229 
02230 
02231 LZ07_F6::LZ07_F6(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, -2.0, 2.0, 0, 0.0, 1.0, 1, 0.0, 1.0))
02232 {
02233     m_name = "LZ07_F6";
02234 }
02235 
02236 LZ07_F6::~LZ07_F6()
02237 {
02238     if (constrainthandler != NULL)
02239         delete constrainthandler;
02240 }
02241 
02242 
02243 unsigned int LZ07_F6::objectives() const
02244 {
02245     return 3;
02246 }
02247 
02248 void LZ07_F6::result(double* const& point, std::vector<double>& value)
02249 {
02250 
02251     value.resize(3);
02252 
02253     double cardNum_J1, cardNum_J2 , cardNum_J3;
02254     cardNum_J1 = floor((m_dimension - 1.0) / 3.0);
02255     cardNum_J2 = floor((m_dimension - 2.0) / 3.0);
02256     cardNum_J3 = floor(m_dimension / 3.0);
02257 
02258     double  sum1 = 0.0, sum2 = 0.0, sum3 = 0.0;
02259 
02260     for (unsigned i = 3; i < m_dimension; i += 3)
02261         sum1 += pow(point[i] - 2.0 * point[1] * sin(2.0 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02262 
02263     for (unsigned i = 4; i < m_dimension; i += 3)
02264         sum2 += pow(point[i] - 2.0 * point[1] * sin(2.0 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02265 
02266     for (unsigned i = 2; i < m_dimension; i += 3)
02267         sum3 += pow(point[i] - 2.0 * point[1] * sin(2.0 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02268 
02269     value[0] = cos(0.5 * point[0] * M_PI) * cos(0.5 * point[1] * M_PI) + 2 / cardNum_J1 * sum1;
02270 
02271     value[1] = cos(0.5 * point[0] * M_PI) * sin(0.5 * point[1] * M_PI) + 2 / cardNum_J2 * sum2;
02272 
02273     value[2] = sin(0.5 * point[0] * M_PI) + 2 / cardNum_J3 * sum3;
02274 
02275     m_timesCalled++;
02276 }
02277 
02278 bool LZ07_F6::ProposeStartingPoint(double*& point) const
02279 {
02280 
02281     point[0] = Rng::uni(0.0, 1.0);
02282     point[1] = Rng::uni(0.0, 1.0);
02283     for (unsigned i = 2; i < m_dimension; i++)
02284         point[i] = Rng::uni(-2.0, 2.0);
02285 
02286     return true;
02287 }
02288 
02289 bool LZ07_F6::utopianFitness(std::vector<double>& value) const
02290 {
02291     return false;       // TODO
02292 }
02293 
02294 bool LZ07_F6::nadirFitness(std::vector<double>& value) const
02295 {
02296     value.resize(2);
02297     value[0] = 33.0;
02298     value[1] = 33.0;
02299     return true;
02300 }
02301 
02302 
02304 
02305 
02306 // bool CuboidConstraintHandler_2::isFeasible(const double*& point) const
02307 // {
02308 //  if (point[0] < m_lower_1 || point[0] > m_upper_1)
02309 //      return false;
02310 // 
02311 //  if (point[1] < m_lower_1 || point[1] > m_upper_1)
02312 //      return false;
02313 // 
02314 //  for (unsigned i = 2; i < m_dimension; i++)
02315 //      if (point[i] < m_lower_2 || point[i] > m_upper_2)
02316 //          return false;
02317 // 
02318 //  return true;
02319 // }
02320 // 
02321 // bool CuboidConstraintHandler_2::closestFeasible(double*& point) const
02322 // {
02323 //  if (point[0] < m_lower_1)
02324 //      point[0] = m_lower_1;
02325 //  else if (point[0] > m_upper_1)
02326 //      point[0] = m_upper_1;
02327 // 
02328 //  if (point[1] < m_lower_1)
02329 //      point[1] = m_lower_1;
02330 //  else if (point[1] > m_upper_1)
02331 //      point[1] = m_upper_1;
02332 // 
02333 //  for (unsigned i = 2; i < m_dimension; i++)
02334 //  {
02335 //      if (point[i] < m_lower_2)
02336 //          point[i] = m_lower_2;
02337 //      else if (point[i] > m_upper_2)
02338 //          point[i] = m_upper_2;
02339 //  }
02340 // 
02341 //  return true;
02342 // }
02343 
02344 
02346 
02347 
02348 LZ07_F7::LZ07_F7(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
02349 {
02350     m_name = "LZ07_F7";
02351 }
02352 
02353 LZ07_F7::~LZ07_F7()
02354 {
02355     if (constrainthandler != NULL)
02356         delete constrainthandler;
02357 }
02358 
02359 
02360 unsigned int LZ07_F7::objectives() const
02361 {
02362     return 2;
02363 }
02364 
02365 void LZ07_F7::result(double* const& point, std::vector<double>& value)
02366 {
02367 
02368     value.resize(2);
02369 
02370     double cardNum_J1, cardNum_J2 ;
02371     cardNum_J1 = floor((m_dimension - 1.0) / 2.0);
02372     cardNum_J2 = ceil((m_dimension - 1.0) / 2.0);
02373 
02374     double  sum1 = 0.0, sum2 = 0.0;
02375 
02376     double y_i;
02377     for (unsigned i = 2; i < m_dimension; i += 2)
02378     {
02379         y_i = point[i] - pow(point[0], 0.5 * (1.0 + 3 * (i - 1) / (m_dimension - 2)));
02380         sum1 += 4 * pow(y_i, 2) - cos(8 * y_i * M_PI) + 1.0;
02381     }
02382     for (unsigned i = 1; i < m_dimension; i += 2)
02383     {
02384         y_i = point[i] - pow(point[0], 0.5 * (1.0 + 3 * (i - 1) / (m_dimension - 2)));
02385         sum2 += 4 * pow(y_i, 2) - cos(8 * y_i * M_PI) + 1.0;
02386     }
02387     value[0] = point[0] + 2 / cardNum_J1 * sum1 ;
02388 
02389     value[1] = 1 - sqrt(point[0]) + 2 / cardNum_J2 * sum2 ;
02390 
02391     m_timesCalled++;
02392 }
02393 
02394 bool LZ07_F7::ProposeStartingPoint(double*& point) const
02395 {
02396 
02397     for (unsigned i = 0; i < m_dimension; i++)
02398         point[i] = Rng::uni(0.0, 1.0);
02399 
02400     return true;
02401 }
02402 
02403 bool LZ07_F7::utopianFitness(std::vector<double>& value) const
02404 {
02405     return false;       // TODO
02406 }
02407 
02408 bool LZ07_F7::nadirFitness(std::vector<double>& value) const
02409 {
02410     value.resize(2);
02411     value[0] = 13.0;
02412     value[1] = 13.0;
02413     return true;
02414 }
02415 
02416 
02418 
02419 
02420 LZ07_F8::LZ07_F8(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
02421 {
02422     m_name = "LZ07_F8";
02423 }
02424 
02425 LZ07_F8::~LZ07_F8()
02426 {
02427     if (constrainthandler != NULL)
02428         delete constrainthandler;
02429 }
02430 
02431 
02432 unsigned int LZ07_F8::objectives() const
02433 {
02434     return 2;
02435 }
02436 
02437 void LZ07_F8::result(double* const& point, std::vector<double>& value)
02438 {
02439 
02440     value.resize(2);
02441 
02442     double cardNum_J1, cardNum_J2 ;
02443     cardNum_J1 = floor((m_dimension - 1.0) / 2.0);
02444     cardNum_J2 = ceil((m_dimension - 1.0) / 2.0);
02445 
02446     double  sum1 = 0.0, sum2 = 0.0, prod1 = 0.0, prod2 = 0.0;
02447 
02448     double y_i;
02449     for (unsigned i = 2; i < m_dimension; i += 2)
02450     {
02451         y_i = point[i] - pow(point[0], 0.5 * (1.0 + 3 * (i - 1) / (m_dimension - 2)));
02452         sum1 += pow(y_i, 2);
02453         prod1 *= cos(20 * y_i * M_PI / sqrt(i + 1.0));
02454     }
02455     for (unsigned i = 1; i < m_dimension; i += 2)
02456     {
02457         y_i = point[i] - pow(point[0], 0.5 * (1.0 + 3 * (i - 1) / (m_dimension - 2)));
02458         sum2 += pow(y_i, 2);
02459         prod2 += cos(20 * y_i * M_PI / sqrt(i + 1.0));
02460     }
02461     value[0] = point[0] + 4 / cardNum_J1 * (2 * sum1 + prod1 + 1);
02462 
02463     value[1] = 1 - sqrt(point[0]) + 4 / cardNum_J2 * (2 * sum2 + prod2 + 1) ;
02464 
02465     m_timesCalled++;
02466 }
02467 
02468 bool LZ07_F8::ProposeStartingPoint(double*& point) const
02469 {
02470 
02471     for (unsigned i = 0; i < m_dimension; i++)
02472         point[i] = Rng::uni(0.0, 1.0);
02473 
02474     return true;
02475 }
02476 
02477 bool LZ07_F8::utopianFitness(std::vector<double>& value) const
02478 {
02479     return false;       // TODO
02480 }
02481 
02482 bool LZ07_F8::nadirFitness(std::vector<double>& value) const
02483 {
02484     value.resize(2);
02485     value[0] = 4.0 * m_dimension + 9.0;
02486     value[1] = 4.0 * m_dimension + 9.0;
02487     return true;
02488 }
02489 
02490 
02492 
02493 
02494 LZ07_F9::LZ07_F9(unsigned d) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, -1.0, 1.0, 0, 0.0, 1.0))
02495 {
02496     m_name = "LZ07_F9";
02497 }
02498 
02499 LZ07_F9::~LZ07_F9()
02500 {
02501     if (constrainthandler != NULL)
02502         delete constrainthandler;
02503 }
02504 
02505 
02506 unsigned int LZ07_F9::objectives() const
02507 {
02508     return 2;
02509 }
02510 
02511 void LZ07_F9::result(double* const& point, std::vector<double>& value)
02512 {
02513 
02514     value.resize(2);
02515 
02516     double cardNum_J1, cardNum_J2 ;
02517     cardNum_J1 = floor((m_dimension - 1.0) / 2.0);
02518     cardNum_J2 = ceil((m_dimension - 1.0) / 2.0);
02519 
02520     double  sum1 = 0.0, sum2 = 0.0;
02521 
02522     for (unsigned i = 2; i < m_dimension; i += 2)
02523         sum1 += pow(point[i] - sin(6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02524 
02525     for (unsigned i = 1; i < m_dimension; i += 2)
02526         sum2 += pow(point[i] - sin(6 * M_PI * point[0] + (i + 1) * M_PI / m_dimension), 2);
02527 
02528     value[0] = point[0] + 2 / cardNum_J1 * sum1 ;
02529 
02530     value[1] = 1 - pow(point[0], 2) + 2 / cardNum_J2 * sum2 ;
02531 
02532     m_timesCalled++;
02533 }
02534 
02535 bool LZ07_F9::ProposeStartingPoint(double*& point) const
02536 {
02537 
02538     point[0] = Rng::uni(0.0, 1.0);
02539     for (unsigned i = 1; i < m_dimension; i++)
02540         point[i] = Rng::uni(-1.0, 1.0);
02541 
02542     return true;
02543 }
02544 
02545 bool LZ07_F9::utopianFitness(std::vector<double>& value) const
02546 {
02547     return false;       // TODO
02548 }
02549 
02550 bool LZ07_F9::nadirFitness(std::vector<double>& value) const
02551 {
02552     value.resize(2);
02553     value[0] = 9.0;
02554     value[1] = 9.0;
02555     return true;
02556 }
02557 
02558 
02560 
02561 
02562 ELLIBase::ELLIBase(unsigned d, double a) : ObjectiveFunctionVS<double>(d, NULL)
02563 {
02564     m_name = "ELLIBase";
02565     m_a = a;
02566 }
02567 
02568 ELLIBase::~ELLIBase()
02569 {}
02570 
02571 
02572 unsigned int ELLIBase::objectives() const
02573 {
02574     return 2;
02575 }
02576 
02577 void ELLIBase::result(double* const& point, std::vector<double>& value)
02578 {
02579 
02580     value.resize(2);
02581 
02582     double sum1 = 0.0, sum2 = 0.0;
02583 
02584     for (unsigned i = 0; i < m_dimension; i++)
02585     {
02586         sum1 += pow(m_a, 2.0 * (i / (m_dimension - 1.0))) * point[i] * point[i];
02587     }
02588 
02589     value[0] = sum1 / (m_a * m_a * m_dimension);
02590 
02591 
02592     for (unsigned i = 0; i < m_dimension; i++)
02593     {
02594         sum2 += pow(m_a, 2 * (i / (m_dimension - 1.0))) * (point[i] - 2.0) * (point[i] - 2.0);
02595     }
02596 
02597     value[1] =  sum2 / (m_a * m_a * m_dimension);
02598 
02599     m_timesCalled++;
02600 }
02601 
02602 bool ELLIBase::ProposeStartingPoint(double*& point) const
02603 {
02604     for (unsigned int i = 0; i < m_dimension; i++)
02605         point[i] = Rng::gauss();
02606     return true;
02607 }
02608 
02609 bool ELLIBase::utopianFitness(std::vector<double>& value) const
02610 {
02611     value.resize(2);
02612     value[0] = 0.0;
02613     value[1] = 0.0;
02614     return true;
02615 }
02616 
02617 
02619 
02620 
02621 ELLI1:: ELLI1(unsigned d, double a): TransformedObjectiveFunction(base, d)
02622         , base(d, a)
02623 {
02624     m_name = "ELLI1";
02625 }
02626 
02627 ELLI1::~ELLI1()
02628 {}
02629 
02630 
02631 unsigned ELLI1::objectives() const
02632 {
02633     return base.objectives();
02634 }
02635 
02636 bool ELLI1::ProposeStartingPoint(double*& point) const
02637 {
02638     return base.ProposeStartingPoint(point);
02639 }
02640 
02641 
02643 
02644 
02645 ELLI2::ELLI2(unsigned d, double a): ObjectiveFunctionVS<double>(d , NULL), m_Transformation_1(0, 0), m_Transformation_2(0, 0)
02646 {
02647     m_name = "ELLI2";
02648     m_a = a;
02649     initRandomRotation();
02650 }
02651 
02652 ELLI2::~ELLI2()
02653 {}
02654 
02655 
02656 unsigned int ELLI2::objectives() const
02657 {
02658     return 2;
02659 }
02660 
02661 void ELLI2::result(double* const& point, std::vector<double>& value)
02662 {
02663 
02664     value.resize(2);
02665 
02666     double sum_1 = 0, sum_2 = 0;
02667 
02668     std::vector<double> y(m_dimension);
02669     std::vector<double> z(m_dimension);
02670 
02671     transform_1(point, y);
02672     transform_2(point, z);
02673 
02674     for (unsigned i = 0; i < m_dimension; i++)
02675     {
02676         sum_1 += pow(m_a, 2.0 * (i / (m_dimension - 1.0))) * y[i] * y[i];
02677         sum_2 += pow(m_a, 2.0 * (i / (m_dimension - 1.0))) * (z[i] - 2.0) * (z[i] - 2.0);
02678     }
02679 
02680     value[0] = sum_1 / (m_a * m_a * m_dimension);
02681 
02682     value[1] = sum_2 / (m_a * m_a * m_dimension);
02683 
02684 
02685     m_timesCalled++;
02686 }
02687 
02688 bool ELLI2::ProposeStartingPoint(double*& point) const
02689 {
02690 
02691     for (unsigned int i = 0; i < m_dimension; i++)
02692         point[i] = Rng::gauss();
02693 
02694     return true;
02695 }
02696 
02697 void ELLI2::initRandomRotation()
02698 {
02699 
02700     unsigned i, j, c;
02701     Matrix H_1(m_dimension, m_dimension);
02702     Matrix H_2(m_dimension, m_dimension);
02703     m_Transformation_1.resize(m_dimension, m_dimension);
02704     m_Transformation_2.resize(m_dimension, m_dimension);
02705     for (i = 0; i < m_dimension; i++)
02706     {
02707         for (c = 0; c < m_dimension; c++)
02708         {
02709             H_1(i, c) = Rng::gauss(0, 1);
02710             H_2(i, c) = Rng::gauss(0, 1);
02711         }
02712     }
02713     m_Transformation_1 = H_1;
02714     m_Transformation_2 = H_2;
02715     for (i = 0; i < m_dimension; i++)
02716     {
02717         for (j = 0; j < i; j++)
02718         {
02719             for (c = 0; c < m_dimension; c++)
02720             {
02721                 m_Transformation_1(i, c) -= (H_1[i] * H_1[j]) * H_1(j, c) / (H_1[j].norm2());
02722                 m_Transformation_2(i, c) -= (H_2[i] * H_2[j]) * H_2(j, c) / (H_2[j].norm2());
02723             }
02724         }
02725         H_1 = m_Transformation_1;
02726         H_2 = m_Transformation_2;
02727     }
02728     for (i = 0; i < m_dimension; i++)
02729     {
02730         double normB_1 = m_Transformation_1[i].norm();
02731         double normB_2 = m_Transformation_2[i].norm();
02732         for (j = 0; j < m_dimension; j++)
02733         {
02734             m_Transformation_1(i, j) = m_Transformation_1(i, j) / normB_1;
02735             m_Transformation_2(i, j) = m_Transformation_2(i, j) / normB_2;
02736         }
02737     }
02738 }
02739 
02740 void ELLI2::transform_1(const double* in, std::vector<double>& out) const
02741 {
02742     unsigned i, j;
02743     out.resize(m_dimension);
02744     for (i = 0; i < m_dimension; i++)
02745     {
02746         out[i] = 0.0;
02747         for (j = 0; j < m_dimension; j++)
02748             out[i] += m_Transformation_1(j, i) * in[j];
02749     }
02750 }
02751 
02752 void ELLI2::transform_2(const double* in, std::vector<double>& out) const
02753 {
02754     unsigned i, j;
02755     out.resize(m_dimension);
02756     for (i = 0; i < m_dimension; i++)
02757     {
02758         out[i] = 0.0;
02759         for (j = 0; j < m_dimension; j++)
02760             out[i] += m_Transformation_2(j, i) * in[j];
02761     }
02762 }
02763 
02764 
02766 
02767 
02768 CIGTABBase::CIGTABBase(unsigned d, double a) : ObjectiveFunctionVS<double>(d, NULL)
02769 {
02770     m_name = "CIGTABBase";
02771     m_a = a;
02772 }
02773 
02774 CIGTABBase::~CIGTABBase()
02775 {}
02776 
02777 
02778 unsigned int CIGTABBase::objectives() const
02779 {
02780     return 2;
02781 }
02782 
02783 void CIGTABBase::result(double* const& point, std::vector<double>& value)
02784 {
02785 
02786     value.resize(2);
02787 
02788     double result = point[0] * point[0] + m_a * m_a * point[m_dimension-1] * point[m_dimension-1];
02789 
02790     for (unsigned i = 1; i < m_dimension - 1; i++)
02791     {
02792         result += m_a * point[i] * point[i];
02793     }
02794 
02795     value[0] = result / (m_a * m_a * m_dimension);
02796 
02797     result = (point[0] - 2) * (point[0] - 2) + m_a * m_a * (point[m_dimension-1] - 2) * (point[m_dimension-1] - 2);
02798 
02799     for (unsigned i = 1; i < m_dimension - 1; i++)
02800     {
02801         result += m_a * (point[i] - 2) * (point[i] - 2);
02802     }
02803 
02804     value[1] = result / (m_a * m_a * m_dimension);
02805     m_timesCalled++;
02806 }
02807 
02808 bool CIGTABBase::ProposeStartingPoint(double*& point) const
02809 {
02810 
02811     for (unsigned int i = 0; i < m_dimension; i++)
02812         point[i] = Rng::gauss();
02813     return true;
02814 }
02815 
02816 bool CIGTABBase::utopianFitness(std::vector<double>& value) const
02817 {
02818     value.resize(2);
02819     value[0] = 0.0;
02820     value[1] = 0.0;
02821     return true;
02822 }
02823 
02824 
02826 
02827 
02828 CIGTAB1:: CIGTAB1(unsigned d, double a): TransformedObjectiveFunction(base, d)
02829         , base(d, a)
02830 {
02831     m_name = "CIGTAB1";
02832 }
02833 
02834 CIGTAB1::~CIGTAB1()
02835 {}
02836 
02837 
02838 unsigned CIGTAB1::objectives() const
02839 {
02840     return base.objectives();
02841 }
02842 
02843 bool CIGTAB1::ProposeStartingPoint(double*& point) const
02844 {
02845     return base.ProposeStartingPoint(point);
02846 }
02847 
02848 
02850 
02851 
02852 CIGTAB2::CIGTAB2(unsigned d, double a): ObjectiveFunctionVS<double>(d , NULL), m_Transformation_1(0, 0), m_Transformation_2(0, 0)
02853 {
02854     m_name = "CIGTAB2";
02855     m_a = a;
02856     initRandomRotation();
02857 }
02858 
02859 CIGTAB2::~CIGTAB2()
02860 {}
02861 
02862 
02863 unsigned int CIGTAB2::objectives() const
02864 {
02865     return 2;
02866 }
02867 
02868 void CIGTAB2::result(double* const& point, std::vector<double>& value)
02869 {
02870 
02871     value.resize(2);
02872 
02873     std::vector<double> y(m_dimension);
02874     std::vector<double> z(m_dimension);
02875 
02876     transform_1(point, y);
02877     transform_2(point, z);
02878 
02879     double result_1 = y[0] * y[0] + m_a * m_a * y[m_dimension-1] * y[m_dimension-1];
02880     double result_2 = z[0] * z[0] + m_a * m_a * z[m_dimension-1] * z[m_dimension-1];
02881 
02882 
02883     for (unsigned i = 1; i < m_dimension - 1; i++)
02884     {
02885         result_1 += m_a * y[i] * y[i];
02886         result_2 += m_a * (z[i] - 2) * (z[i] - 2);
02887     }
02888 
02889     value[0] = result_1 / (m_a * m_a * m_dimension);
02890 
02891 
02892     value[1] = result_2 / (m_a * m_a * m_dimension);
02893 
02894 
02895     m_timesCalled++;
02896 }
02897 
02898 bool CIGTAB2::ProposeStartingPoint(double*& point) const
02899 {
02900 
02901     for (unsigned int i = 0; i < m_dimension; i++)
02902         point[i] = Rng::gauss();
02903 
02904     return true;
02905 }
02906 
02907 void CIGTAB2::initRandomRotation()
02908 {
02909 
02910     unsigned i, j, c;
02911     Matrix H_1(m_dimension, m_dimension);
02912     Matrix H_2(m_dimension, m_dimension);
02913     m_Transformation_1.resize(m_dimension, m_dimension);
02914     m_Transformation_2.resize(m_dimension, m_dimension);
02915     for (i = 0; i < m_dimension; i++)
02916     {
02917         for (c = 0; c < m_dimension; c++)
02918         {
02919             H_1(i, c) = Rng::gauss(0, 1);
02920             H_2(i, c) = Rng::gauss(0, 1);
02921         }
02922     }
02923     m_Transformation_1 = H_1;
02924     m_Transformation_2 = H_2;
02925     for (i = 0; i < m_dimension; i++)
02926     {
02927         for (j = 0; j < i; j++)
02928         {
02929             for (c = 0; c < m_dimension; c++)
02930             {
02931                 m_Transformation_1(i, c) -= (H_1[i] * H_1[j]) * H_1(j, c) / (H_1[j].norm2());
02932                 m_Transformation_2(i, c) -= (H_2[i] * H_2[j]) * H_2(j, c) / (H_2[j].norm2());
02933             }
02934         }
02935         H_1 = m_Transformation_1;
02936         H_2 = m_Transformation_2;
02937     }
02938     for (i = 0; i < m_dimension; i++)
02939     {
02940         double normB_1 = m_Transformation_1[i].norm();
02941         double normB_2 = m_Transformation_2[i].norm();
02942         for (j = 0; j < m_dimension; j++)
02943         {
02944             m_Transformation_1(i, j) = m_Transformation_1(i, j) / normB_1;
02945             m_Transformation_2(i, j) = m_Transformation_2(i, j) / normB_2;
02946         }
02947     }
02948 }
02949 
02950 void CIGTAB2::transform_1(const double* in, std::vector<double>& out) const
02951 {
02952     unsigned i, j;
02953     out.resize(m_dimension);
02954     for (i = 0; i < m_dimension; i++)
02955     {
02956         out[i] = 0.0;
02957         for (j = 0; j < m_dimension; j++)
02958             out[i] += m_Transformation_1(j, i) * in[j];
02959     }
02960 }
02961 
02962 void CIGTAB2::transform_2(const double* in, std::vector<double>& out) const
02963 {
02964     unsigned i, j;
02965     out.resize(m_dimension);
02966     for (i = 0; i < m_dimension; i++)
02967     {
02968         out[i] = 0.0;
02969         for (j = 0; j < m_dimension; j++)
02970             out[i] += m_Transformation_2(j, i) * in[j];
02971     }
02972 }
02973 
02974 
02976 
02977 
02978 DTLZ1::DTLZ1(unsigned d, unsigned m) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
02979 {
02980     m_name = "DTLZ1";
02981     m_objectives = m;
02982 }
02983 
02984 DTLZ1::~DTLZ1()
02985 {
02986     if (constrainthandler != NULL)
02987         delete constrainthandler;
02988 }
02989 
02990 
02991 unsigned int DTLZ1::objectives() const
02992 {
02993     return m_objectives;
02994 }
02995 
02996 void DTLZ1::result(double* const& point, std::vector<double>& value)
02997 {
02998 
02999     if (m_objectives > m_dimension)
03000         throw SHARKEXCEPTION("[DTLZ1::result] number of objectives exceeds the search space dimension.");
03001 
03002     value.resize(m_objectives);
03003 
03004     int k = m_dimension - m_objectives + 1 ;
03005     double g = 0.0;
03006 
03007     for (unsigned int i = m_dimension - k + 1; i <= m_dimension; i++)
03008         g += pow(point[i-1] - 0.5, 2) - cos(20 * M_PI * (point[i-1] - 0.5));
03009 
03010     g = 100 * (k + g);
03011 
03012     for (unsigned int i = 1; i <= m_objectives; i++)
03013     {
03014         double f = 0.5 * (1 + g);
03015         for (unsigned int j = m_objectives - i; j >= 1; j--)
03016             f *= point[j-1];
03017 
03018         if (i > 1)
03019             f *= 1 - point[(m_objectives - i + 1) - 1];
03020 
03021         value[i-1] = f;
03022     }
03023 
03024     m_timesCalled++;
03025 }
03026 
03027 bool DTLZ1::ProposeStartingPoint(double*& point) const
03028 {
03029 
03030     for (unsigned i = 0; i < m_dimension; i++)
03031         point[i] = Rng::uni(0.0, 1.0);
03032 
03033     return true;
03034 }
03035 
03036 bool DTLZ1::utopianFitness(std::vector<double>& value) const
03037 {
03038     return false;       // TODO
03039 }
03040 
03041 bool DTLZ1::nadirFitness(std::vector<double>& value) const
03042 {
03043     value.resize(m_objectives);
03044     int k = m_dimension - m_objectives + 1;
03045     unsigned int i;
03046     for (i=0; i<m_objectives; i++) value[i] = 112.5 * k + 0.5;
03047     return true;
03048 }
03049 
03050 
03052 
03053 
03054 DTLZ2::DTLZ2(unsigned d, unsigned m) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
03055 {
03056     m_name = "DTLZ2";
03057     m_objectives = m;
03058 }
03059 
03060 DTLZ2::~DTLZ2()
03061 {
03062     if (constrainthandler != NULL)
03063         delete constrainthandler;
03064 }
03065 
03066 
03067 unsigned int DTLZ2::objectives() const
03068 {
03069     return m_objectives;
03070 }
03071 
03072 void DTLZ2::result(double* const& point, std::vector<double>& value)
03073 {
03074 
03075     if (m_objectives > m_dimension)
03076         throw SHARKEXCEPTION("[DTLZ2::result] number of objectives exceeds the search space dimension.");
03077 
03078     value.resize(m_objectives);
03079 
03080     int    k ;
03081     double g ;
03082 
03083     k = m_dimension - m_objectives + 1 ;
03084     g = 0.0 ;
03085 
03086     for (unsigned int i = m_dimension - k + 1; i <= m_dimension; i++)
03087         g += pow(point[i-1] - 0.5, 2);
03088 
03089     for (unsigned int i = 1; i <= m_objectives; i++)
03090     {
03091         double f = (1 + g);
03092         for (int j = m_objectives - i; j >= 1; j--)
03093             f *= cos(point[j-1] * M_PI / 2);
03094 
03095         if (i > 1)
03096             f *= sin(point[(m_objectives - i + 1) - 1] * M_PI / 2);
03097 
03098         value[i-1] = f ;
03099     }
03100 
03101     m_timesCalled++;
03102 }
03103 
03104 bool DTLZ2::ProposeStartingPoint(double*& point) const
03105 {
03106     for (unsigned i = 0; i < m_dimension; i++)
03107         point[i] = Rng::uni(0.0, 1.0);
03108 
03109     return true;
03110 }
03111 
03112 bool DTLZ2::utopianFitness(std::vector<double>& value) const
03113 {
03114     return false;       // TODO
03115 }
03116 
03117 bool DTLZ2::nadirFitness(std::vector<double>& value) const
03118 {
03119     value.resize(m_objectives);
03120     int k = m_dimension - m_objectives + 1;
03121     unsigned int i;
03122     for (i=0; i<m_objectives; i++) value[i] = 0.25 * k + 1.0;
03123     return true;
03124 }
03125 
03126 
03128 
03129 
03130 DTLZ3::DTLZ3(unsigned d, unsigned m) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
03131 {
03132     m_name = "DTLZ3";
03133     m_objectives = m;
03134 }
03135 
03136 DTLZ3::~DTLZ3()
03137 {
03138     if (constrainthandler != NULL)
03139         delete constrainthandler;
03140 }
03141 
03142 
03143 unsigned int DTLZ3::objectives() const
03144 {
03145     return m_objectives;
03146 }
03147 
03148 void DTLZ3::result(double* const& point, std::vector<double>& value)
03149 {
03150 
03151     if (m_objectives > m_dimension)
03152         throw SHARKEXCEPTION("[DTLZ3::result] number of objectives exceeds the search space dimension.");
03153 
03154     value.resize(m_objectives);
03155 
03156     int    k ;
03157     double g ;
03158 
03159     k = m_dimension - m_objectives + 1 ;
03160     g = 0.0 ;
03161 
03162     for (unsigned int i = m_dimension - k + 1; i <= m_dimension; i++)
03163         g += pow(point[i-1] - 0.5, 2) - cos(20 * M_PI * (point[i-1] - 0.5));
03164 
03165     g = 100 * (k + g);
03166 
03167     for (unsigned int i = 1; i <= m_objectives; i++)
03168     {
03169         double f = (1 + g);
03170         for (unsigned int j = m_objectives - i; j >= 1; j--)
03171             f *= cos(point[j-1] * M_PI / 2);
03172 
03173         if (i > 1)
03174             f *= sin(point[(m_objectives - i + 1) - 1] * M_PI / 2);
03175 
03176         value[i-1] = f ;
03177     }
03178 
03179     m_timesCalled++;
03180 }
03181 
03182 bool DTLZ3::ProposeStartingPoint(double*& point) const
03183 {
03184     for (unsigned i = 0; i < m_dimension; i++)
03185         point[i] = Rng::uni(0.0, 1.0);
03186 
03187     return true;
03188 }
03189 
03190 bool DTLZ3::utopianFitness(std::vector<double>& value) const
03191 {
03192     return false;       // TODO
03193 }
03194 
03195 bool DTLZ3::nadirFitness(std::vector<double>& value) const
03196 {
03197     value.resize(m_objectives);
03198     int k = m_dimension - m_objectives + 1;
03199     unsigned int i;
03200     for (i=0; i<m_objectives; i++) value[i] = 225.0 * k + 1.0;
03201     return true;
03202 }
03203 
03204 
03206 
03207 
03208 DTLZ4::DTLZ4(unsigned d, unsigned m) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
03209 {
03210     m_name = "DTLZ4";
03211     m_objectives = m;
03212 }
03213 
03214 DTLZ4::~DTLZ4()
03215 {
03216     if (constrainthandler != NULL)
03217         delete constrainthandler;
03218 }
03219 
03220 unsigned int DTLZ4::objectives() const
03221 {
03222     return m_objectives;
03223 }
03224 
03225 void DTLZ4::result(double* const& point, std::vector<double>& value)
03226 {
03227 
03228     if (m_objectives > m_dimension)
03229         throw SHARKEXCEPTION("[DTLZ4::result] number of objectives exceeds the search space dimension.");
03230 
03231     value.resize(m_objectives);
03232 
03233     int    k ;
03234     double g ;
03235     double alpha;
03236 
03237     k = m_dimension - m_dimension + 1 ;
03238     alpha = 100;
03239     g = 0.0 ;
03240 
03241     for (unsigned int i = m_dimension - k + 1; i <= m_dimension; i++)
03242         g += pow(point[i-1] - 0.5, 2);
03243 
03244     for (unsigned int i = 1; i <= m_objectives; i++)
03245     {
03246         double f = (1 + g);
03247         for (unsigned int j = m_objectives - i; j >= 1; j--)
03248             f *= cos(pow(point[j-1], alpha) * M_PI / 2);
03249 
03250         if (i > 1)
03251             f *= sin(pow(point[(m_objectives - i + 1) - 1], alpha) * M_PI / 2);
03252 
03253         value[i-1] = f ;
03254     }
03255 
03256 
03257     m_timesCalled++;
03258 }
03259 
03260 bool DTLZ4::ProposeStartingPoint(double*& point) const
03261 {
03262     for (unsigned i = 0; i < m_dimension; i++)
03263         point[i] = Rng::uni(0.0, 1.0);
03264 
03265     return true;
03266 }
03267 
03268 bool DTLZ4::utopianFitness(std::vector<double>& value) const
03269 {
03270     return false;       // TODO
03271 }
03272 
03273 bool DTLZ4::nadirFitness(std::vector<double>& value) const
03274 {
03275     value.resize(m_objectives);
03276     int k = m_dimension - m_objectives + 1;
03277     unsigned int i;
03278     for (i=0; i<m_objectives; i++) value[i] = 0.25 * k + 1.0;
03279     return true;
03280 }
03281 
03282 
03284 
03285 
03286 DTLZ5::DTLZ5(unsigned d, unsigned m) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
03287 {
03288     m_name = "DTLZ5";
03289     m_objectives = m;
03290 }
03291 
03292 DTLZ5::~DTLZ5()
03293 {
03294     if (constrainthandler != NULL)
03295         delete constrainthandler;
03296 }
03297 
03298 unsigned int DTLZ5::objectives() const
03299 {
03300     return m_objectives;
03301 }
03302 
03303 void DTLZ5::result(double* const& point, std::vector<double>& value)
03304 {
03305 
03306     if (m_objectives > m_dimension)
03307         throw SHARKEXCEPTION("[DTLZ5::result] number of objectives exceeds the search space dimension.");
03308 
03309     value.resize(m_objectives);
03310 
03311     int    k ;
03312     double g ;
03313 
03314     std::vector<double> phi(m_objectives);
03315 
03316     k = m_dimension - m_objectives + 1 ;
03317     g = 0.0 ;
03318 
03319     for (unsigned int i = m_dimension - k + 1; i <= m_dimension; i++)
03320         g += pow(point[i-1] - 0.5, 2);
03321 
03322     double t = M_PI  / (4 * (1 + g));
03323 
03324     phi[0] = point[0] * M_PI / 2;
03325     for (unsigned int i = 2; i <= (m_objectives - 1); i++)
03326         phi[i-1] = t * (1 + 2 * g * point[i-1]);
03327 
03328     for (unsigned int i = 1; i <= m_objectives; i++)
03329     {
03330         double f = (1 + g);
03331 
03332         for (unsigned int j = m_objectives - i; j >= 1; j--)
03333             f *= cos(phi[j-1]);
03334 
03335         if (i > 1)
03336             f *= sin(phi[(m_objectives - i + 1) - 1]);
03337 
03338         value[i-1] = f ;
03339     }
03340 
03341     m_timesCalled++;
03342 }
03343 
03344 bool DTLZ5::ProposeStartingPoint(double*& point) const
03345 {
03346 
03347     for (unsigned i = 0; i < m_dimension; i++)
03348         point[i] = Rng::uni(0.0, 1.0);
03349 
03350     return true;
03351 }
03352 
03353 bool DTLZ5::utopianFitness(std::vector<double>& value) const
03354 {
03355     return false;       // TODO
03356 }
03357 
03358 bool DTLZ5::nadirFitness(std::vector<double>& value) const
03359 {
03360     value.resize(m_objectives);
03361     int k = m_dimension - m_objectives + 1;
03362     unsigned int i;
03363     for (i=0; i<m_objectives; i++) value[i] = 0.25 * k + 1.0;
03364     return true;
03365 }
03366 
03367 
03369 
03370 
03371 DTLZ6::DTLZ6(unsigned d, unsigned m) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
03372 {
03373     m_name = "DTLZ6";
03374     m_objectives = m;
03375 }
03376 
03377 DTLZ6::~DTLZ6()
03378 {
03379     if (constrainthandler != NULL)
03380         delete constrainthandler;
03381 }
03382 
03383 unsigned int DTLZ6::objectives() const
03384 {
03385     return m_objectives;
03386 }
03387 
03388 void DTLZ6::result(double* const& point, std::vector<double>& value)
03389 {
03390 
03391     if (m_objectives > m_dimension)
03392         throw SHARKEXCEPTION("[DTLZ6::result] number of objectives exceeds the search space dimension.");
03393 
03394     value.resize(m_objectives);
03395 
03396     int    k ;
03397     double g ;
03398 
03399     std::vector<double> phi(m_objectives);
03400 
03401     k = m_dimension - m_objectives + 1 ;
03402     g = 0.0 ;
03403 
03404     for (unsigned int i = m_dimension - k + 1; i <= m_dimension; i++)
03405         g += pow(point[i-1], 0.1);
03406 
03407     double t = M_PI  / (4 * (1 + g));
03408 
03409     phi[0] = point[0] * M_PI / 2;
03410     for (unsigned int i = 2; i <= m_objectives - 1; i++)
03411         phi[i-1] = t * (1 + 2 * g * point[i-1]);
03412 
03413     for (unsigned int i = 1; i <= m_objectives; i++)
03414     {
03415         double f = (1 + g);
03416 
03417         for (int j = m_objectives - i; j >= 1; j--)
03418             f *= cos(phi[j-1]);
03419 
03420         if (i > 1)
03421             f *= sin(phi[(m_objectives - i + 1) - 1]);
03422 
03423         value[i-1] = f ;
03424     }
03425     m_timesCalled++;
03426 }
03427 
03428 bool DTLZ6::ProposeStartingPoint(double*& point) const
03429 {
03430 
03431     for (unsigned i = 0; i < m_dimension; i++)
03432         point[i] = Rng::uni(0.0, 1.0);
03433 
03434     return true;
03435 }
03436 
03437 bool DTLZ6::utopianFitness(std::vector<double>& value) const
03438 {
03439     return false;       // TODO
03440 }
03441 
03442 bool DTLZ6::nadirFitness(std::vector<double>& value) const
03443 {
03444     value.resize(m_objectives);
03445     int k = m_dimension - m_objectives + 1;
03446     unsigned int i;
03447     for (i=0; i<m_objectives; i++) value[i] = k + 1.0;
03448     return true;
03449 }
03450 
03451 
03453 
03454 
03455 DTLZ7::DTLZ7(unsigned d, unsigned m) : ObjectiveFunctionVS<double>(d, new BoxConstraintHandler(d, 0.0, 1.0))
03456 {
03457     m_name = "DTLZ7";
03458     m_objectives = m;
03459 }
03460 
03461 DTLZ7::~DTLZ7()
03462 {
03463     if (constrainthandler != NULL)
03464         delete constrainthandler;
03465 }
03466 
03467 
03468 unsigned int DTLZ7::objectives() const
03469 {
03470     return m_objectives;
03471 }
03472 
03473 void DTLZ7::result(double* const& point, std::vector<double>& value)
03474 {
03475 
03476     if (m_objectives > m_dimension)
03477         throw SHARKEXCEPTION("[DTLZ7::result] number of objectives exceeds the search space dimension.");
03478 
03479     value.resize(m_objectives);
03480 
03481     int    k;
03482     double g;
03483     double h;
03484 
03485     k = m_dimension - m_objectives + 1 ;
03486     g = 0.0 ;
03487     for (unsigned int i = m_dimension - k + 1; i <= m_dimension; i++)
03488         g += point[i-1];
03489 
03490     g = 1 + 9 * g / k;
03491 
03492     for (unsigned int i = 1; i <= m_objectives - 1; i++)
03493         value[i-1] = point[i-1];
03494 
03495     h = 0.0 ;
03496     for (unsigned int j = 1; j <= m_objectives - 1; j++)
03497         h += point[j-1] / (1 + g) * (1 + sin(3 * M_PI * point[j-1]));
03498 
03499     h = m_objectives - h ;
03500 
03501     value[m_objectives-1] = (1 + g) * h;
03502     m_timesCalled++;
03503 }
03504 
03505 bool DTLZ7::ProposeStartingPoint(double*& point) const
03506 {
03507     for (unsigned i = 0; i < m_dimension; i++)
03508         point[i] = Rng::uni(0.0, 1.0);
03509 
03510     return true;
03511 }
03512 
03513 bool DTLZ7::utopianFitness(std::vector<double>& value) const
03514 {
03515     return false;       // TODO
03516 }
03517 
03518 bool DTLZ7::nadirFitness(std::vector<double>& value) const
03519 {
03520     value.resize(m_objectives);
03521     unsigned int i;
03522     for (i=0; i<m_objectives; i++) value[i] = 1.0;
03523     value[m_objectives - 1] = 11.0 * m_objectives;
03524     return true;
03525 }
03526 
03527 
03529 
03530 
03531 Superspheres::Superspheres(unsigned int dim)
03532 : ObjectiveFunctionVS<double>(dim, new BoxConstraintHandler(dim, 1.0, 5.0, 0, 0.0, 0.5 * M_PI))
03533 {
03534     m_name = "Superspheres";
03535 }
03536 
03537 Superspheres::~Superspheres()
03538 {
03539 }
03540 
03541 
03542 unsigned int Superspheres::objectives() const
03543 {
03544     return 2;
03545 }
03546 
03547 void Superspheres::result(double* const& point, std::vector<double>& value)
03548 {
03549     unsigned int i;
03550     double d = 0.0;
03551     if (m_dimension > 1)
03552     {
03553         for (i=1; i<m_dimension; i++) d += Shark::sqr(point[i]);
03554         d /= (m_dimension - 1.0);
03555     }
03556     double r = sin(M_PI * d);
03557     r *= r;
03558     r += 1.0;
03559     value.resize(2);
03560     value[0] = (r * cos(point[0]));
03561     value[1] = (r * sin(point[0]));
03562     m_timesCalled++;
03563 }
03564 
03565 bool Superspheres::ProposeStartingPoint(double*& point) const
03566 {
03567     unsigned int i;
03568     point[0] = Rng::uni(0.0, 0.5 * M_PI);
03569     for (i=1; i<m_dimension; i++) point[i] = Rng::uni(1.0, 5.0);
03570     return true;
03571 }
03572 
03573 bool Superspheres::utopianFitness(std::vector<double>& value) const
03574 {
03575     value.resize(2);
03576     value[0] = 0.0;
03577     value[1] = 0.0;
03578     return true;
03579 }
03580 
03581 bool Superspheres::nadirFitness(std::vector<double>& value) const
03582 {
03583     value.resize(2);
03584     value[0] = 2.0;
03585     value[1] = 2.0;
03586     return true;
03587 }
  • Shark Main Page
  • Array
  • Rng
  • LinAlg
  • FileUtil
  • EALib
  • MOO-EALib
  • ReClaM
  • Fuzzy
  • Mixture
  • Tutorials
  • FAQ