CIGTAB2.h
Go to the documentation of this file.
1//===========================================================================
2/*!
3 *
4 *
5 * \brief Multi-objective optimization benchmark function CIGTAB 2.
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 * <https://shark-ml.github.io/Shark/>
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_CIGTAB2_H
41#define SHARK_OBJECTIVEFUNCTIONS_BENCHMARK_CIGTAB2_H
42
45
47
48namespace shark {namespace benchmarks{
49/*! \brief Multi-objective optimization benchmark function CIGTAB 2.
50*
51* The function is described in
52*
53* Christian Igel, Nikolaus Hansen, and Stefan Roth.
54* Covariance Matrix Adaptation for Multi-objective Optimization.
55* Evolutionary Computation 15(1), pp. 1-28, 2007
56* \ingroup benchmarks
57*/
59
60 CIGTAB2(std::size_t numberOfVariables = 5) : m_a( 1E-6 ) {
62 m_numberOfVariables = numberOfVariables;
63 }
64
65 /// \brief From INameable: return the class name.
66 std::string name() const
67 { return "CIGTAB2"; }
68
69 std::size_t numberOfObjectives()const{
70 return 2;
71 }
72
73 std::size_t numberOfVariables()const{
74 return m_numberOfVariables;
75 }
76
78 return true;
79 }
80
81 /// \brief Adjusts the number of variables if the function is scalable.
82 /// \param [in] numberOfVariables The new dimension.
84 m_numberOfVariables = numberOfVariables;
85 }
86
87 void init() {
88 m_rotationMatrixY = blas::randomRotationMatrix(*mep_rng, m_numberOfVariables);
89 m_rotationMatrixZ = blas::randomRotationMatrix(*mep_rng, m_numberOfVariables);
90 }
91
92 ResultType eval( const SearchPointType & x ) const {
94
95 ResultType value( 2 );
96
97 SearchPointType y = blas::prod( m_rotationMatrixY, x );
98 SearchPointType z = blas::prod( m_rotationMatrixZ, x );
99 double result_1 = y(0) * y(0) + m_a * m_a * y(numberOfVariables()-1) * y(numberOfVariables()-1);
100 double result_2 = z(0) * z(0) + m_a * m_a * z(numberOfVariables()-1) * z(numberOfVariables()-1);
101
102 for (unsigned i = 1; i < numberOfVariables() - 1; i++) {
103 result_1 += m_a * y( i ) * y( i );
104 result_2 += m_a * (z( i ) - 2) * (z( i ) - 2);
105 }
106
107 value[0] = result_1 / (m_a * m_a * numberOfVariables());
108 value[1] = result_2 / (m_a * m_a * numberOfVariables());
109
110 return value;
111 }
112
114 RealVector x(m_numberOfVariables);
115
116 for (std::size_t i = 0; i < x.size(); i++) {
117 x(i) = random::uni(*mep_rng, -10.0, 10.0);
118 }
119 return x;
120 }
121private:
122 double m_a;
123 std::size_t m_numberOfVariables;
124 RealMatrix m_rotationMatrixY;
125 RealMatrix m_rotationMatrixZ;
126};
127}}
128#endif