8 #ifndef PAAL_SET_COVER_HPP
9 #define PAAL_SET_COVER_HPP
16 #include <boost/function_output_iterator.hpp>
24 template <
typename SetRange,
typename GetCostOfSet>
26 GetCostOfSet(
typename boost::range_reference<SetRange>::type)>;
47 template<
typename SetRange,
class GetCostOfSet,
class GetElementsOfSet,
class OutputIterator,
class GetElementIndex>
49 GetCostOfSet set_to_cost,
50 GetElementsOfSet set_to_elements,
51 OutputIterator result,
52 GetElementIndex get_el_index
54 using set_cost=
typename detail::set_range_cost_t<SetRange,GetCostOfSet>;
57 set_cost cost_of_solution{};
61 boost::make_function_output_iterator([&](
int set){
62 cost_of_solution += set_to_cost(set);
71 return cost_of_solution;
auto budgeted_maximum_coverage(SetRange &&sets, GetCostOfSet set_to_cost, GetElementsOfSet set_to_elements, OutputIterator result, ElementIndex get_el_index, Budget budget, GetWeightOfElement element_to_weight=GetWeightOfElement(), const unsigned int initial_set_size=3)
detail
This file contains set of simple useful functors or functor adapters.
T accumulate_functor(const Range &rng, T init, Functor f, BinaryOperation bin_op=BinaryOperation{})
combination of boost::accumulate and boost::adaptors::transformed
auto set_cover(SetRange &&sets, GetCostOfSet set_to_cost, GetElementsOfSet set_to_elements, OutputIterator result, GetElementIndex get_el_index)
detail
typename std::decay< typename std::result_of< F >::type >::type pure_result_of_t
return pure type of function (decays const and reference)