Tchebycheff.h
Go to the documentation of this file.
1 //===========================================================================
2 /*!
3  * \brief Implements the Tchebycheff scalarizer.
4  *
5  * K. Miettinen, "Nonlinear Multiobjective Optimization", International Series
6  * in Operations Research and Management Science (12)
7  * DOI: 10.1007/978-1-4615-5563-6
8  *
9  *
10  * \author Bjørn Bugge Grathwohl
11  * \date February 2017
12  *
13  * \par Copyright 1995-2017 Shark Development Team
14  *
15  * <BR><HR>
16  * This file is part of Shark.
17  * <http://shark-ml.org/>
18  *
19  * Shark is free software: you can redistribute it and/or modify
20  * it under the terms of the GNU Lesser General Public License as published
21  * by the Free Software Foundation, either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * Shark is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU Lesser General Public License for more details.
28  *
29  * You should have received a copy of the GNU Lesser General Public License
30  * along with Shark. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
33 //===========================================================================
34 
35 #ifndef SHARK_ALGORITHMS_DIRECT_SEARCH_OPERATORS_SCALARIZERS_TCHEBYCHEFF
36 #define SHARK_ALGORITHMS_DIRECT_SEARCH_OPERATORS_SCALARIZERS_TCHEBYCHEFF
37 
38 namespace shark {
39 
40 
42  RealVector const & fitness,
43  RealVector const & weights,
44  RealVector const & optimalPointFitness
45 ){
46  auto w = weights[0] == 0 ? 1e-5 : weights[0];
47  double max_fun = w * std::abs(fitness[0] - optimalPointFitness[0]);
48  for(std::size_t i = 1; i < fitness.size(); ++i){
49  w = weights[i] == 0 ? 1e-5: weights[i];
50  max_fun = std::max(max_fun,w * std::abs(fitness[i] - optimalPointFitness[i]));
51  }
52  return max_fun;
53 }
54 
55 
56 } // namespace shark
57 
58 #endif // SHARK_ALGORITHMS_DIRECT_SEARCH_OPERATORS_SCALARIZERS_TCHEBYCHEFF