Set cover problem
Set covering (also known as set cover) is a classical computer science problem.
As input you are given several sets. They may have some elements in common. You must select some of these sets so that the sets you have picked contain all the elements that are contained in any of the sets in the input.
More formally, the input if a set of sets. We'll denote each of these sets with , so the first set is , the second , and so on. We'll use the letter to indicate the number of input sets, so the last input set is .
A solution to the set covering problem is a selection of the input sets, which we can indicate by giving the number of each set that we chose. That is, a solution is a set of elements in . The solution has two properties. First, it includes all elements of the input sets, so . Second, there is no way to pick fewer of the input sets and still cover all the elements:
The most direct way of solving set cover is to try all combinations of sets (known as "brute force"). This can naturally be improved upon (for example by trying the larger sets first, an approach known as "greedy set cover"). It has been shown that the set cover problem is NP-hard, so no deterministic algorithm can be faster than brute force for every possible input of the problem.