PaGMO  1.1.5
cec2006.cpp
1 /*****************************************************************************
2  * Copyright (C) 2004-2015 The PaGMO development team, *
3  * Advanced Concepts Team (ACT), European Space Agency (ESA) *
4  * *
5  * https://github.com/esa/pagmo *
6  * *
7  * act@esa.int *
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this program; if not, write to the *
21  * Free Software Foundation, Inc., *
22  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
23  *****************************************************************************/
24 
25 #include <boost/math/constants/constants.hpp>
26 
27 #include "../exceptions.h"
28 #include "../types.h"
29 #include "base.h"
30 #include "cec2006.h"
31 
32 static int __check__(int N)
33 {
34  if (N > 24 || N < 1) {
35  pagmo_throw(value_error, "the problem id needs to be one of [1..24]");
36  }
37  return N;
38 }
39 
40 static const std::vector<double> __constraint_tolerances__(int c_dimension, int ic_dimension)
41 {
42  std::vector<double> constraint_tolerances(c_dimension);
43  // equality constraints
44  for(int i=0; i<c_dimension-ic_dimension; i++) {
45  constraint_tolerances[i] = 0.0001;
46  }
47  // inequality constraints
48  for(int i=c_dimension-ic_dimension; i<c_dimension; i++) {
49  constraint_tolerances[i] = 0.;
50  }
51  return constraint_tolerances;
52 }
53 
54 namespace pagmo { namespace problem {
55 
56 static const double PI = boost::math::constants::pi<double>();
57 
58 // initialization of the problems, global constraints and inequality constraints dimension
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};
65 
67 
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))
73 {
74  // initialize best solution
75  initialize_best();
76 
77  // set the bounds for the current problem
78  switch(m_problem_number)
79  {
80  case 1:
81  {
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.};
84  set_bounds(lb,ub);
85  break;
86  }
87  case 2:
88  {
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.};
91  set_bounds(lb,ub);
92  break;
93  }
94  case 3:
95  {
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.};
98  set_bounds(lb,ub);
99  break;
100  }
101  case 4:
102  {
103  const double lb[] = {78.,33.,27.,27.,27.};
104  const double ub[] = {102.,45.,45.,45.,45.};
105  set_bounds(lb,ub);
106  break;
107  }
108  case 5:
109  {
110  const double lb[] = {0.,0.,-0.55,-0.55};
111  const double ub[] = {1200.,1200.,0.55,0.55};
112 
113  set_bounds(lb,ub);
114  break;
115  }
116  case 6:
117  {
118  const double lb[] = {13.,0.};
119  const double ub[] = {100.,100.};
120  set_bounds(lb,ub);
121  break;
122  }
123  case 7:
124  {
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.};
127  set_bounds(lb,ub);
128  break;
129  }
130  case 8:
131  {
132  const double lb[] = {0.,0.};
133  const double ub[] = {10.,10.};
134  set_bounds(lb,ub);
135  break;
136  }
137  case 9:
138  {
139  const double lb[] = {-10.,-10.,-10.,-10.,-10.,-10.,-10.};
140  const double ub[] = {10.,10.,10.,10.,10.,10.,10.};
141  set_bounds(lb,ub);
142  break;
143  }
144  case 10:
145  {
146  const double lb[] = {100.,1000.,1000.,10.,10.,10.,10.,10.};
147  const double ub[] = {10000.,10000.,10000.,1000.,1000.,1000.,1000.,1000.};
148  set_bounds(lb,ub);
149  break;
150  }
151  case 11:
152  {
153  const double lb[] = {-1.,-1.};
154  const double ub[] = {1.,1.};
155  set_bounds(lb,ub);
156  break;
157  }
158  case 12:
159  {
160  const double lb[] = {0.,0.,0.};
161  const double ub[] = {10.,10.,10.};
162  set_bounds(lb,ub);
163  break;
164  }
165  case 13:
166  {
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};
169  set_bounds(lb,ub);
170  break;
171  }
172  case 14:
173  {
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.};
176  set_bounds(lb,ub);
177  break;
178  }
179  case 15:
180  {
181  const double lb[] = {0.,0.,0.};
182  const double ub[] = {10.,10.,10.};
183  set_bounds(lb,ub);
184  break;
185  }
186  case 16:
187  {
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};
190  set_bounds(lb,ub);
191  break;
192  }
193  case 17:
194  {
195  const double lb[] = {0.,0.,340.,340.,-1000.,0.};
196  const double ub[] = {400.,1000.,420.,420.,1000.,0.5236};
197  set_bounds(lb,ub);
198  break;
199  }
200  case 18:
201  {
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.};
204  set_bounds(lb,ub);
205  break;
206  }
207  case 19:
208  {
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.};
211  set_bounds(lb,ub);
212  break;
213  }
214  case 20:
215  {
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.};
218  set_bounds(lb,ub);
219  break;
220  }
221  case 21:
222  {
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};
225  set_bounds(lb,ub);
226  break;
227  }
228  case 22:
229  {
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};
232  set_bounds(lb,ub);
233  break;
234  }
235  case 23:
236  {
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};
239  set_bounds(lb,ub);
240  break;
241  }
242  case 24:
243  {
244  const double lb[] = {0.,0.};
245  const double ub[] = {3.,4.};
246  set_bounds(lb,ub);
247  break;
248  }
249  default:
250  pagmo_throw(value_error, "Error: There are only 24 test functions in this test suite!");
251  break;
252  }
253 }
254 
257 {
258  return base_ptr(new cec2006(*this));
259 }
260 
263 {
264  switch(m_problem_number)
265  {
266  case 1:
267  g01_objfun_impl(f,x);
268  break;
269  case 2:
270  g02_objfun_impl(f,x);
271  break;
272  case 3:
273  g03_objfun_impl(f,x);
274  break;
275  case 4:
276  g04_objfun_impl(f,x);
277  break;
278  case 5:
279  g05_objfun_impl(f,x);
280  break;
281  case 6:
282  g06_objfun_impl(f,x);
283  break;
284  case 7:
285  g07_objfun_impl(f,x);
286  break;
287  case 8:
288  g08_objfun_impl(f,x);
289  break;
290  case 9:
291  g09_objfun_impl(f,x);
292  break;
293  case 10:
294  g10_objfun_impl(f,x);
295  break;
296  case 11:
297  g11_objfun_impl(f,x);
298  break;
299  case 12:
300  g12_objfun_impl(f,x);
301  break;
302  case 13:
303  g13_objfun_impl(f,x);
304  break;
305  case 14:
306  g14_objfun_impl(f,x);
307  break;
308  case 15:
309  g15_objfun_impl(f,x);
310  break;
311  case 16:
312  g16_objfun_impl(f,x);
313  break;
314  case 17:
315  g17_objfun_impl(f,x);
316  break;
317  case 18:
318  g18_objfun_impl(f,x);
319  break;
320  case 19:
321  g19_objfun_impl(f,x);
322  break;
323  case 20:
324  g20_objfun_impl(f,x);
325  break;
326  case 21:
327  g21_objfun_impl(f,x);
328  break;
329  case 22:
330  g22_objfun_impl(f,x);
331  break;
332  case 23:
333  g23_objfun_impl(f,x);
334  break;
335  case 24:
336  g24_objfun_impl(f,x);
337  break;
338  default:
339  pagmo_throw(value_error, "Error: There are only 24 test functions in this test suite!");
340  break;
341  }
342 }
343 
346 {
347  switch(m_problem_number)
348  {
349  case 1:
350  g01_compute_constraints_impl(c,x);
351  break;
352  case 2:
353  g02_compute_constraints_impl(c,x);
354  break;
355  case 3:
356  g03_compute_constraints_impl(c,x);
357  break;
358  case 4:
359  g04_compute_constraints_impl(c,x);
360  break;
361  case 5:
362  g05_compute_constraints_impl(c,x);
363  break;
364  case 6:
365  g06_compute_constraints_impl(c,x);
366  break;
367  case 7:
368  g07_compute_constraints_impl(c,x);
369  break;
370  case 8:
371  g08_compute_constraints_impl(c,x);
372  break;
373  case 9:
374  g09_compute_constraints_impl(c,x);
375  break;
376  case 10:
377  g10_compute_constraints_impl(c,x);
378  break;
379  case 11:
380  g11_compute_constraints_impl(c,x);
381  break;
382  case 12:
383  g12_compute_constraints_impl(c,x);
384  break;
385  case 13:
386  g13_compute_constraints_impl(c,x);
387  break;
388  case 14:
389  g14_compute_constraints_impl(c,x);
390  break;
391  case 15:
392  g15_compute_constraints_impl(c,x);
393  break;
394  case 16:
395  g16_compute_constraints_impl(c,x);
396  break;
397  case 17:
398  g17_compute_constraints_impl(c,x);
399  break;
400  case 18:
401  g18_compute_constraints_impl(c,x);
402  break;
403  case 19:
404  g19_compute_constraints_impl(c,x);
405  break;
406  case 20:
407  g20_compute_constraints_impl(c,x);
408  break;
409  case 21:
410  g21_compute_constraints_impl(c,x);
411  break;
412  case 22:
413  g22_compute_constraints_impl(c,x);
414  break;
415  case 23:
416  g23_compute_constraints_impl(c,x);
417  break;
418  case 24:
419  g24_compute_constraints_impl(c,x);
420  break;
421  default:
422  pagmo_throw(value_error, "Error: There are only 24 test functions in this test suite!");
423  break;
424  }
425 }
426 
427 std::string cec2006::get_name() const
428 {
429  std::string retval("CEC2006 - g");
430  retval.append(boost::lexical_cast<std::string>(m_problem_number));
431 
432  return retval;
433 }
434 
435 void cec2006::initialize_best(void)
436 {
437  std::vector<decision_vector> best_x;
438 
439  int x_dimension = m_problems_dimension[m_problem_number - 1];
440 
441  switch(m_problem_number)
442  {
443  case 1:
444  {
445  const double x_vector[] = {1.,1.,1.,1.,1.,1.,1.,1.,1.,3.,3.,3.,1.};
446 
447  decision_vector x(x_dimension);
448  std::copy(x_vector,x_vector + x_dimension,x.begin());
449  best_x.push_back(x);
450 
451  break;
452  }
453  case 2:
454  {
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};
460 
461  decision_vector x(x_dimension);
462  std::copy(x_vector,x_vector + x_dimension,x.begin());
463  best_x.push_back(x);
464 
465  break;
466  }
467  case 3:
468  {
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};
472 
473  decision_vector x(x_dimension);
474  std::copy(x_vector,x_vector + x_dimension,x.begin());
475  best_x.push_back(x);
476 
477  break;
478  }
479  case 4:
480  {
481  const double x_vector[] = {78,33,29.9952560256815985,45,36.7758129057882073};
482 
483  decision_vector x(x_dimension);
484  std::copy(x_vector,x_vector + x_dimension,x.begin());
485  best_x.push_back(x);
486 
487  break;
488  }
489  case 5:
490  {
491  const double x_vector[] = {679.945148297028709,1026.06697600004691,0.118876369094410433,-0.39623348521517826};
492 
493  decision_vector x(x_dimension);
494  std::copy(x_vector,x_vector + x_dimension,x.begin());
495  best_x.push_back(x);
496 
497  break;
498  }
499  case 6:
500  {
501  const double x_vector[] = {14.09500000000000064,0.8429607892154795668};
502 
503  decision_vector x(x_dimension);
504  std::copy(x_vector,x_vector + x_dimension,x.begin());
505  best_x.push_back(x);
506 
507  break;
508  }
509  case 7:
510  {
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};
514 
515  decision_vector x(x_dimension);
516  std::copy(x_vector,x_vector + x_dimension,x.begin());
517  best_x.push_back(x);
518 
519  break;
520  }
521  case 8:
522  {
523  const double x_vector[] = {1.22797135260752599, 4.24537336612274885};
524 
525  decision_vector x(x_dimension);
526  std::copy(x_vector,x_vector + x_dimension,x.begin());
527  best_x.push_back(x);
528 
529  break;
530  }
531  case 9:
532  {
533  const double x_vector[] = {2.33049935147405174, 1.95137236847114592, -0.477541399510615805, 4.36572624923625874, -0.624486959100388983, 1.03813099410962173, 1.5942266780671519};
534 
535  decision_vector x(x_dimension);
536  std::copy(x_vector,x_vector + x_dimension,x.begin());
537  best_x.push_back(x);
538 
539  break;
540  }
541  case 10:
542  {
543  const double x_vector[] = {579.306685017979589,1359.97067807935605,5109.97065743133317,182.01769963061534, 295.601173702746792, 217.982300369384632, 286.41652592786852, 395.601173702746735};
544 
545  decision_vector x(x_dimension);
546  std::copy(x_vector,x_vector + x_dimension,x.begin());
547  best_x.push_back(x);
548 
549  break;
550  }
551  case 11:
552  {
553  const double x_vector[] = {-0.707036070037170616, 0.500000004333606807};
554 
555  decision_vector x(x_dimension);
556  std::copy(x_vector,x_vector + x_dimension,x.begin());
557  best_x.push_back(x);
558 
559  break;
560  }
561  case 12:
562  {
563  const double x_vector[] = {5.,5.,5.};
564 
565  decision_vector x(x_dimension);
566  std::copy(x_vector,x_vector + x_dimension,x.begin());
567  best_x.push_back(x);
568 
569  break;
570  }
571  case 13:
572  {
573  const double x_vector[] = {-1.71714224003, 1.59572124049468, 1.8272502406271, -0.763659881912867, -0.76365986736498};
574 
575  decision_vector x(x_dimension);
576  std::copy(x_vector,x_vector + x_dimension,x.begin());
577  best_x.push_back(x);
578 
579  break;
580  }
581  case 14:
582  {
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};
586 
587  decision_vector x(x_dimension);
588  std::copy(x_vector,x_vector + x_dimension,x.begin());
589  best_x.push_back(x);
590 
591  break;
592  }
593  case 15:
594  {
595  const double x_vector[] = {3.51212812611795133,0.216987510429556135,3.55217854929179921};
596 
597  decision_vector x(x_dimension);
598  std::copy(x_vector,x_vector + x_dimension,x.begin());
599  best_x.push_back(x);
600 
601  break;
602  }
603  case 16:
604  {
605  const double x_vector[] = {705.174537070090537, 68.5999999999999943, 102.899999999999991, 282.324931593660324,
606  37.5841164258054832};
607 
608  decision_vector x(x_dimension);
609  std::copy(x_vector,x_vector + x_dimension,x.begin());
610  best_x.push_back(x);
611 
612  break;
613  }
614  case 17:
615  {
616  const double x_vector[] = {201.784467214523659, 99.9999999999999005, 383.071034852773266, 420,
617  -10.9076584514292652, 0.0731482312084287128};
618 
619  decision_vector x(x_dimension);
620  std::copy(x_vector,x_vector + x_dimension,x.begin());
621  best_x.push_back(x);
622 
623  break;
624  }
625  case 18:
626  {
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};
630 
631  decision_vector x(x_dimension);
632  std::copy(x_vector,x_vector + x_dimension,x.begin());
633  best_x.push_back(x);
634 
635  break;
636  }
637  case 19:
638  {
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};
643 
644  decision_vector x(x_dimension);
645  std::copy(x_vector,x_vector + x_dimension,x.begin());
646  best_x.push_back(x);
647 
648  break;
649  }
650  case 20:
651  {
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};
658 
659  decision_vector x(x_dimension);
660  std::copy(x_vector,x_vector + x_dimension,x.begin());
661  best_x.push_back(x);
662 
663  break;
664  }
665  case 21:
666  {
667  const double x_vector[] = {193.724510070034967, 5.56944131553368433e-27, 17.3191887294084914, 100.047897801386839,
668  6.68445185362377892, 5.99168428444264833, 6.21451648886070451};
669 
670  decision_vector x(x_dimension);
671  std::copy(x_vector,x_vector + x_dimension,x.begin());
672  best_x.push_back(x);
673 
674  break;
675  }
676  case 22:
677  {
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};
684 
685  decision_vector x(x_dimension);
686  std::copy(x_vector,x_vector + x_dimension,x.begin());
687  best_x.push_back(x);
688 
689  break;
690  }
691  case 23:
692  {
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};
695 
696  decision_vector x(x_dimension);
697  std::copy(x_vector,x_vector + x_dimension,x.begin());
698  best_x.push_back(x);
699 
700  break;
701  }
702  case 24:
703  {
704  const double x_vector[] = {2.32952019747762,3.17849307411774};
705 
706  decision_vector x(x_dimension);
707  std::copy(x_vector,x_vector + x_dimension,x.begin());
708  best_x.push_back(x);
709 
710  break;
711  }
712  default:
713  {
714  pagmo_throw(value_error, "Error: There are only 24 test functions in this test suite!");
715  break;
716  }
717  }
718 
719  set_best_x(best_x);
720 }
721 // -------------------------------------------
722 
724 void cec2006::g01_objfun_impl(fitness_vector &f, const decision_vector &x) const
725 {
726  /* objective function */
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]);
728 
729  for (decision_vector::size_type j = 4; j < 13; j++)
730  f[0] = f[0] - x[j];
731 }
732 
734 void cec2006::g01_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
735 {
736  /* constraints g<=0 */
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];
746 }
747 
748 // -------------------------------------------
749 
751 void cec2006::g02_objfun_impl(fitness_vector &f, const decision_vector &x) const
752 {
753  double nx = get_dimension();
754 
755  /* objective function */
756  double f1 = 0.;
757  double f2 = 1.;
758  double f3 = 0.;
759 
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];
764  }
765  f[0] = - fabs((f1 - 2 * f2) / sqrt(f3));
766 }
767 
769 void cec2006::g02_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
770 {
771  /* constraints g<=0 */
772  double nx = get_dimension();
773 
774  double g1 = 1.;
775  double g2 = 0.;
776 
777  for (int j=0; j<nx; j++) {
778  g1 = g1 * x[j];
779  g2 = g2 + x[j];
780  }
781 
782  c[0] = 0.75 - g1;
783  c[1] = g2 - 7.5 * ((double) nx);
784 }
785 
786 // -------------------------------------------
787 
789 void cec2006::g03_objfun_impl(fitness_vector &f, const decision_vector &x) const
790 {
791  /* objective function */
792  double nx = get_dimension();
793 
794  double f1 = 1.;
795  double f3 = sqrt((double) nx);
796 
797  for (int j=0; j<nx; j++) {
798  f1 = f3 * f1 * x[j];
799  }
800 
801  f[0] = - f1;
802 }
803 
805 void cec2006::g03_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
806 {
807  double nx = get_dimension();
808 
809  double f2 = 0.;
810 
811  for (int j=0; j<nx; j++) {
812  f2 = f2 + x[j] * x[j];
813  }
814 
815  /* constraints h=0 */
816  c[0] = f2 - 1.0;
817 }
818 
819 // -------------------------------------------
820 
822 void cec2006::g04_objfun_impl(fitness_vector &f, const decision_vector &x) const
823 {
824  /* objective function */
825  f[0] = 5.3578547 * x[2] * x[2] + 0.8356891 * x[0] * x[4] + 37.293239 * x[0] - 40792.141;
826 }
827 
829 void cec2006::g04_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
830 {
831  /* constraints g<=0 */
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.;
838 }
839 
840 // -------------------------------------------
841 
843 void cec2006::g05_objfun_impl(fitness_vector &f, const decision_vector &x) const
844 {
845  /* objective function */
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);
847 }
848 
850 void cec2006::g05_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
851 {
852  /* constraints h=0 */
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;
856 
857  /* constraints g<=0 */
858  c[3] = -x[3] + x[2] - 0.55;
859  c[4] = -x[2] + x[3] - 0.55;
860 }
861 
862 // -------------------------------------------
863 
865 void cec2006::g06_objfun_impl(fitness_vector &f, const decision_vector &x) const
866 {
867  /* objective function */
868  f[0] = pow((x[0] - 10.), 3) + pow((x[1] - 20.), 3);
869 }
870 
872 void cec2006::g06_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
873 {
874  /* constraints g<=0 */
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;
877 }
878 
879 // -------------------------------------------
880 
882 void cec2006::g07_objfun_impl(fitness_vector &f, const decision_vector &x) const
883 {
884  /* objective function */
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.;
889 }
890 
892 void cec2006::g07_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
893 {
894  /* constraints g<=0 */
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];
903 }
904 
905 // -------------------------------------------
906 
908 void cec2006::g08_objfun_impl(fitness_vector &f, const decision_vector &x) const
909 {
910  /* objective function */
911  f[0] = - pow(sin(2 * PI * x[0]), 3) * sin (2 * PI * x[1]) / (pow(x[0], 3) * (x[0] + x[1]));
912 }
913 
915 void cec2006::g08_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
916 {
917  /* constraints g<=0 */
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);
920 }
921 
922 // -------------------------------------------
923 
925 void cec2006::g09_objfun_impl(fitness_vector &f, const decision_vector &x) const
926 {
927  /* objective function */
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];
931 }
932 
934 void cec2006::g09_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
935 {
936  /* constraints g<=0 */
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];
941 }
942 
943 // -------------------------------------------
944 
945 
947 void cec2006::g10_objfun_impl(fitness_vector &f, const decision_vector &x) const
948 {
949  /* objective function */
950  f[0] = x[0] + x[1] + x[2];
951 }
952 
954 void cec2006::g10_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
955 {
956  /* constraints g<=0 */
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];
963 }
964 
965 // -------------------------------------------
966 
968 void cec2006::g11_objfun_impl(fitness_vector &f, const decision_vector &x) const
969 {
970  /* objective function */
971  f[0] = x[0] * x[0] + (x[1] - 1.0) * (x[1] - 1.0);
972 }
973 
975 void cec2006::g11_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
976 {
977  /* constraints h=0 */
978  c[0] = x[1] - x[0] * x[0];
979 }
980 
981 // -------------------------------------------
982 
984 void cec2006::g12_objfun_impl(fitness_vector &f, const decision_vector &x) const
985 {
986  /* objective function */
987  f[0] = - (100. - (x[0] - 5.) * (x[0] - 5.) - (x[1] - 5.) * (x[1] - 5.) - (x[2] - 5.) * (x[2] - 5.)) / 100.;
988 }
989 
991 void cec2006::g12_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
992 {
993  double gt;
994 
995  /* constraints g<=0 */
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;
1001  if (gt < c[0])
1002  c[0] = gt;
1003  }
1004  }
1005  }
1006 }
1007 
1008 // -------------------------------------------
1009 
1011 void cec2006::g13_objfun_impl(fitness_vector &f, const decision_vector &x) const
1012 {
1013  /* objective function */
1014  f[0] = exp(x[0] * x[1] * x[2] * x[3] * x[4]);
1015 }
1016 
1018 void cec2006::g13_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1019 {
1020  /* constraints h(x) = 0 */
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;
1024 }
1025 
1026 // -------------------------------------------
1027 
1029 void cec2006::g14_objfun_impl(fitness_vector &f, const decision_vector &x) const
1030 {
1031  double sumlog = 0.;
1032  double sum = 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};
1034 
1035  /* objective function */
1036  for (int i = 0; i < 10; i++)
1037  sumlog += x[i];
1038  for (int i = 0; i < 10; i++)
1039  sum += x[i] * (C[i] + log (x[i] / sumlog));
1040  f[0] = sum;
1041 }
1042 
1044 void cec2006::g14_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1045 {
1046  /* constraints h=0 */
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;
1050 }
1051 
1052 // -------------------------------------------
1053 
1055 void cec2006::g15_objfun_impl(fitness_vector &f, const decision_vector &x) const
1056 {
1057  /* objective function */
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];
1059 }
1060 
1062 void cec2006::g15_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1063 {
1064  /* constraints h=0 */
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;
1067 }
1068 
1069 // -------------------------------------------
1070 
1072 void cec2006::g16_objfun_impl(fitness_vector &f, const decision_vector &x) const
1073 {
1074  double C[17], Y[17];
1075 
1076  double x1 = x[0];
1077  double x2 = x[1];
1078  double x3 = x[2];
1079  double x4 = x[3];
1080  double x5 = x[4];
1081 
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;
1087  Y[2] = C[1] / C[2];
1088  Y[3] = 19.0 * Y[2];
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];
1090  C[4] = 100 * x2;
1091  C[5] = x1 - Y[2] - Y[3];
1092  C[6] = 0.950 - (C[3] / C[4]);
1093  Y[4] = C[5] * C[6];
1094  Y[5] = x1 - Y[4] - Y[3] - Y[2];
1095  C[7] = (Y[4] + Y[3]) * 0.995;
1096  Y[6] = C[7] / Y[0];
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];
1115  C[16] = Y[8] + x5;
1116 
1117  /* objective function */
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]);
1119  f[0] = -f[0]; /* Max-->Min, Modified by Jane,Nov 22 2005 */
1120 }
1121 
1123 void cec2006::g16_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1124 {
1125  double C[17];
1126  double Y[17];
1127 
1128  double x1 = x[0];
1129  double x2 = x[1];
1130  double x3 = x[2];
1131  double x4 = x[3];
1132  double x5 = x[4];
1133 
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;
1139  Y[2] = C[1] / C[2];
1140  Y[3] = 19.0 * Y[2];
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];
1142  C[4] = 100.0 * x2;
1143  C[5] = x1 - Y[2] - Y[3];
1144  C[6] = 0.950 - (C[3] / C[4]);
1145  Y[4] = C[5] * C[6];
1146  Y[5] = x1 - Y[4] - Y[3] - Y[2];
1147  C[7] = (Y[4] + Y[3]) * 0.995;
1148  Y[6] = C[7] / Y[0];
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];
1167  C[16] = Y[8] + x5;
1168 
1169  /* constraints g(x) <= 0 */
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;
1208 }
1209 
1210 // -------------------------------------------
1211 
1213 void cec2006::g17_objfun_impl(fitness_vector &f, const decision_vector &x) const
1214 {
1215  double f1=0;
1216  double f2=0;
1217 
1218  double x1 = x[0];
1219  double x2 = x[1];
1220  double x3 = x[2];
1221  double x4 = x[3];
1222  double x6 = x[5];
1223 
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;
1226 
1227  /* objective fucntion */
1228  if (x1 >= 0.0 && x1 < 300.0) {
1229  f1 = 30.0 * aux1;
1230  } else {
1231  if (x1 >= 300.0 && x1 <= 400.0) {
1232  f1 = 31.0 * aux1;
1233  }
1234  }
1235  if (x2 >= 0.0 && x2 < 100.0) {
1236  f2 = 28.0 * aux2;
1237  } else {
1238  if (x2 >= 100.0 && x2 < 200.0) {
1239  f2 = 29.0 * aux2;
1240  } else {
1241  if (x2 >= 200.0 && x2 <= 1000.0) {
1242  f2 = 30.0 * aux2;
1243  }
1244  }
1245  }
1246  f[0] = f1 + f2;
1247 }
1248 
1250 void cec2006::g17_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1251 {
1252  double x1 = x[0];
1253  double x2 = x[1];
1254  double x3 = x[2];
1255  double x4 = x[3];
1256  double x5 = x[4];
1257  double x6 = x[5];
1258 
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;
1263 
1264  /* constraint function h = 0 */
1265  c[0] = aux1 - x1;
1266  c[1] = aux2 - x2;
1267  c[2] = aux5 - x5;
1268  c[3] = aux4;
1269 }
1270 
1271 // -------------------------------------------
1272 
1274 void cec2006::g18_objfun_impl(fitness_vector &f, const decision_vector &x) const
1275 {
1276  /* objective function */
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]);
1278 }
1279 
1281 void cec2006::g18_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1282 {
1283  /* constraint function g <= 0 */
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];
1297 }
1298 
1299 // -------------------------------------------
1300 
1302 void cec2006::g19_objfun_impl(fitness_vector &f, const decision_vector &x) const
1303 {
1304  double sum1 = 0.0;
1305  double sum2 = 0.0;
1306  double sum3 = 0.0;
1307 
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}
1314  };
1315  double D[5] = {4.0,8.0,10.0,6.0,2.0};
1316 
1317  /* objective function */
1318  for (int i=0; i<10; i++) {
1319  sum1 += B[i] * x[i];
1320  }
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];
1324  }
1325  }
1326  for (int i=0; i<5; i++) {
1327  sum3 += D[i] * pow (x[10 + i], 3.0);
1328  }
1329 
1330  f[0] = sum1 - sum2 - 2.0 * sum3;
1331  f[0] = -f[0];
1332 }
1333 
1335 void cec2006::g19_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1336 {
1337  double sum1 = 0.;
1338  double sum2 = 0.;
1339 
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}
1350  };
1351 
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}
1357  };
1358 
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};
1361 
1362  /* constraints g <= 0 */
1363  for (int j = 0; j < 5; j++) {
1364  sum1 = 0.0;
1365  for (int i = 0; i < 5; i++)
1366  sum1 += C[i][j] * x[10 + i];
1367  sum2 = 0.0;
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);
1371  }
1372 }
1373 
1374 // -------------------------------------------
1375 
1377 void cec2006::g20_objfun_impl(fitness_vector &f, const decision_vector &x) const
1378 {
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};
1381 
1382  /* objective function */
1383  f[0] = 0.0;
1384  for (int j=0; j<24; j++) {
1385  f[0] += A[j] * x[j];
1386  }
1387 }
1388 
1390 void cec2006::g20_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1391 {
1392  double sum1, sum2, sumtotal;
1393 
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};
1399 
1400  /* constraints h(x) = 0 */
1401  sum1 = 0.0;
1402  for (int j = 0; j < 12; j++)
1403  sum1 += x[j] / B[j];
1404  sum2 = 0.0;
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));
1409  sumtotal = 0.0;
1410  for (int j = 0; j < 24; j++)
1411  sumtotal += x[j];
1412  c[12] = sumtotal - 1.0;
1413  sum1 = 0.0;
1414  for (int j = 0; j < 12; j++)
1415  sum1 += x[j] / D[j];
1416  sum2 = 0.0;
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;
1420 
1421  /* constraints g(x) <= 0 */
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]);
1426 }
1427 
1428 // -------------------------------------------
1429 
1431 void cec2006::g21_objfun_impl(fitness_vector &f, const decision_vector &x) const
1432 {
1433  /* objective function */
1434  f[0] = x[0];
1435 }
1436 
1438 void cec2006::g21_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1439 {
1440  /* constraint functions h(x) = 0 */
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);
1446 
1447  /* constraint functions g(x) <= 0 */
1448  c[5] = -x[0] + 35.0 * pow(x[1], 0.6) + 35.0 * pow(x[2], 0.6);
1449 }
1450 
1451 // -------------------------------------------
1452 
1454 void cec2006::g22_objfun_impl(fitness_vector &f, const decision_vector &x) const
1455 {
1456  /* objective function */
1457  f[0] = x[0];
1458 }
1459 
1461 void cec2006::g22_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1462 {
1463  /* constraint functions h(x) = 0 */
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;
1483 
1484  /* constraint functions g(x) <= 0 */
1485  c[19] = -x[0] + pow(x[1], 0.6) + pow(x[2], 0.6) + pow(x[3], 0.6);
1486 }
1487 
1488 // -------------------------------------------
1489 
1491 void cec2006::g23_objfun_impl(fitness_vector &f, const decision_vector &x) const
1492 {
1493  /* objective function */
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]);
1495 }
1496 
1498 void cec2006::g23_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1499 {
1500  /* constraint functions h(x) = 0 */
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];
1505 
1506  /* constraint functions g(x) <= 0 */
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];
1509 }
1510 
1511 // -------------------------------------------
1512 
1514 void cec2006::g24_objfun_impl(fitness_vector &f, const decision_vector &x) const
1515 {
1516  /* objective function */
1517  f[0] = -x[0] - x[1];
1518 }
1519 
1521 void cec2006::g24_compute_constraints_impl(constraint_vector &c, const decision_vector &x) const
1522 {
1523  /* constraint functions g(x) <= 0 */
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;
1526 }
1527 
1528 // -------------------------------------------
1529 
1530 }} //namespaces
1531 
1532 BOOST_CLASS_EXPORT_IMPLEMENT(pagmo::problem::cec2006)
Root PaGMO namespace.
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
Definition: problem/base.h:62
std::vector< double > decision_vector
Decision vector type.
Definition: types.h:40
std::string get_name() const
Get problem's name.
Definition: cec2006.cpp:427
void set_best_x(const std::vector< decision_vector > &)
Sets the best known decision vectors.
Base problem class.
Definition: problem/base.h:148
size_type get_dimension() const
Return global dimension.
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
Definition: cec2006.cpp:262
The CEC 2006 problems: Constrained Real-Parameter Optimization.
Definition: cec2006.h:49
std::vector< double > fitness_vector
Fitness vector type.
Definition: types.h:42
base_ptr clone() const
Clone method.
Definition: cec2006.cpp:256
std::vector< double > constraint_vector
Constraint vector type.
Definition: types.h:44
void compute_constraints_impl(constraint_vector &, const decision_vector &) const
Implementation of the constraint function.
Definition: cec2006.cpp:345
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.
cec2006(int=1)
Constructor.
Definition: cec2006.cpp:72