Shark machine learning library
Installation
Tutorials
Benchmarks
Documentation
Quick references
Class list
Global functions
include
shark
ObjectiveFunctions
Benchmarks
ELLI1.h
Go to the documentation of this file.
1
//===========================================================================
2
/*!
3
*
4
*
5
* \brief Multi-objective optimization benchmark function ELLI 1.
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_ELLI1_H
41
#define SHARK_OBJECTIVEFUNCTIONS_BENCHMARK_ELLI1_H
42
43
#include <
shark/ObjectiveFunctions/AbstractObjectiveFunction.h
>
44
#include <
shark/ObjectiveFunctions/BoxConstraintHandler.h
>
45
#include <
shark/Core/Random.h
>
46
47
#include <
shark/LinAlg/rotations.h
>
48
49
namespace
shark
{
namespace
benchmarks{
50
/*! \brief Multi-objective optimization benchmark function ELLI1.
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
*/
59
struct
ELLI1
:
public
MultiObjectiveFunction
{
60
61
ELLI1
(std::size_t numVariables = 0) : m_a( 1E6 ){
62
m_features
|=
CAN_PROPOSE_STARTING_POINT
;
63
setNumberOfVariables
(numVariables);
64
}
65
66
/// \brief From INameable: return the class name.
67
std::string
name
()
const
68
{
return
"ELLI1"
; }
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
78
bool
hasScalableDimensionality
()
const
{
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
() {
90
m_rotationMatrix =
blas::randomRotationMatrix
(*
mep_rng
,
numberOfVariables
() );
91
}
92
93
ResultType
eval
(
const
SearchPointType
& x )
const
{
94
m_evaluationCounter
++;
95
96
ResultType
value( 2 );
97
98
SearchPointType
y = prod( m_rotationMatrix, x );
99
100
double
sum1 = 0.0;
101
double
sum2 = 0.0;
102
for
(
unsigned
i = 0; i <
numberOfVariables
(); i++) {
103
sum1 += m_coefficients(i) *
sqr
( y(i) );
104
sum2 += m_coefficients(i) *
sqr
( y(i) - 2.0 );
105
}
106
107
value[0] = sum1 / (
sqr
(m_a) *
numberOfVariables
() );
108
value[1] = sum2 / (
sqr
(m_a) *
numberOfVariables
() );
109
110
return
value;
111
}
112
113
SearchPointType
proposeStartingPoint
()
const
{
114
RealVector x(
numberOfVariables
());
115
116
for
(std::size_t i = 0; i < x.size(); i++) {
117
x(i) =
random::uni
(*
mep_rng
, -10,10);
118
}
119
return
x;
120
}
121
122
private
:
123
double
m_a;
124
RealMatrix m_rotationMatrix;
125
RealVector m_coefficients;
126
};
127
128
}}
129
#endif