Let Ω={a1,…,an} be a set,
and S1,…,Sm be subsets of Ω, such that Sj is associated with weight wj∈R+ for each j∈[m].
The goal is solve the following the following optimization problem
minJ⊆[m]s.t.∑j∈Jwj,∪j∈JSj=Ω
In case where wj=1 for each j∈[m], the problem is called the unweighted set cover problem.
For each element i∈[n], let Ei≐{j∈[m]:ai∈Sj},
and let C=maxi∈[n]∣Ei∣.
Suppose that xj∗,j∈[m] be the optimal solution to the primal LP.
Theorem.
J≐{j∈[m]:xj∗≥C1}
is a C-approximate solution to the set cover problem.
Proof.
We prove first that Sj,j∈J is a set cover, then we prove that it is a C approximate one.
Feasibility. Since xj∗ is the optimal solution to the primal LP, for each i∈[n], we have
j:ai∈Sj∑xj≥1.
Therefore, , there exists at least one j∈Ei, s.t.,
xj∗≥∣Ei∣1≥C1.
Approximation Ratio.
The cost of the approximate solution is given by
j∈J∑wj≤j∈J∑wj⋅(xj∗⋅C)≤C⋅j∈[m]∑wj⋅xj∗.
□
Remark. This is a 2-approximation algorithm for the vertex cover problem, a special case of the set cover problem.
Rounding the Optimal Dual Solution
Let yi∗,i∈[n] be the optimal solution to the dual.
Theorem.
J′≐⎩⎨⎧j∈[m]:i:ai∈Sj∑yi∗=wj⎭⎬⎫
is a C-approximate solution to the set cover problem.
Proof.
We prove first that Sj,j∈J′ is a set cover, then we prove that it is a C approximate one.
Feasibility. Suppose that there exits an uncovered element ak, which implies that for each j∈Ek, it holds that
i:ai∈Sj∑yi∗<wj.
But this implies that we can increase the value of yk∗, and therefore increase the value of ∑i∈[n]yi∗, without violating the dual constraints, contradicting the yi∗,i∈[n] being optimal.
Approximation Ratio.
The cost of the approximate solution is given by
where the last inequality holds, since each yi∗ appears in at most C constraints.
□
Remark. Via complementary slackness, if xj∗>0, we always have
i:ai∈Sj∑yi∗=wj.
Since J≐{j∈[m]:xj∗≥1/C}, it holds that J⊆J′.
Therefore, rounding the primal solution do no worse than rounding the dual one.
The Primal-Dual Method
Rounding the optimal dual solution requires to solve the dual LP optimally, which could be slow even though the LP can be solved in polynomial time.
The following algorithm overcomes this drawback by constructing only a feasible dual solution.
Algorithm.Aprimal-dual
yi←0, for each i∈[n]
J←∅
while∃ak∈/∪j∈JSjdo
increase yk until some constraint becomes tight,
i.e., ∃Sℓ with ak∈Sj, s.t., ∑i:ai∈Sℓyi=wℓ
J←J∪{ℓ}
Clearly the yi,i∈[n] is a feasible solution to the dual.
Theorem. Algorithm Aprimal-dual returns a
C-approximate solution J to the set cover problem.
Proof.
We prove first that Sj,j∈J is a set cover, then we prove that it is a C approximate one.
Feasibility. Suppose that there exits an element ak that is not covered by J, which implies that for each j∈Ek, it holds that
i:ai∈Sj∑yi<wj.
But this implies that we can increase the value of yk, and therefore increase the value of ∑i∈[n]yi, without violating the dual constraints, contradicting yi being optimal.
Approximation Ratio.
The cost of the approximate solution is given by
where the last inequality holds, since each yi appears in at most C constraints.
□
Randomized Rounding
We present a randomized algorithm based on the optimal solution xj∗ for the primal LP.
Let T∈N+ be a positive integer to be determined later.
Algorithm.Arnd
fort∈[T]do
Jt←∅
for each j∈[m]do
add j to Jt with probability xj∗
output J←∪t∈[T]Jt
Theorem. The expected cost of J is at most T⋅∑j∈[m]wj⋅xj∗.
Further, if T=2lnn, with probability at least 1−1/n, J is a set cover.
Proof.
Expected Cost.
Since j is included in Jt with probability xj∗ for each j∈[m], by linearity of expectation, the expected sum of weights of sets in Jt is given by
j∈[m]∑wj⋅xj∗.
Therefore, the expected cost of J is at most T⋅∑j∈[m]wj⋅xj∗.
Failure Probability.
The probability that a fixed ai is not covered by Jt is given by
By independence, the probability that none of the Jt covers ai is at most
(exp(−1))T=exp(−T)=1/n2.
Applying union bound over all element ai∈Ω finishes the proof.
□
Greedy Algorithm
Finally, we discuss a greedy algorithm for the set cover problem.
We follows the convention that x/0=∞, ∀x∈R+.
Algorithm.Agreedy
S^j←Sj, for each j∈[m]
J←∅
while∪j∈JSj=Ωdo
ℓ←minj∈[m](wj/∣S^j∣)
J←J∪{ℓ}
S^j←S^j∖Sℓ, ∀j∈[m]
For each k∈N+, define Hk=∑i∈[k]1/i.
Theorem.Agreedy outputs a Hn approximate solution J to the set cover problem.
Proof.
When an ℓ is added to J, it is easy to see that S^ℓ=∅, as otherwise wℓ/∣S^ℓ∣=∞.
Therefore we can charge the cost of wℓ among elements in S^ℓ, with each elements ai∈S^ℓ obtaining a cost of
yi≐wℓ/∣S^ℓ∣.
Since each ai∈Ω is charged exactly once, it holds that
j∈J∑wj=i∈[n]∑yi.
Our proof is based on the following lemma.
Lemma. For each j∈[m], it holds that
i:ai∈Sj∑yi≤wj⋅H∣Sj∣.
We now finish the proof for the theorem, assuming the lemma holds.
Let D≐maxj∈[m∣Sj∣≤n.
For each i∈[n], define new variable y^i=yi/HD.
Then the y^i is a feasible solution to the dual LP, and therefore ∑i∈[n]y^i≤OPT, where OPT is the value of the optimal solution to the set cover problem.
We conclude that
j∈J∑wj=i∈[n]∑yi=HD⋅i∈[n]∑y^i≤HD⋅OPT.
Proof of the Lemma.
Suppose that the solution J returned by Agreedy consists t numbers ℓ1,…,ℓt, indexed according to their orders added to J.
For each k∈[t], define
rk≐Sj∖(Sℓ1∪Sℓ2∪…∪Sℓk−1).
Note that rk is the number of new elements in Sj that is covered by sets indexed by J, before ℓk is added to J.
For convenience, let r0=n.
For each k∈[t], define ck=rk−rk−1.
We claim that for each k∈[t], it holds that
i:ai∈Sj∩S^ℓk∑yi=ck⋅yi≤ck⋅rkwj.
If Sj∩S^ℓk=∅, then ck=0 and the claim holds trivially.
Otherwise, the criteria for picking ℓk by Agreedy ensures that for each ai∈Sj∩S^ℓk, it holds that