Set packing

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 set S and a list of subsets of S. Then, the set packing problem asks if some k subsets in the list are pairwise disjoint (in other words, no two of them share an element).

More formally, given a universe $$\mathcal{U}$$ and a family $$\mathcal{S}$$ of subsets of $$\mathcal{U}$$, a packing is a subfamily $$\mathcal{C}\subseteq\mathcal{S}$$ of sets such that all sets in $$\mathcal{C}$$ are pairwise disjoint. The size of the packing is $$|\mathcal{C}|$$. In the set packing decision problem, the input is a pair $$(\mathcal{U},\mathcal{S})$$ and an integer $$t$$; the question is whether there is a set packing of size $$t$$ or more. In the set packing optimization problem, the input is a pair $$(\mathcal{U},\mathcal{S})$$, and the task is to find a set packing that uses the most sets.

The problem is clearly in NP since, given $$t$$ 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.

Integer linear program formulation
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 (general maximum set packing problem) 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 $$O(\sqrt{|U|})$$. The weighted variant can also be approximated as well.

Packing sets with a bounded size
The problem does have a variant which is more tractable. Given any positive integer k≥3, the k-set packing problem is a variant of set packing in which each set contains at most k elements.

When k=1, the problem is trivial. When k=2, the problem is equivalent to finding a maximum cardinality matching, which can be solved in polynomial time.

For any k≥3, the problem is NP-hard, as it is more general than 3-dimensional matching. However, there are constant-factor approximation algorithms:


 * Cygan presented an algorithm that, for any ε>0, attains a (k+1+ε)/3 approximation. The run-time is polynomial in the number of sets and elements, but doubly-exponential in 1/ε.
 * Furer and Yu presented an algorithm that attains the same approximation, but with run-time singly-exponential in 1/ε.

Packing sets with a bounded degree
In another more tractable variant, if no element occurs in more than d of the subsets, the answer can be approximated within a factor of d. This is also true for the weighted version.

Equivalent problems
Hypergraph matching is equivalent to set packing: the sets correspond to the hyperedges.

The independent set problem is also equivalent to set packing – there is a one-to-one polynomial-time reduction between them:
 * Given a set packing problem on a collection $$\mathcal{S}$$, build a graph where for each set $$S \in \mathcal{S}$$ there is a vertex $$v_S$$, and there is an edge between $$v_S$$ and $$v_T$$ iff $$S \cap T \neq \varnothing$$. Every independent set of vertices in the generated graph corresponds to a set packing in $$\mathcal{S}$$.
 * Given an independent vertex set problem on a graph $$G(V,E)$$, build a collection of sets where for each vertex $$v$$ there is a set $$S_v$$ containing all edges adjacent to $$v$$. Every set packing in the generated collection corresponds to an independent vertex set in $$G(V,E)$$.

This is also a bidirectional PTAS reduction, and it shows that the two problems are equally difficult to approximate.

In the special case when each set contains at most k elements (the k-set packing problem), the intersection graph is (k+1)-claw-free. This is because, if a set intersects some k+1 sets, then at least two of these sets intersect, so there cannot be a (k+1)-claw. So Maximum Independent Set in claw-free graphs can be seen as a generalization of Maximum k-Set Packing.

Special cases
Graph matching is a special case of set packing in which the size of all sets is 2 (the sets correspond to the edges). In this special case, a maximum-size matching can be found in polynomial time.

3-dimensional matching is a special case in which the size of all sets is 3, and in addition, the elements are partitioned into 3 colors and each set contains exactly one element of each color. This special case is still NP-hard, though it has better constant-factor approximation algorithms than the general case.

Other related problems
In the set cover problem, we are given a family $$\mathcal{S}$$ of subsets of a universe $$\mathcal{U}$$, and the goal is to determine whether we can choose t sets that together contain every element of $$\mathcal{U}$$. These sets may overlap. The optimization version finds the minimum number of such sets. The maximum set packing need not cover every possible element.

In the exact cover problem, every element of $$\mathcal{U}$$ should be contained in exactly one of the subsets. Finding such an exact cover is an NP-complete problem, even in the special case in which the size of all sets is 3 (this special case is called exact 3 cover or X3C). 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.