10 while (uncovered.
any()) {
Bitset greedy(SetCover &sc)
Simple greedy heuristic: Selects the largest remaining set until all elements are covered.
Bitset greedy_weighted(SetCover &sc, const std::vector< double > &weights, std::size_t bound)
Weighted greedy heuristic: Selects the largest remaining set according to the given weight function u...
Bitset greedy_bounded(SetCover &sc, std::size_t bound)
Bounded greedy heuristic: Selects the largest remaining set until at most bound constraints remain.
This class is a simple wrapper around boost::dynamic_bitset.
Bitset & set(std::size_t n, bool value=true)
Sets the given bit to a value, true by default.
bool any() const
Checks if any bits are set to true. Asserts that mDefault is false.
Represents a set cover problem.
std::size_t active_set_count() const
Returns the number of active sets (that still cover uncovered elements).
const auto & get_set(std::size_t set) const
Returns the given set.
void select_set(std::size_t s)
Selects the given set and purges the covered elements from all other sets.
void prune_sets()
Removes empty sets.
Bitset get_uncovered() const
Returns the uncovered elements.
std::size_t largest_set() const
Returns the id of the largest set.