Set packing is a classical NP-complete problem in computational complexity theory and combinatorics, and was one of Karp's 21 NP-complete problems. Suppose one has a finite setS and a list of subsets of S. Then, the set packing problem asks if some k subsets in the list are pairwise disjoint. More formally, given a universe and a family of subsets of, a packing is a subfamily of sets such that all sets in are pairwise disjoint. The size of the packing is. In the set packing decision problem, the input is a pair and an integer ; the question is whether there is a set packing of size or more. In the set packing optimization problem, the input is a pair, and the task is to find a set packing that uses the most sets. The problem is clearly in NP since, given k subsets, we can easily verify that they are pairwise disjoint in polynomial time. The optimization version of the problem, maximum set packing, asks for the maximum number of pairwise disjoint sets in the list. It is a maximization problem that can be formulated naturally as an integer linear program, belonging to the class of packing problems.
The maximum set packing problem can be formulated as the following integer linear program.
Complexity
The set packing problem is not only NP-complete, but its optimization version has been proven as difficult to approximate as the maximum clique problem; in particular, it cannot be approximated within any constant factor. The best known algorithm approximates it within a factor of. The weighted variant can also be approximated as well. However, the problem does have a variant which is more tractable: if we assume no subset exceeds k≥3 elements, the answer can be approximated within a factor of k/2 + ε for any ε > 0; in particular, the problem with 3-element sets can be approximated within about 50%. In another more tractable variant, if no element occurs in more than k of the subsets, the answer can be approximated within a factor of k. This is also true for the weighted version.
Given a set packing problem on a collection, create a graph where for each set there is a vertex, and there is an edge between and if. Now every independent set of vertices in the generated graph corresponds to a set packing in.
Given an independent vertex set problem on a graph, create a collection of sets where for each vertex there is a set containing all edges adjacent to. Now every set packing in the generated collection corresponds to an independent vertex set in.
This is also a bidirectional PTAS reduction, and it shows that the two problems are equally difficult to approximate.
Special cases
and 3-dimensional matching are special cases of set packing. A maximum-size matching can be found in polynomial time, but finding a largest 3-dimensional matching or a largest independent set is NP-hard.
Other related problems
Set packing is one among a family of problems related to covering or partitioning the elements of a set. One closely related problem is the set cover problem. Here, we are also given a set S and a list of sets, but the goal is to determine whether we can choose k sets that together contain every element ofS. These sets may overlap. The optimization version finds the minimum number of such sets. The maximum set packing need not cover every possible element. The NP-complete exact cover problem, on the other hand, requires every element to be contained in exactly one of the subsets. Finding such an exact cover at all, regardless of size, is an NP-complete problem. However, if we create a singleton set for each element of S and add these to the list, the resulting problem is about as easy as set packing. Karp originally showed set packing NP-complete via a reduction from the clique problem. See also: Packing in a hypergraph.