carl  24.04
Computer ARithmetic Library
carl::covering::SetCover Class Reference

Represents a set cover problem. More...

#include <SetCover.h>

Collaboration diagram for carl::covering::SetCover:

Public Member Functions

void set (std::size_t set, std::size_t element)
 States that s covers the given element. More...
 
void set (std::size_t set, const Bitset &elements)
 States that s covers the given elements. More...
 
const auto & get_set (std::size_t set) const
 Returns the given set. More...
 
std::size_t element_count () const
 Returns the number of elements. More...
 
void prune_sets ()
 Removes empty sets. More...
 
std::size_t set_count () const
 Returns the number of sets. More...
 
std::size_t active_set_count () const
 Returns the number of active sets (that still cover uncovered elements). More...
 
std::size_t largest_set () const
 Returns the id of the largest set. More...
 
std::size_t largest_set (const std::vector< double > &weights) const
 Returns the id of the largest set with respect to given weights. More...
 
Bitset get_uncovered () const
 Returns the uncovered elements. More...
 
void select_set (std::size_t s)
 Selects the given set and purges the covered elements from all other sets. More...
 

Private Attributes

std::vector< BitsetmSets
 The actual sets. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const SetCover &sc)
 Print the set cover to os. More...
 

Detailed Description

Represents a set cover problem.

Allows to state which sets cover which elements and offers some helper methods to work with this set cover for the heuristics.

Definition at line 15 of file SetCover.h.

Member Function Documentation

◆ active_set_count()

std::size_t carl::covering::SetCover::active_set_count ( ) const

Returns the number of active sets (that still cover uncovered elements).

Definition at line 44 of file SetCover.cpp.

Here is the caller graph for this function:

◆ element_count()

std::size_t carl::covering::SetCover::element_count ( ) const

Returns the number of elements.

Definition at line 24 of file SetCover.cpp.

Here is the caller graph for this function:

◆ get_set()

const auto& carl::covering::SetCover::get_set ( std::size_t  set) const
inline

Returns the given set.

Definition at line 27 of file SetCover.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_uncovered()

Bitset carl::covering::SetCover::get_uncovered ( ) const

Returns the uncovered elements.

Definition at line 78 of file SetCover.cpp.

Here is the caller graph for this function:

◆ largest_set() [1/2]

std::size_t carl::covering::SetCover::largest_set ( ) const

Returns the id of the largest set.

Definition at line 50 of file SetCover.cpp.

Here is the caller graph for this function:

◆ largest_set() [2/2]

std::size_t carl::covering::SetCover::largest_set ( const std::vector< double > &  weights) const

Returns the id of the largest set with respect to given weights.

Definition at line 64 of file SetCover.cpp.

◆ prune_sets()

void carl::covering::SetCover::prune_sets ( )

Removes empty sets.

Definition at line 32 of file SetCover.cpp.

Here is the caller graph for this function:

◆ select_set()

void carl::covering::SetCover::select_set ( std::size_t  s)

Selects the given set and purges the covered elements from all other sets.

Definition at line 86 of file SetCover.cpp.

Here is the caller graph for this function:

◆ set() [1/2]

void carl::covering::SetCover::set ( std::size_t  set,
const Bitset elements 
)

States that s covers the given elements.

Definition at line 17 of file SetCover.cpp.

Here is the call graph for this function:

◆ set() [2/2]

void carl::covering::SetCover::set ( std::size_t  set,
std::size_t  element 
)

States that s covers the given element.

Definition at line 10 of file SetCover.cpp.

Here is the caller graph for this function:

◆ set_count()

std::size_t carl::covering::SetCover::set_count ( ) const

Returns the number of sets.

Definition at line 40 of file SetCover.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const SetCover sc 
)
friend

Print the set cover to os.

Definition at line 94 of file SetCover.cpp.

Field Documentation

◆ mSets

std::vector<Bitset> carl::covering::SetCover::mSets
private

The actual sets.

Definition at line 20 of file SetCover.h.


The documentation for this class was generated from the following files: