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_S_POLICIES_SELECT_BEST_HPP 30 #define PAGMO_S_POLICIES_SELECT_BEST_HPP 31 32 #include <string> 33 #include <type_traits> 34 35 #include <pagmo/detail/base_sr_policy.hpp> 36 #include <pagmo/detail/visibility.hpp> 37 #include <pagmo/s11n.hpp> 38 #include <pagmo/s_policy.hpp> 39 #include <pagmo/type_traits.hpp> 40 #include <pagmo/types.hpp> 41 42 namespace pagmo 43 { 44 45 class PAGMO_DLL_PUBLIC select_best : public detail::base_sr_policy 46 { 47 public: 48 select_best(); 49 template <typename T, 50 enable_if_t<detail::disjunction<std::is_integral<T>, std::is_floating_point<T>>::value, int> = 0> select_best(T x)51 explicit select_best(T x) : detail::base_sr_policy(x) 52 { 53 } 54 55 individuals_group_t select(const individuals_group_t &, const vector_double::size_type &, 56 const vector_double::size_type &, const vector_double::size_type &, 57 const vector_double::size_type &, const vector_double::size_type &, 58 const vector_double &) const; 59 get_name() const60 std::string get_name() const 61 { 62 return "Select best"; 63 } 64 std::string get_extra_info() const; 65 66 private: 67 // Object serialization 68 friend class boost::serialization::access; 69 template <typename Archive> 70 void serialize(Archive &, unsigned); 71 }; 72 73 } // namespace pagmo 74 75 PAGMO_S11N_S_POLICY_EXPORT_KEY(pagmo::select_best) 76 77 #endif 78