IHR6.h
Go to the documentation of this file.
1 //===========================================================================
2 /*!
3  *
4  *
5  * \brief Multi-objective optimization benchmark function IHR 6.
6  *
7  * The function is described in
8  *
9  * Christian Igel, Nikolaus Hansen, and Stefan Roth.
10  * Covariance Matrix Adaptation for Multi-objective Optimization.
11  * Evolutionary Computation 15(1), pp. 1-28, 2007
12  *
13  *
14  *
15  * \author -
16  * \date -
17  *
18  *
19  * \par Copyright 1995-2017 Shark Development Team
20  *
21  * <BR><HR>
22  * This file is part of Shark.
23  * <http://shark-ml.org/>
24  *
25  * Shark is free software: you can redistribute it and/or modify
26  * it under the terms of the GNU Lesser General Public License as published
27  * by the Free Software Foundation, either version 3 of the License, or
28  * (at your option) any later version.
29  *
30  * Shark is distributed in the hope that it will be useful,
31  * but WITHOUT ANY WARRANTY; without even the implied warranty of
32  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33  * GNU Lesser General Public License for more details.
34  *
35  * You should have received a copy of the GNU Lesser General Public License
36  * along with Shark. If not, see <http://www.gnu.org/licenses/>.
37  *
38  */
39 //===========================================================================
40 #ifndef SHARK_OBJECTIVEFUNCTIONS_BENCHMARK_IHR6_H
41 #define SHARK_OBJECTIVEFUNCTIONS_BENCHMARK_IHR6_H
42 
45 
46 #include <shark/LinAlg/rotations.h>
47 
48 #include <vector>
49 
50 namespace shark{
51 /*! \brief Multi-objective optimization benchmark function IHR 6.
52 *
53 * The function is described in
54 *
55 * Christian Igel, Nikolaus Hansen, and Stefan Roth.
56 * Covariance Matrix Adaptation for Multi-objective Optimization.
57 * Evolutionary Computation 15(1), pp. 1-28, 2007
58 */
59 struct IHR6 : public MultiObjectiveFunction{
60 
61  IHR6(std::size_t numVariables = 0)
62  : m_handler(numVariables,-1,1 ){
63  announceConstraintHandler(&m_handler);
64  }
65 
66  /// \brief From INameable: return the class name.
67  std::string name() const
68  { return "IHR6"; }
69 
70  std::size_t numberOfObjectives()const{
71  return 2;
72  }
73 
74  std::size_t numberOfVariables()const{
75  return m_handler.dimensions();
76  }
77 
79  return true;
80  }
81 
83  m_handler.setBounds(
84  SearchPointType(numberOfVariables,-1),
85  SearchPointType(numberOfVariables,1)
86  );
87  }
88 
89  void init() {
91  m_ymax = 1.0/norm_inf(row(m_rotationMatrix,0));
92  }
93 
94  ResultType eval( const SearchPointType & x )const {
96 
97  ResultType value( 2 );
98 
99  SearchPointType y = prod(m_rotationMatrix,x);
100 
101  value[0] = 1 - std::exp(-4 * std::abs(y(0))) * std::pow(std::sin(6 * M_PI * y(0)), 6);
102 
103  double g = 0;
104  for (std::size_t i = 1; i < numberOfVariables(); i++)
105  g += hg( y(i) );
106  g = 1 + 9 * std::pow(g / (numberOfVariables() - 1.0), 0.25);
107 
108  value[1] = g * hf(1. - sqr( value[0] / g ), y( 0 ));
109 
110  return value;
111  }
112 
113  double h( double x )const {
114  return 1 / ( 1 + std::exp( -x / std::sqrt( double(numberOfVariables()) ) ) );
115  }
116 
117  double hf(double x, double y0)const {
118  if( std::abs(y0) <= m_ymax )
119  return x;
120  return std::abs( y0 ) + 1.;
121  }
122 
123  double hg(double x)const {
124  return sqr(x) / ( std::abs(x) + 0.1 );
125  }
126 private:
127  double m_ymax;
129  RealMatrix m_rotationMatrix;
130 };
131 
132 }
133 #endif