25 #include <boost/math/constants/constants.hpp>
27 #include "../exceptions.h"
32 static int __check__(
int N)
34 if (N > 24 || N < 1) {
35 pagmo_throw(value_error,
"the problem id needs to be one of [1..24]");
40 static const std::vector<double> __constraint_tolerances__(
int c_dimension,
int ic_dimension)
42 std::vector<double> constraint_tolerances(c_dimension);
44 for(
int i=0; i<c_dimension-ic_dimension; i++) {
45 constraint_tolerances[i] = 0.0001;
48 for(
int i=c_dimension-ic_dimension; i<c_dimension; i++) {
49 constraint_tolerances[i] = 0.;
51 return constraint_tolerances;
54 namespace pagmo {
namespace problem {
56 static const double PI = boost::math::constants::pi<double>();
59 const decision_vector::size_type cec2006::m_problems_dimension[] =
60 {13,20,10,5,4,2,10,2,7,8,2,3,5,10,3,5,6,9,15,24,7,22,9,2};
61 const constraint_vector::size_type cec2006::m_problems_c_dimension[] =
62 {9,2,1,6,5,2,8,2,4,6,1,1,3,3,2,38,4,13,5,20,6,20,6,2};
63 const constraint_vector::size_type cec2006::m_problems_ic_dimension[] =
64 {9,2,0,6,2,2,8,2,4,6,0,1,0,0,0,38,0,13,5,6,1,1,2,2};
72 cec2006::cec2006(
int fun_id):
base(m_problems_dimension[__check__(fun_id)-1],0,1,m_problems_c_dimension[__check__(fun_id)-1],m_problems_ic_dimension[__check__(fun_id)-1], __constraint_tolerances__(m_problems_c_dimension[__check__(fun_id)-1], m_problems_ic_dimension[__check__(fun_id)-1])),m_problem_number(__check__(fun_id))
78 switch(m_problem_number)
82 const double lb[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
83 const double ub[] = {1.,1.,1.,1.,1.,1.,1.,1.,1.,100.,100.,100.,1.};
89 const double lb[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
90 const double ub[] = {10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.};
96 const double lb[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
97 const double ub[] = {1.,1.,1.,1.,1.,1.,1.,1.,1.,1.};
103 const double lb[] = {78.,33.,27.,27.,27.};
104 const double ub[] = {102.,45.,45.,45.,45.};
110 const double lb[] = {0.,0.,-0.55,-0.55};
111 const double ub[] = {1200.,1200.,0.55,0.55};
118 const double lb[] = {13.,0.};
119 const double ub[] = {100.,100.};
125 const double lb[] = {-10.,-10.,-10.,-10.,-10.,-10.,-10.,-10.,-10.,-10.};
126 const double ub[] = {10.,10.,10.,10.,10.,10.,10.,10.,10.,10.};
132 const double lb[] = {0.,0.};
133 const double ub[] = {10.,10.};
139 const double lb[] = {-10.,-10.,-10.,-10.,-10.,-10.,-10.};
140 const double ub[] = {10.,10.,10.,10.,10.,10.,10.};
146 const double lb[] = {100.,1000.,1000.,10.,10.,10.,10.,10.};
147 const double ub[] = {10000.,10000.,10000.,1000.,1000.,1000.,1000.,1000.};
153 const double lb[] = {-1.,-1.};
154 const double ub[] = {1.,1.};
160 const double lb[] = {0.,0.,0.};
161 const double ub[] = {10.,10.,10.};
167 const double lb[] = {-2.3,-2.3,-3.2,-3.2,-3.2};
168 const double ub[] = {2.3,2.3,3.2,3.2,3.2};
174 const double lb[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
175 const double ub[] = {10.,10.,10.,10.,10.,10.,10.,10.,10.,10.};
181 const double lb[] = {0.,0.,0.};
182 const double ub[] = {10.,10.,10.};
188 const double lb[] = {704.4148,68.6,0.,193.,25.};
189 const double ub[] = {906.3855,288.88,134.75,287.0966,84.1988};
195 const double lb[] = {0.,0.,340.,340.,-1000.,0.};
196 const double ub[] = {400.,1000.,420.,420.,1000.,0.5236};
202 const double lb[] = {-10.,-10.,-10.,-10.,-10.,-10.,-10.,-10.,0.};
203 const double ub[] = {10.,10.,10.,10.,10.,10.,10.,10.,20.};
209 const double lb[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
210 const double ub[] = {10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.};
216 const double lb[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
217 const double ub[] = {10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.,10.};
223 const double lb[] = {0.,0.,0.,100.,6.3,5.9,4.5};
224 const double ub[] = {1000.,40.,40.,300.,6.7,6.4,6.25};
230 const double lb[] = {0.,0.,0.,0.,0.,0.,0.,100.,100.,100.01,100.,100.,0.,0.,0.,0.01,0.01,-4.7,-4.7,-4.7,-4.7,-4.7};
231 const double ub[] = {20000.,1e6,1e6,1e6,4e7,4e7,4e7,299.99,399.99,300,400,600,500,500,500,300.,400.,6.25,6.25,6.25,6.25,6.25};
237 const double lb[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.01};
238 const double ub[] = {300.,300.,100.,200.,100.,300.,100.,200.,0.03};
244 const double lb[] = {0.,0.};
245 const double ub[] = {3.,4.};
250 pagmo_throw(value_error,
"Error: There are only 24 test functions in this test suite!");
264 switch(m_problem_number)
267 g01_objfun_impl(f,x);
270 g02_objfun_impl(f,x);
273 g03_objfun_impl(f,x);
276 g04_objfun_impl(f,x);
279 g05_objfun_impl(f,x);
282 g06_objfun_impl(f,x);
285 g07_objfun_impl(f,x);
288 g08_objfun_impl(f,x);
291 g09_objfun_impl(f,x);
294 g10_objfun_impl(f,x);
297 g11_objfun_impl(f,x);
300 g12_objfun_impl(f,x);
303 g13_objfun_impl(f,x);
306 g14_objfun_impl(f,x);
309 g15_objfun_impl(f,x);
312 g16_objfun_impl(f,x);
315 g17_objfun_impl(f,x);
318 g18_objfun_impl(f,x);
321 g19_objfun_impl(f,x);
324 g20_objfun_impl(f,x);
327 g21_objfun_impl(f,x);
330 g22_objfun_impl(f,x);
333 g23_objfun_impl(f,x);
336 g24_objfun_impl(f,x);
339 pagmo_throw(value_error,
"Error: There are only 24 test functions in this test suite!");
347 switch(m_problem_number)
350 g01_compute_constraints_impl(c,x);
353 g02_compute_constraints_impl(c,x);
356 g03_compute_constraints_impl(c,x);
359 g04_compute_constraints_impl(c,x);
362 g05_compute_constraints_impl(c,x);
365 g06_compute_constraints_impl(c,x);
368 g07_compute_constraints_impl(c,x);
371 g08_compute_constraints_impl(c,x);
374 g09_compute_constraints_impl(c,x);
377 g10_compute_constraints_impl(c,x);
380 g11_compute_constraints_impl(c,x);
383 g12_compute_constraints_impl(c,x);
386 g13_compute_constraints_impl(c,x);
389 g14_compute_constraints_impl(c,x);
392 g15_compute_constraints_impl(c,x);
395 g16_compute_constraints_impl(c,x);
398 g17_compute_constraints_impl(c,x);
401 g18_compute_constraints_impl(c,x);
404 g19_compute_constraints_impl(c,x);
407 g20_compute_constraints_impl(c,x);
410 g21_compute_constraints_impl(c,x);
413 g22_compute_constraints_impl(c,x);
416 g23_compute_constraints_impl(c,x);
419 g24_compute_constraints_impl(c,x);
422 pagmo_throw(value_error,
"Error: There are only 24 test functions in this test suite!");
429 std::string retval(
"CEC2006 - g");
430 retval.append(boost::lexical_cast<std::string>(m_problem_number));
435 void cec2006::initialize_best(
void)
437 std::vector<decision_vector> best_x;
439 int x_dimension = m_problems_dimension[m_problem_number - 1];
441 switch(m_problem_number)
445 const double x_vector[] = {1.,1.,1.,1.,1.,1.,1.,1.,1.,3.,3.,3.,1.};
448 std::copy(x_vector,x_vector + x_dimension,x.begin());
455 const double x_vector[] = {3.16246061572185, 3.12833142812967, 3.09479212988791, 3.06145059523469,
456 3.02792915885555, 2.99382606701730, 2.95866871765285, 2.92184227312450,
457 0.49482511456933, 0.48835711005490, 0.48231642711865, 0.47664475092742,
458 0.47129550835493, 0.46623099264167, 0.46142004984199, 0.45683664767217,
459 0.45245876903267, 0.44826762241853, 0.44424700958760, 0.44038285956317};
462 std::copy(x_vector,x_vector + x_dimension,x.begin());
469 const double x_vector[] = {0.31624357647283069, 0.316243577414338339, 0.316243578012345927, 0.316243575664017895,
470 0.316243578205526066, 0.31624357738855069, 0.316243575472949512, 0.316243577164883938,
471 0.316243578155920302, 0.316243576147374916};
474 std::copy(x_vector,x_vector + x_dimension,x.begin());
481 const double x_vector[] = {78,33,29.9952560256815985,45,36.7758129057882073};
484 std::copy(x_vector,x_vector + x_dimension,x.begin());
491 const double x_vector[] = {679.945148297028709,1026.06697600004691,0.118876369094410433,-0.39623348521517826};
494 std::copy(x_vector,x_vector + x_dimension,x.begin());
501 const double x_vector[] = {14.09500000000000064,0.8429607892154795668};
504 std::copy(x_vector,x_vector + x_dimension,x.begin());
511 const double x_vector[] = {2.17199634142692, 2.3636830416034, 8.77392573913157, 5.09598443745173,
512 0.990654756560493, 1.43057392853463, 1.32164415364306, 9.82872576524495,
513 8.2800915887356, 8.3759266477347};
516 std::copy(x_vector,x_vector + x_dimension,x.begin());
523 const double x_vector[] = {1.22797135260752599, 4.24537336612274885};
526 std::copy(x_vector,x_vector + x_dimension,x.begin());
533 const double x_vector[] = {2.33049935147405174, 1.95137236847114592, -0.477541399510615805, 4.36572624923625874, -0.624486959100388983, 1.03813099410962173, 1.5942266780671519};
536 std::copy(x_vector,x_vector + x_dimension,x.begin());
543 const double x_vector[] = {579.306685017979589,1359.97067807935605,5109.97065743133317,182.01769963061534, 295.601173702746792, 217.982300369384632, 286.41652592786852, 395.601173702746735};
546 std::copy(x_vector,x_vector + x_dimension,x.begin());
553 const double x_vector[] = {-0.707036070037170616, 0.500000004333606807};
556 std::copy(x_vector,x_vector + x_dimension,x.begin());
563 const double x_vector[] = {5.,5.,5.};
566 std::copy(x_vector,x_vector + x_dimension,x.begin());
573 const double x_vector[] = {-1.71714224003, 1.59572124049468, 1.8272502406271, -0.763659881912867, -0.76365986736498};
576 std::copy(x_vector,x_vector + x_dimension,x.begin());
583 const double x_vector[] = {0.0406684113216282, 0.147721240492452, 0.783205732104114, 0.00141433931889084,
584 0.485293636780388, 0.000693183051556082, 0.0274052040687766, 0.0179509660214818,
585 0.0373268186859717, 0.0968844604336845};
588 std::copy(x_vector,x_vector + x_dimension,x.begin());
595 const double x_vector[] = {3.51212812611795133,0.216987510429556135,3.55217854929179921};
598 std::copy(x_vector,x_vector + x_dimension,x.begin());
605 const double x_vector[] = {705.174537070090537, 68.5999999999999943, 102.899999999999991, 282.324931593660324,
606 37.5841164258054832};
609 std::copy(x_vector,x_vector + x_dimension,x.begin());
616 const double x_vector[] = {201.784467214523659, 99.9999999999999005, 383.071034852773266, 420,
617 -10.9076584514292652, 0.0731482312084287128};
620 std::copy(x_vector,x_vector + x_dimension,x.begin());
627 const double x_vector[] = {-0.657776192427943163, -0.153418773482438542, 0.323413871675240938, -0.946257611651304398,
628 -0.657776194376798906, -0.753213434632691414, 0.323413874123576972, -0.346462947962331735,
629 0.59979466285217542};
632 std::copy(x_vector,x_vector + x_dimension,x.begin());
639 const double x_vector[] = {1.66991341326291344e-17, 3.95378229282456509e-16, 3.94599045143233784, 1.06036597479721211e-16,
640 3.2831773458454161, 9.99999999999999822, 1.12829414671605333e-17, 1.2026194599794709e-17,
641 2.50706276000769697e-15, 2.24624122987970677e-15, 0.370764847417013987, 0.278456024942955571,
642 0.523838487672241171, 0.388620152510322781,0.298156764974678579};
645 std::copy(x_vector,x_vector + x_dimension,x.begin());
652 const double x_vector[] = {1.28582343498528086e-18, 4.83460302526130664e-34, 0, 0, 6.30459929660781851e-18,
653 7.57192526201145068e-34, 5.03350698372840437e-34, 9.28268079616618064e-34, 0,
654 1.76723384525547359e-17, 3.55686101822965701e-34, 2.99413850083471346e-34, 0.158143376337580827,
655 2.29601774161699833e-19, 1.06106938611042947e-18, 1.31968344319506391e-18, 0.530902525044209539,
656 0, 2.89148310257773535e-18, 3.34892126180666159e-18, 0, 0.310999974151577319,
657 5.41244666317833561e-05, 4.84993165246959553e-16};
660 std::copy(x_vector,x_vector + x_dimension,x.begin());
667 const double x_vector[] = {193.724510070034967, 5.56944131553368433e-27, 17.3191887294084914, 100.047897801386839,
668 6.68445185362377892, 5.99168428444264833, 6.21451648886070451};
671 std::copy(x_vector,x_vector + x_dimension,x.begin());
678 const double x_vector[] = {236.430975504001054, 135.82847151732463, 204.818152544824585, 6446.54654059436416,
679 3007540.83940215595, 4074188.65771341929, 32918270.5028952882, 130.075408394314167,
680 170.817294970528621, 299.924591605478554, 399.258113423595205, 330.817294971142758,
681 184.51831230897065, 248.64670239647424, 127.658546694545862, 269.182627528746707,
682 160.000016724090955, 5.29788288102680571, 5.13529735903945728, 5.59531526444068827,
683 5.43444479314453499, 5.07517453535834395};
686 std::copy(x_vector,x_vector + x_dimension,x.begin());
693 const double x_vector[] = {0.00510000000000259465, 99.9947000000000514, 9.01920162996045897e-18, 99.9999000000000535,
694 0.000100000000027086086, 2.75700683389584542e-14, 99.9999999999999574, 200, 0.0100000100000100008};
697 std::copy(x_vector,x_vector + x_dimension,x.begin());
704 const double x_vector[] = {2.32952019747762,3.17849307411774};
707 std::copy(x_vector,x_vector + x_dimension,x.begin());
714 pagmo_throw(value_error,
"Error: There are only 24 test functions in this test suite!");
727 f[0] = 5.0 * (x[0] + x[1] + x[2] + x[3]) - 5.0 * (x[0] * x[0] + x[1] * x[1] + x[2] * x[2] + x[3] * x[3]);
729 for (decision_vector::size_type j = 4; j < 13; j++)
737 c[0] = 2.0 * x[0] + 2.0 * x[1] + x[9] + x[10] - 10.;
738 c[1] = 2.0 * x[0] + 2.0 * x[2] + x[9] + x[11] - 10.;
739 c[2] = 2.0 * x[1] + 2.0 * x[2] + x[10] + x[11] - 10.;
740 c[3] = -8.0 * x[0] + x[9];
741 c[4] = -8.0 * x[1] + x[10];
742 c[5] = -8.0 * x[2] + x[11];
743 c[6] = -2.0 * x[3] - x[4] + x[9];
744 c[7] = -2.0 * x[5] - x[6] + x[10];
745 c[8] = -2.0 * x[7] - x[8] + x[11];
760 for (
int j=0; j<nx; j++) {
761 f1 = f1 + pow(cos(x[j]), 4);
762 f2 = f2 * cos(x[j]) * cos(x[j]);
763 f3 = f3 + ((double) (j + 1)) * x[j] * x[j];
765 f[0] = - fabs((f1 - 2 * f2) / sqrt(f3));
777 for (
int j=0; j<nx; j++) {
783 c[1] = g2 - 7.5 * ((double) nx);
795 double f3 = sqrt((
double) nx);
797 for (
int j=0; j<nx; j++) {
811 for (
int j=0; j<nx; j++) {
812 f2 = f2 + x[j] * x[j];
825 f[0] = 5.3578547 * x[2] * x[2] + 0.8356891 * x[0] * x[4] + 37.293239 * x[0] - 40792.141;
832 c[0] = 85.334407 + 0.0056858 * x[1] * x[4] + 0.0006262 * x[0] * x[3] - 0.0022053 * x[2] * x[4] - 92.;
833 c[1] = -85.334407 - 0.0056858 * x[1] * x[4] - 0.0006262 * x[0] * x[3] + 0.0022053 * x[2] * x[4];
834 c[2] = 80.51249 + 0.0071317 * x[1] * x[4] + 0.0029955 * x[0] * x[1] + 0.0021813 * x[2] * x[2] - 110.;
835 c[3] = -80.51249 - 0.0071317 * x[1] * x[4] - 0.0029955 * x[0] * x[1] - 0.0021813 * x[2] * x[2] + 90.;
836 c[4] = 9.300961 + 0.0047026 * x[2] * x[4] + 0.0012547 * x[0] * x[2] + 0.0019085 * x[2] * x[3] - 25.;
837 c[5] = -9.300961 - 0.0047026 * x[2] * x[4] - 0.0012547 * x[0] * x[2] - 0.0019085 * x[2] * x[3] + 20.;
846 f[0] = 3.0 * x[0] + 0.000001 * pow(x[0], 3) + 2.0 * x[1] + (0.000002 / 3.0) * pow(x[1], 3);
853 c[0] = 1000.0 * sin(-x[2] - 0.25) + 1000.0 * sin(-x[3] - 0.25) + 894.8 - x[0];
854 c[1] = 1000.0 * sin(x[2] - 0.25) + 1000.0 * sin(x[2] - x[3] - 0.25) + 894.8 - x[1];
855 c[2] = 1000.0 * sin(x[3] - 0.25) + 1000.0 * sin(x[3] - x[2] - 0.25) + 1294.8;
858 c[3] = -x[3] + x[2] - 0.55;
859 c[4] = -x[2] + x[3] - 0.55;
868 f[0] = pow((x[0] - 10.), 3) + pow((x[1] - 20.), 3);
875 c[0] = 100. - (x[0] - 5.) * (x[0] - 5.) - (x[1] - 5.) * (x[1] - 5.);
876 c[1] = (x[0] - 6.) * (x[0] - 6.) + (x[1] - 5.) * (x[1] - 5.) - 82.81;
885 f[0] = x[0] * x[0] + x[1] * x[1] + x[0] * x[1] - 14.0 * x[0] - 16.0 * x[1] + (x[2] - 10.0) * (x[2] - 10.0) +
886 4.0 * (x[3] - 5.0) * (x[3] - 5.0) + (x[4] - 3.0) * (x[4] - 3.0) + 2.0 * (x[5] - 1.0) * (x[5] - 1.0) +
887 5.0 * x[6] * x[6] + 7.0 * (x[7] - 11) * (x[7] - 11) + 2.0 * (x[8] - 10.0) * (x[8] - 10.0) +
888 (x[9] - 7.0) * (x[9] - 7.0) + 45.;
895 c[0] = -105.0 + 4.0 * x[0] + 5.0 * x[1] - 3.0 * x[6] + 9.0 * x[7];
896 c[1] = 10.0 * x[0] - 8.0 * x[1] - 17.0 * x[6] + 2.0 * x[7];
897 c[2] = -8.0 * x[0] + 2.0 * x[1] + 5.0 * x[8] - 2.0 * x[9] - 12.0;
898 c[3] = 3.0 * (x[0] - 2.0) * (x[0] - 2.0) + 4.0 * (x[1] - 3.0) * (x[1] - 3.0) + 2.0 * x[2] * x[2] - 7.0 * x[3] - 120.0;
899 c[4] = 5.0 * x[0] * x[0] + 8.0 * x[1] + (x[2] - 6.0) * (x[2] - 6.0) - 2.0 * x[3] - 40.0;
900 c[5] = x[0] * x[0] + 2.0 * (x[1] - 2.0) * (x[1] - 2.0) - 2.0 * x[0] * x[1] + 14.0 * x[4] - 6.0 * x[5];
901 c[6] = 0.5 * (x[0] - 8.0) * (x[0] - 8.0) + 2.0 * (x[1] - 4.0) * (x[1] - 4.0) + 3.0 * x[4] * x[4] - x[5] - 30.0;
902 c[7] = -3.0 * x[0] + 6.0 * x[1] + 12.0 * (x[8] - 8.0) * (x[8] - 8.0) - 7.0 * x[9];
911 f[0] = - pow(sin(2 * PI * x[0]), 3) * sin (2 * PI * x[1]) / (pow(x[0], 3) * (x[0] + x[1]));
918 c[0] = x[0] * x[0] - x[1] + 1.0;
919 c[1] = 1.0 - x[0] + (x[1] - 4.0) * (x[1] - 4.0);
928 f[0] = (x[0] - 10.0) * (x[0] - 10.0) + 5.0 * (x[1] - 12.0) * (x[1] - 12.0) + pow(x[2], 4) +
929 3.0 * (x[3] - 11.0) * (x[3] - 11.0) + 10.0 * pow(x[4], 6) + 7.0 * x[5] * x[5] +
930 pow(x[6], 4) - 4.0 * x[5] * x[6] - 10.0 * x[5] - 8.0 * x[6];
937 c[0] = -127.0 + 2 * x[0] * x[0] + 3.0 * pow(x[1], 4) + x[2] + 4.0 * x[3] * x[3] + 5.0 * x[4];
938 c[1] = -282.0 + 7.0 * x[0] + 3.0 * x[1] + 10.0 * x[2] * x[2] + x[3] - x[4];
939 c[2] = -196.0 + 23.0 * x[0] + x[1] * x[1] + 6.0 * x[5] * x[5] - 8.0 * x[6];
940 c[3] = 4.0 * x[0] * x[0] + x[1] * x[1] - 3.0 * x[0] * x[1] + 2.0 * x[2] * x[2] + 5.0 * x[5] - 11.0 * x[6];
950 f[0] = x[0] + x[1] + x[2];
957 c[0] = -1.0 + 0.0025 * (x[3] + x[5]);
958 c[1] = -1.0 + 0.0025 * (x[4] + x[6] - x[3]);
959 c[2] = -1.0 + 0.01 * (x[7] - x[4]);
960 c[3] = -x[0] * x[5] + 833.33252 * x[3] + 100.0 * x[0] - 83333.333;
961 c[4] = -x[1] * x[6] + 1250.0 * x[4] + x[1] * x[3] - 1250.0 * x[3];
962 c[5] = -x[2] * x[7] + 1250000.0 + x[2] * x[4] - 2500.0 * x[4];
971 f[0] = x[0] * x[0] + (x[1] - 1.0) * (x[1] - 1.0);
978 c[0] = x[1] - x[0] * x[0];
987 f[0] = - (100. - (x[0] - 5.) * (x[0] - 5.) - (x[1] - 5.) * (x[1] - 5.) - (x[2] - 5.) * (x[2] - 5.)) / 100.;
996 c[0] = (x[0] - 1.) * (x[0] - 1.) + (x[1] - 1.) * (x[1] - 1.) + (x[2] - 1.) * (x[2] - 1.) - 0.0625;
997 for (
int i = 1; i <= 9; i++) {
998 for (
int j = 1; j <= 9; j++) {
999 for (
int k = 1; k <= 9; k++){
1000 gt = (x[0] - i) * (x[0] - i) + (x[1] - j) * (x[1] - j) + (x[2] - k) * (x[2] - k) - 0.0625;
1014 f[0] = exp(x[0] * x[1] * x[2] * x[3] * x[4]);
1021 c[0] = x[0] * x[0] + x[1] * x[1] + x[2] * x[2] + x[3] * x[3] + x[4] * x[4] - 10.0;
1022 c[1] = x[1] * x[2] - 5.0 * x[3] * x[4];
1023 c[2] = pow(x[0], 3) + pow(x[1], 3) + 1.0;
1033 double C[10] = {-6.089,-17.164,-34.054,-5.914,-24.721,-14.986,-24.100,-10.708,-26.662,-22.179};
1036 for (
int i = 0; i < 10; i++)
1038 for (
int i = 0; i < 10; i++)
1039 sum += x[i] * (C[i] + log (x[i] / sumlog));
1047 c[0] = x[0] + 2.0 * x[1] + 2.0 * x[2] + x[5] + x[9] - 2.0;
1048 c[1] = x[3] + 2.0 * x[4] + x[5] + x[6] - 1.0;
1049 c[2] = x[2] + x[6] + x[7] + 2.0 * x[8] + x[9] - 1.0;
1058 f[0] = 1000.0 - pow(x[0], 2.0) - 2.0 * x[1] * x[1] - x[2] * x[2] - x[0] * x[1] - x[0] * x[2];
1065 c[0] = pow(x[0], 2.0) + pow(x[1], 2.0) + pow(x[2], 2.0) - 25.0;
1066 c[1] = 8.0 * x[0] + 14.0 * x[1] + 7.0 * x[2] - 56.0;
1074 double C[17], Y[17];
1082 Y[0] = x2 + x3 + 41.6;
1083 C[0] = 0.024 * x4 - 4.62;
1084 Y[1] = (12.5 / C[0]) + 12.0;
1085 C[1] = 0.0003535 * pow(x1, 2.0) + 0.5311 * x1 + 0.08705 * Y[1] * x1;
1086 C[2] = 0.052 * x1 + 78.0 + 0.002377 * Y[1] * x1;
1089 C[3] = 0.04782 * (x1 - Y[2]) + ((0.1956 * pow(x1 - Y[2], 2.0)) / x2) + 0.6376 * Y[3] + 1.594 * Y[2];
1091 C[5] = x1 - Y[2] - Y[3];
1092 C[6] = 0.950 - (C[3] / C[4]);
1094 Y[5] = x1 - Y[4] - Y[3] - Y[2];
1095 C[7] = (Y[4] + Y[3]) * 0.995;
1097 Y[7] = C[7] / 3798.0;
1098 C[8] = Y[6] - (0.0663 * Y[6] / Y[7]) - 0.3153;
1099 Y[8] = (96.82 / C[8]) + 0.321 * Y[0];
1100 Y[9] = 1.29 * Y[4] + 1.258 * Y[3] + 2.29 * Y[2] + 1.71 * Y[5];
1101 Y[10] = 1.71 * x1 - 0.452 * Y[3] + 0.580 * Y[2];
1102 C[9] = 12.3 / 752.3;
1103 C[10] = 1.75 * Y[1] * 0.995 * x1;
1104 C[11] = 0.995 * Y[9] + 1998.0;
1105 Y[11] = C[9] * x1 + (C[10] / C[11]);
1106 Y[12] = C[11] - 1.75 * Y[1];
1107 Y[13] = 3623.0 + 64.4 * x2 + 58.4 * x3 + (146312.0 / (Y[8] + x5));
1108 C[12] = 0.995 * Y[9] + 60.8 * x2 + 48 * x4 - 0.1121 * Y[13] - 5095.0;
1109 Y[14] = Y[12] / C[12];
1110 Y[15] = 148000.0 - 331000.0 * Y[14] + 40.0 * Y[12] - 61.0 * Y[14] * Y[12];
1111 C[13] = 2324 * Y[9] - 28740000 * Y[1];
1112 Y[16] = 14130000 - 1328.0 * Y[9] - 531.0 * Y[10] + (C[13] / C[11]);
1113 C[14] = (Y[12] / Y[14]) - (Y[12] / 0.52);
1114 C[15] = 1.104 - 0.72 * Y[14];
1118 f[0] = 0.0000005843 * Y[16] - 0.000117 * Y[13] - 0.1365 - 0.00002358 * Y[12] - 0.000001502 * Y[15] - 0.0321 * Y[11] - 0.004324 * Y[4] - 0.0001 * (C[14] / C[15]) - 37.48 * (Y[1] / C[11]);
1134 Y[0] = x2 + x3 + 41.6;
1135 C[0] = 0.024 * x4 - 4.62;
1136 Y[1] = (12.5 / C[0]) + 12.0;
1137 C[1] = 0.0003535 * pow(x1, 2.0) + 0.5311 * x1 + 0.08705 * Y[1] * x1;
1138 C[2] = 0.052 * x1 + 78.0 + 0.002377 * Y[1] * x1;
1141 C[3] = 0.04782 * (x1 - Y[2]) + ((0.1956 * pow(x1 - Y[2], 2.0)) / x2) + 0.6376 * Y[3] + 1.594 * Y[2];
1143 C[5] = x1 - Y[2] - Y[3];
1144 C[6] = 0.950 - (C[3] / C[4]);
1146 Y[5] = x1 - Y[4] - Y[3] - Y[2];
1147 C[7] = (Y[4] + Y[3]) * 0.995;
1149 Y[7] = C[7] / 3798.0;
1150 C[8] = Y[6] - (0.0663 * Y[6] / Y[7]) - 0.3153;
1151 Y[8] = (96.82 / C[8]) + 0.321 * Y[0];
1152 Y[9] = 1.29 * Y[4] + 1.258 * Y[3] + 2.29 * Y[2] + 1.71 * Y[5];
1153 Y[10] = 1.71 * x1 - 0.452 * Y[3] + 0.580 * Y[2];
1154 C[9] = 12.3 / 752.3;
1155 C[10] = 1.75 * Y[1] * 0.995 * x1;
1156 C[11] = 0.995 * Y[9] + 1998.0;
1157 Y[11] = C[9] * x1 + (C[10] / C[11]);
1158 Y[12] = C[11] - 1.75 * Y[1];
1159 Y[13] = 3623.0 + 64.4 * x2 + 58.4 * x3 + (146312.0 / (Y[8] + x5));
1160 C[12] = 0.995 * Y[9] + 60.8 * x2 + 48 * x4 - 0.1121 * Y[13] - 5095.0;
1161 Y[14] = Y[12] / C[12];
1162 Y[15] = 148000.0 - 331000.0 * Y[14] + 40.0 * Y[12] - 61.0 * Y[14] * Y[12];
1163 C[13] = 2324.0 * Y[9] - 28740000.0 * Y[1];
1164 Y[16] = 14130000 - 1328.0 * Y[9] - 531.0 * Y[10] + (C[13] / C[11]);
1165 C[14] = (Y[12] / Y[14]) - (Y[12] / 0.52);
1166 C[15] = 1.104 - 0.72 * Y[14];
1170 c[0] = -Y[3] + (0.28 / 0.72) * Y[4];
1171 c[1] = -1.5 * x2 + x3;
1172 c[2] = -21.0 + 3496.0 * (Y[1] / C[11]);
1173 c[3] = -(62212.0 / C[16]) + 110.6 + Y[0];
1174 c[4] = 213.1 - Y[0];
1175 c[5] = Y[0] - 405.23;
1176 c[6] = 17.505 - Y[1];
1177 c[7] = Y[1] - 1053.6667;
1178 c[8] = 11.275 - Y[2];
1179 c[9] = Y[2] - 35.03;
1180 c[10] = 214.228 - Y[3];
1181 c[11] = Y[3] - 665.585;
1182 c[12] = 7.458 - Y[4];
1183 c[13] = Y[4] - 584.463;
1184 c[14] = 0.961 - Y[5];
1185 c[15] = Y[5] - 265.916;
1186 c[16] = 1.612 - Y[6];
1187 c[17] = Y[6] - 7.046;
1188 c[18] = 0.146 - Y[7];
1189 c[19] = Y[7] - 0.222;
1190 c[20] = 107.99 - Y[8];
1191 c[21] = Y[8] - 273.366;
1192 c[22] = 922.693 - Y[9];
1193 c[23] = Y[9] - 1286.105;
1194 c[24] = 926.832 - Y[10];
1195 c[25] = Y[10] - 1444.046;
1196 c[26] = 18.766 - Y[11];
1197 c[27] = Y[11] - 537.141;
1198 c[28] = 1072.163 - Y[12];
1199 c[29] = Y[12] - 3247.039;
1200 c[30] = 8961.448 - Y[13];
1201 c[31] = Y[13] - 26844.086;
1202 c[32] = 0.063 - Y[14];
1203 c[33] = Y[14] - 0.386;
1204 c[34] = 71084.33 - Y[15];
1205 c[35] = Y[15] - 140000.0;
1206 c[36] = 2802713.0 - Y[16];
1207 c[37] = Y[16] - 12146108.0;
1224 double aux1 = 300.0 - (((x3 * x4) * cos(1.48477 - x6)) - ((0.90798 * pow(x3, 2.0)) * cos(1.47588))) / 131.078;
1225 double aux2 = -(((x3 * x4) * cos(1.48477 + x6)) - ((0.90798 * pow(x4, 2.0)) * cos(1.47588)))/ 131.078;
1228 if (x1 >= 0.0 && x1 < 300.0) {
1231 if (x1 >= 300.0 && x1 <= 400.0) {
1235 if (x2 >= 0.0 && x2 < 100.0) {
1238 if (x2 >= 100.0 && x2 < 200.0) {
1241 if (x2 >= 200.0 && x2 <= 1000.0) {
1259 double aux1 = 300.0 - (((x3 * x4) * cos (1.48477 - x6)) - ((0.90798 * pow (x3, 2.0)) * cos (1.47588))) / 131.078;
1260 double aux2 = -(((x3 * x4) * cos (1.48477 + x6)) - ((0.90798 * pow (x4, 2.0)) * cos (1.47588)))/ 131.078;
1261 double aux5 = -(((x3 * x4) * sin (1.48477 + x6)) - ((0.90798 * pow (x4, 2.0)) * sin (1.47588)))/ 131.078;
1262 double aux4 = 200.0 - (((x3 * x4) * sin (1.48477 - x6)) - ((0.90798 * pow (x3, 2.0)) * sin (1.47588)))/ 131.078;
1277 f[0] = - 0.5 * (x[0] * x[3] - x[1] * x[2] + x[2] * x[8] - x[4] * x[8] + x[4] * x[7] - x[5] * x[6]);
1284 c[0] = -1.0 + pow(x[2], 2.0) + pow(x[3], 2.0);
1285 c[1] = -1.0 + pow(x[8], 2.0);
1286 c[2] = -1.0 + pow(x[4], 2.0) + pow(x[5], 2.0);
1287 c[3] = -1.0 + pow(x[0], 2.0) + pow(x[1] - x[8], 2.0);
1288 c[4] = -1.0 + pow(x[0] - x[4], 2.0) + pow(x[1] - x[5], 2.0);
1289 c[5] = -1.0 + pow(x[0] - x[6], 2.0) + pow(x[1] - x[7], 2.0);
1290 c[6] = -1.0 + pow(x[2] - x[4], 2.0) + pow(x[3] - x[5], 2.0);
1291 c[7] = -1.0 + pow(x[2] - x[6], 2.0) + pow(x[3] - x[7], 2.0);
1292 c[8] = -1.0 + pow(x[6], 2.0) + pow(x[7] - x[8], 2.0);
1293 c[9] = -x[0] * x[3] + x[1] * x[2];
1294 c[10] = -x[2] * x[8];
1295 c[11] = x[4] * x[8];
1296 c[12] = -x[4] * x[7] + x[5] * x[6];
1308 double B[10] = {-40.0,-2.0,-0.25,-4.0,-4.0,-1.0,-40.0,-60.0,5.0,1.0};
1309 double C[5][5] = {{30.0,-20.0,-10.0,32.0,-10.0},
1310 {-20.0,39.0,-6.0,-31.0,32.0},
1311 {-10.0,-6.0,10.0,-6.0,-10.0},
1312 {32.0,-31.0,-6.0,39.0,-20.0},
1313 {-10.0,32.0,-10.0,-20.0,30.0}
1315 double D[5] = {4.0,8.0,10.0,6.0,2.0};
1318 for (
int i=0; i<10; i++) {
1319 sum1 += B[i] * x[i];
1321 for (
int i=0; i<5; i++) {
1322 for (
int j = 0; j < 5; j++) {
1323 sum2 += C[i][j] * x[10 + i] * x[10 + j];
1326 for (
int i=0; i<5; i++) {
1327 sum3 += D[i] * pow (x[10 + i], 3.0);
1330 f[0] = sum1 - sum2 - 2.0 * sum3;
1340 double A[10][5] = {{-16.0,2.0,0.0,1.0,0.0},
1341 {0.0,-2.0,0.0,0.4,2.0},
1342 {-3.5,0.0,2.0,0.0,0.0},
1343 {0.0,-2.0,0.0,-4.0,-1.0},
1344 {0.0,-9.0,-2.0,1.0,-2.8},
1345 {2.0,0.0,-4.0,0.0,0.0},
1346 {-1.0,-1.0,-1.0,-1.0,-1.0},
1347 {-1.0,-2.0,-3.0,-2.0,-1.0},
1348 {1.0,2.0,3.0,4.0,5.0},
1349 {1.0,1.0,1.0,1.0,1.0}
1352 double C[5][5] = {{30.0,-20.0,-10.0,32.0,-10.0},
1353 {-20.0,39.0,-6.0,-31.0,32.0},
1354 {-10.0,-6.0,10.0,-6.0,-10.0},
1355 {32.0,-31.0,-6.0,39.0,-20.0},
1356 {-10.0,32.0,-10.0,-20.0,30.0}
1359 double D[5] = {4.0,8.0,10.0,6.0,2.0};
1360 double E[5] = {-15.0,-27.0,-36.0,-18.0,-12.0};
1363 for (
int j = 0; j < 5; j++) {
1365 for (
int i = 0; i < 5; i++)
1366 sum1 += C[i][j] * x[10 + i];
1368 for (
int i = 0; i < 10; i++)
1369 sum2 += A[i][j] * x[i];
1370 c[j] = -((2.0 * sum1) + (3.0 * D[j] * pow (x[10 + j], 2.0)) + E[j] - sum2);
1379 double A[24] = {0.0693,0.0577,0.05,0.2,0.26,0.55,0.06,0.1,0.12,0.18,0.1,0.09,
1380 0.0693,0.0577,0.05,0.2,0.26,0.55,0.06,0.1,0.12,0.18,0.1,0.09};
1384 for (
int j=0; j<24; j++) {
1385 f[0] += A[j] * x[j];
1392 double sum1, sum2, sumtotal;
1394 double B[24] = {44.094,58.12,58.12,137.4,120.9,170.9,62.501,84.94,133.425,82.507,46.07,60.097,
1395 44.094,58.12,58.12,137.4,120.9,170.9,62.501,84.94,133.425,82.507,46.07,60.097};
1396 double C[12] = {123.7,31.7,45.7,14.7,84.7,27.7,49.7,7.1,2.1,17.7,0.85,0.64};
1397 double D[12] = {31.244,36.12,34.784,92.7,82.7,91.6,56.708,82.7,80.8,64.517,49.4,49.1};
1398 double E[6] = {0.1,0.3,0.4,0.3,0.6,0.3};
1402 for (
int j = 0; j < 12; j++)
1403 sum1 += x[j] / B[j];
1405 for (
int j = 12; j < 24; j++)
1406 sum2 += x[j] / B[j];
1407 for (
int i = 0; i < 12; i++)
1408 c[i] = (x[i + 12] / (B[i + 12] * sum2)) - ((C[i] * x[i]) / (40.0 * B[i] * sum1));
1410 for (
int j = 0; j < 24; j++)
1412 c[12] = sumtotal - 1.0;
1414 for (
int j = 0; j < 12; j++)
1415 sum1 += x[j] / D[j];
1417 for (
int j = 12; j < 24; j++)
1418 sum2 += x[j] / B[j];
1419 c[13] = sum1 + (0.7302 * 530.0 * (14.7 / 40)) * sum2 - 1.671;
1422 for (
int j = 0; j < 3; j++)
1423 c[14 + j] = (x[j] + x[j + 12]) / (sumtotal + E[j]);
1424 for (
int j = 3; j < 6; j++)
1425 c[14 + j] = (x[j + 3] + x[j + 15]) / (sumtotal + E[j]);
1441 c[0] = -300.0 * x[2] + 7500 * x[4] - 7500 * x[5] - 25.0 * x[3] * x[4] + 25.0 * x[3] * x[5] + x[2] * x[3];
1442 c[1] = 100.0 * x[1] + 155.365 * x[3] + 2500 * x[6] - x[1] * x[3] - 25.0 * x[3] * x[6] - 15536.5;
1443 c[2] = -x[4] + log(-x[3] + 900.0);
1444 c[3] = -x[5] + log(x[3] + 300.0);
1445 c[4] = -x[6] + log(-2.0 * x[3] + 700.0);
1448 c[5] = -x[0] + 35.0 * pow(x[1], 0.6) + 35.0 * pow(x[2], 0.6);
1464 c[0] = x[4] - 100000.0 * x[7] + 10000000.0;
1465 c[1] = x[5] + 100000.0 * x[7] - 100000.0 * x[8];
1466 c[2] = x[6] + 100000.0 * x[8] - 50000000.0;
1467 c[3] = x[4] + 100000.0 * x[9] - 33000000.0;
1468 c[4] = x[5] + 100000 * x[10] - 44000000.0;
1469 c[5] = x[6] + 100000 * x[11] - 66000000.0;
1470 c[6] = x[4] - 120.0 * x[1] * x[12];
1471 c[7] = x[5] - 80.0 * x[2] * x[13];
1472 c[8] = x[6] - 40.0 * x[3] * x[14];
1473 c[9] = x[7] - x[10] + x[15];
1474 c[10] = x[8] - x[11] + x[16];
1475 c[11] = -x[17] + log(x[9] - 100.0);
1476 c[12] = -x[18] + log(-x[7] + 300.0);
1477 c[13] = -x[19] + log(x[15]);
1478 c[14] = -x[20] + log(-x[8] + 400.0);
1479 c[15] = -x[21] + log(x[16]);
1480 c[16] = -x[7] - x[9] + x[12] * x[17] - x[12] * x[18] + 400.0;
1481 c[17] = x[7] - x[8] - x[10] + x[13] * x[19] - x[13] * x[20] + 400.0;
1482 c[18] = x[8] - x[11] - 4.60517 * x[14] + x[14] * x[21] + 100.0;
1485 c[19] = -x[0] + pow(x[1], 0.6) + pow(x[2], 0.6) + pow(x[3], 0.6);
1494 f[0] = -9.0 * x[4] - 15.0 * x[7] + 6.0 * x[0] + 16.0 * x[1] + 10.0 * (x[5] + x[6]);
1501 c[0] = x[0] + x[1] - x[2] - x[3];
1502 c[1] = 0.03 * x[0] + 0.01 * x[1] - x[8] * (x[2] + x[3]);
1503 c[2] = x[2] + x[5] - x[4];
1504 c[3] = x[3] + x[6] - x[7];
1507 c[4] = x[8] * x[2] + 0.02 * x[5] - 0.025 * x[4];
1508 c[5] = x[8] * x[3] + 0.02 * x[6] - 0.015 * x[7];
1517 f[0] = -x[0] - x[1];
1524 c[0] = -2.0 * pow (x[0], 4.0) + 8.0 * pow (x[0], 3.0) - 8.0 * pow (x[0], 2.0) + x[1] - 2.0;
1525 c[1] = -4.0 * pow (x[0], 4.0) + 32.0 * pow (x[0], 3.0) - 88.0 * pow (x[0], 2.0) + 96.0 * x[0] + x[1] - 36.0;
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
std::vector< double > decision_vector
Decision vector type.
std::string get_name() const
Get problem's name.
void set_best_x(const std::vector< decision_vector > &)
Sets the best known decision vectors.
size_type get_dimension() const
Return global dimension.
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
The CEC 2006 problems: Constrained Real-Parameter Optimization.
std::vector< double > fitness_vector
Fitness vector type.
base_ptr clone() const
Clone method.
std::vector< double > constraint_vector
Constraint vector type.
void compute_constraints_impl(constraint_vector &, const decision_vector &) const
Implementation of the constraint function.
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.
cec2006(int=1)
Constructor.