The set cover problem is a classical question in combinatorics, computer science, operations research, and complexity theory. Given a set of elements {1, 2, …, n} (henceforth referred to as the universe, specifying all possible elements under consideration) and a collection, referred to as S, of a given m subsets whose union equals the universe, the set cover problem is to identify a smallest sub-collection of S whose union equals the universe. For example, consider the universe, U = {1, 2, 3, 4, 5} and the collection of sets S = { {1, 2, 3}, {2, 4}, {3, 4}, {4, 5} }. In this example, m is equal to 4, as there are four subsets that comprise this collection. The union of S is equal to U. However, we can cover all elements with only two sets: { {1, 2, 3}, {4, 5} }, but not with only one set. Therefore, the solution to the set cover problem for this U and S has size 2. This example is illustrated in the picture above. More formally, given a universe 𝒰 and a family 𝒮 of subsets of 𝒰, a set cover is a subfamily 𝒞⊆𝒮 of sets whose union is 𝒰.
In the set cover decision problem, the input is a pair (𝒰,𝒮) and an integer k; the question is whether there is a set cover of size k or less. In the set cover optimization problem, the input is a pair (𝒰,𝒮), and the task is to find a set cover that uses the fewest sets. The decision version of set covering is NP-complete. It is one of Karp's 21 NP-complete problems shown to be NP-complete in 1972. The optimization/search version of set cover is NP-hard. It is a problem "whose study has led to the development of fundamental techniques for the entire field" of approximation algorithms.
Variants In the weighted set cover problem, each set is assigned a positive weight (representing its cost), and the goal is to find a set cover with a smallest weight. The usual (unweighted) set cover corresponds to all sets having a weight of 1.
In the fractional set cover problem, it is allowed to select fractions of sets, rather than entire sets. A fractional set cover is an assignment of a fraction (a number in [0,1]) to each set in 𝒮, such that for each element x in the universe, the sum of fractions of sets that contain x is at least 1. The goal is to find a fractional set cover in which the sum of fractions is as small as possible. Note that a (usual) set cover is equivalent to a fractional set cover in which all fractions are either 0 or 1; therefore, the size of the smallest fractional cover is at most the size of the smallest cover, but may be smaller. For example, consider the universe U = {1, 2, 3} and the collection of sets S = { {1, 2}, {2, 3}, {3, 1} }. The smallest set cover has a size of 2, e.g. { {1, 2}, {2, 3} }. But there is a fractional set cover of size 1.5, in which a 0.5 fraction of each set is taken. In the capacitated set cover problem, each set s∈𝒮 is associated with a capacity cS which denotes the number of elements it can supply coverage. The goal is to determine the optimal way to select sets such that each element receives the coverage it requires.
Linear program formulation The set cover problem can be formulated as the following integer linear program (ILP).
For a more compact representation of the covering constraint, one can define an incidence matrix A, where each row corresponds to an element and each column corresponds to a set, and Ae,s=1 if element e is in set s, and Ae,s=0 otherwise. Then, the covering constraint can be written as Ax⩾1. Weighted set cover is described by a program identical to the one given above, except that the objective function to minimize is ∑s∈𝒮wsxs, where ws is the weight of set s∈𝒮. Fractional set cover is described by a program identical to the one given above, except that xs can be non-integer, so the last constraint is replaced by 0≤xs≤1. This linear program belongs to the more general class of LPs for covering problems, as all the coefficients in the objective function and both sides of the constraints are non-negative. The integrality gap of the ILP is at most logn (where n is the size of the universe). It has been shown that its relaxation indeed gives a factor-logn approximation algorithm for the minimum set cover problem. See setcover for a detailed explanation.
Hitting set formulation The set cover problem is equivalent to the hitting set problem. A subset H of U is called a hitting set when H∩Sj≠∅︀ for all 1≤j≤m (i.e., H intersects or "hits" all subsets in S). The hitting set problem is to find a minimum hitting set H for a given U and S. To show that the problems are equivalent, for a universe U of size n and collection of sets S of size m, construct U′={1,2,…,m} and S'i={j∣i∈Sj}. Then a set cover C of S is equivalent to a hitting set H′ of U′ where Sj∈C⟺j∈H′, and vice versa. This equivalence can also be visualized by representing the problem as a bipartite graph of n+m vertices, with n vertices on the left representing elements of U, and m vertices on the right representing elements of S, and edges representing set membership (i.e., there is an edge between the i-th vertex on the left and the j-th vertex of the right iff. i∈Sj). Then a set cover is a subset C of right vertices such that each left vertex is adjacent to at least one member of C, while a hitting set is a subset H of left vertices such that each right vertex is adjacent to at least one member of H. These definitions are exactly the same except that left and right are swapped. But there is nothing special about the sides in the bipartite graph; we could have put the elements of U on the right side, and the elements of S on the left side, creating a graph that is a mirror image of the one described above. This shows that set covers in the original graph are equivalent to hitting sets in the mirrored graph, and vice versa. In the field of computational geometry, a hitting set for a collection of geometrical objects is also called a stabbing set or piercing set.
Greedy algorithm There is a greedy algorithm for polynomial time approximation of set covering that chooses sets according to one rule: at each stage, choose the set that contains the largest number of uncovered elements. This method can be implemented in time linear in the sum of sizes of the input sets, using a bucket queue to prioritize the sets. It achieves an approximation ratio of H(s), where s is the size of the set to be covered.
… excerpt ends here. Continue reading the full article.


