ZDT6.h
Go to the documentation of this file.
1//===========================================================================
2/*!
3 *
4 *
5 * \brief Multi-objective optimization benchmark function ZDT6
6 *
7 * The function is described in
8 *
9 * Eckart Zitzler, Kalyanmoy Deb, and Lothar Thiele. Comparison of
10 * Multiobjective Evolutionary Algorithms: Empirical
11 * Results. Evolutionary Computation 8(2):173-195, 2000
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
41#ifndef SHARK_OBJECTIVEFUNCTIONS_BENCHMARK_ZDT6_H
42#define SHARK_OBJECTIVEFUNCTIONS_BENCHMARK_ZDT6_H
43
46
47namespace shark { namespace benchmarks{
48/*! \brief Multi-objective optimization benchmark function ZDT6
49*
50* The function is described in
51*
52* Eckart Zitzler, Kalyanmoy Deb, and Lothar Thiele. Comparison of
53* Multiobjective Evolutionary Algorithms: Empirical
54* Results. Evolutionary Computation 8(2):173-195, 2000
55* \ingroup benchmarks
56*/
58{
59
60 ZDT6(std::size_t numVariables = 0) : m_handler(numVariables,0,1){
61 announceConstraintHandler(&m_handler);
62 }
63
64 /// \brief From INameable: return the class name.
65 std::string name() const
66 { return "ZDT6"; }
67
68 std::size_t numberOfObjectives()const{
69 return 2;
70 }
71
72 std::size_t numberOfVariables()const{
73 return m_handler.dimensions();
74 }
75
77 return true;
78 }
79
80 /// \brief Adjusts the number of variables if the function is scalable.
81 /// \param [in] numberOfVariables The new dimension.
83 m_handler.setBounds(numberOfVariables,0,1);
84 }
85
86 // std::vector<double> evaluate( const point_type & x ) {
87 ResultType eval( const SearchPointType & x ) const {
89
90 ResultType value( 2 );
91
92 value[0] = 1.0 - std::exp(-4.0 * x( 0 )) * std::pow( std::sin(6 * M_PI * x( 0 ) ), 6);
93
94 double mean = sum(x) - x(0);
95 mean /= (numberOfVariables() - 1.0);
96
97 double g = 1.0 + 9.0 * std::pow(mean, 0.25);
98 double h = 1.0 - sqr(value[0] / g);
99 value[1] = g*h;
100
101 return value;
102 }
103private:
105};
106
107}}
108#endif