13 #include <boost/range/irange.hpp>
18 std::vector<std::vector<int>> set_to_elements = {
21 { 7, 8, 9, 10, 11, 12, 13, 0 },
22 { 1, 3, 5, 7, 9, 11, 13 },
23 { 2, 4, 6, 8, 10, 12, 0 }
25 const int NUMBER_OF_SETS_TO_SELECT = 2;
27 using SetIterator = decltype(sets)::iterator;
28 std::vector<int> result;
29 auto element_index = [](
int el){
return el;};
32 [&](
int set){
return set_to_elements[set];},
33 back_inserter(result),
35 NUMBER_OF_SETS_TO_SELECT);
36 std::cout <<
"Covered: " << covered << std::endl;
auto maximum_coverage(SetRange &&sets, GetElementsOfSet set_to_elements, OutputIterator result, GetElementIndex get_el_index, unsigned int number_of_sets_to_select, GetWeightOfElement get_weight_of_element=GetWeightOfElement{})
this is solve Set Cover problem and return set cover cost example:
auto irange(T begin, T end)
irange
int main()
[Max Coverage Example]