15 template<
typename Set>
32 assert(it.first->second ==
mSets.size());
33 mSets.emplace_back(s);
35 return it.first->second;
39 void set(
const Set& s, std::size_t element) {
47 const Set&
get_set(std::size_t sid)
const {
48 assert(sid <
mSets.size());
69 for (std::size_t
id: heuristic(
mSetCover)) {
70 res.emplace_back(
mSets[
id]);
79 return os << static_cast<const SetCover&>(tsc);
std::ostream & operator<<(std::ostream &os, const SetCover &sc)
Print the set cover to os.
This class is a simple wrapper around boost::dynamic_bitset.
Represents a set cover problem.
void set(std::size_t set, std::size_t element)
States that s covers the given element.
Represents a set cover problem where a set is represented by some type.
std::vector< Set > mSets
Maps id to set.
std::size_t get_set_id(const Set &s)
Gets id for a set, creates a new id if necessary.
auto & set_cover()
Returns the underlying set cover.
const Set & get_set(std::size_t sid) const
std::map< Set, std::size_t > mSetMap
Maps set to id.
SetCover mSetCover
The actual set cover.
friend std::ostream & operator<<(std::ostream &os, const TypedSetCover< T > &tsc)
Print the typed set cover to os.
void set(const Set &s, std::size_t element)
States that s covers the given element.
void set(const Set &s, const Bitset &elements)
States that s covers the given elements.
std::vector< Set > get_cover(F &&heuristic)
Convenience function to run the given heuristic on this set cover.
const auto & set_cover() const
Returns the underlying set cover.