ELLI2.h
Go to the documentation of this file.
1//===========================================================================
2/*!
3 *
4 *
5 * \brief Multi-objective optimization benchmark function ELLI 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_ELLI2_H
41#define SHARK_OBJECTIVEFUNCTIONS_BENCHMARK_ELLI2_H
42
45#include <shark/Core/Random.h>
46
48
49namespace shark {namespace benchmarks{
50/*! \brief Multi-objective optimization benchmark function ELLI2.
51*
52* The function is described in
53*
54* Christian Igel, Nikolaus Hansen, and Stefan Roth.
55* Covariance Matrix Adaptation for Multi-objective Optimization.
56* Evolutionary Computation 15(1), pp. 1-28, 2007
57* \ingroup benchmarks
58*/
60
61 ELLI2(std::size_t numVariables = 0) : m_a( 1E6 ){
63 setNumberOfVariables(numVariables);
64 }
65
66 /// \brief From INameable: return the class name.
67 std::string name() const
68 { return "ELLI2"; }
69
70 std::size_t numberOfObjectives()const{
71 return 2;
72 }
73
74 std::size_t numberOfVariables()const{
75 return m_coefficients.size();
76 }
77
79 return true;
80 }
81
82 void setNumberOfVariables( std::size_t numVariables ){
83 m_coefficients.resize(numVariables);
84 for(std::size_t i = 0; i != numVariables; ++i){
85 m_coefficients(i) = std::pow(m_a, 2.0 * (i / (numVariables - 1.0)));
86 }
87 }
88
89 void init() {
92 }
93
94 ResultType eval( const SearchPointType & x ) const {
96
97 ResultType value( 2 );
98
99 SearchPointType y = prod( m_rotationMatrix1, x );
100 SearchPointType z = prod( m_rotationMatrix2, x );
101
102 double sum1 = 0.0;
103 double sum2 = 0.0;
104 for (unsigned i = 0; i < numberOfVariables(); i++) {
105 sum1 += m_coefficients(i) * sqr( y(i) );
106 sum2 += m_coefficients(i) * sqr( z(i) - 2.0 );
107 }
108
109 value[0] = sum1 / ( sqr(m_a) * numberOfVariables() );
110 value[1] = sum2 / ( sqr(m_a) * numberOfVariables() );
111
112 return value;
113 }
114
116 RealVector x(numberOfVariables());
117
118 for (std::size_t i = 0; i < x.size(); i++) {
119 x(i) = random::uni(*mep_rng, -10,10);
120 }
121 return x;
122 }
123
124private:
125 double m_a;
126 RealMatrix m_rotationMatrix1;
127 RealMatrix m_rotationMatrix2;
128 RealVector m_coefficients;
129};
130
131}}
132#endif