1 /* Copyright 2017-2021 PaGMO development team 2 3 This file is part of the PaGMO library. 4 5 The PaGMO library is free software; you can redistribute it and/or modify 6 it under the terms of either: 7 8 * the GNU Lesser General Public License as published by the Free 9 Software Foundation; either version 3 of the License, or (at your 10 option) any later version. 11 12 or 13 14 * the GNU General Public License as published by the Free Software 15 Foundation; either version 3 of the License, or (at your option) any 16 later version. 17 18 or both in parallel, as here. 19 20 The PaGMO library is distributed in the hope that it will be useful, but 21 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 for more details. 24 25 You should have received copies of the GNU General Public License and the 26 GNU Lesser General Public License along with the PaGMO library. If not, 27 see https://www.gnu.org/licenses/. */ 28 29 #ifndef PAGMO_UTILS_HV_HV3D_HPP 30 #define PAGMO_UTILS_HV_HV3D_HPP 31 32 #include <memory> 33 #include <string> 34 #include <vector> 35 36 #include <pagmo/detail/visibility.hpp> 37 #include <pagmo/types.hpp> 38 #include <pagmo/utils/hv_algos/hv_algorithm.hpp> 39 40 namespace pagmo 41 { 42 43 /// hv3d hypervolume algorithm class 44 /** 45 * This class contains the implementation of efficient algorithms for the hypervolume computation in 3-dimensions. 46 * 47 * 'compute' method relies on the efficient algorithm as it was presented by Nicola Beume et al. 48 * 'least[greatest]_contributor' methods rely on the HyCon3D algorithm by Emmerich and Fonseca. 49 * 50 * @see "On the Complexity of Computing the Hypervolume Indicator", Nicola Beume, Carlos M. Fonseca, Manuel 51 * Lopez-Ibanez, Luis Paquete, Jan Vahrenhold. IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 13, NO. 5, OCTOBER 52 * 2009 53 * @see "Computing hypervolume contribution in low dimensions: asymptotically optimal algorithm and complexity results", 54 * Michael T. M. Emmerich, Carlos M. Fonseca 55 */ 56 class PAGMO_DLL_PUBLIC hv3d final : public hv_algorithm 57 { 58 public: 59 /// Constructor 60 /** 61 * Constructor of the algorithm object. 62 * In the very first step, algorithm requires the inital set of points to be sorted ASCENDING in the third 63 * dimension. If the input is already sorted, user can skip this step using "initial_sorting = false" option, saving 64 * some extra time. 65 * 66 * @param initial_sorting when set to true (default), algorithm will sort the points ascending by third dimension 67 */ 68 hv3d(const bool initial_sorting = true); 69 70 // Compute hypervolume 71 double compute(std::vector<vector_double> &, const vector_double &) const override; 72 73 // Contributions method 74 std::vector<double> contributions(std::vector<vector_double> &, const vector_double &) const override; 75 76 // Verify before compute 77 void verify_before_compute(const std::vector<vector_double> &, const vector_double &) const override; 78 79 // Clone method. 80 std::shared_ptr<hv_algorithm> clone() const override; 81 82 // Algorithm name 83 std::string get_name() const override; 84 85 private: 86 // flag stating whether the points should be sorted in the first step of the algorithm 87 const bool m_initial_sorting; 88 }; 89 90 } // namespace pagmo 91 92 #endif 93