1 / 26

Set Cover

Set Cover. 資工碩一 9562635 簡裕峰. Set Cover. Problem 2.1 (Set Cover) Given a universe U of n elements, a collection of subsets of U , S ={ S 1 ,…,S k }, and a cost function c : S -> Q+ , find a minimum cost subcollection of S that covers all elements of U. Set Cover - ex. Weighted

yetty
Download Presentation

Set Cover

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Set Cover 資工碩一9562635簡裕峰

  2. Set Cover • Problem 2.1 (Set Cover) Given a universe U of n elements, a collection of subsets of U, S ={S1,…,Sk}, and a cost function c : S -> Q+, find a minimum cost subcollection of S that covers all elements of U.

  3. Set Cover - ex • Weighted • U = {a, b, c, d, e} • S = {S1, S2, S3, S4} • S1 = {a, b, c} , c(S1)=5 • S2 = {b, c, d} , c(S2)=2 • S3 = {d, e} , c(S3)=3 • S4 = {a, c} , c(S4)=2 • Unit • U = {a, b, c, d, e} • S = {S1, S2, S3, S4} • S1 = {a, b, c} • S2 = {b, c, d} • S3 = {d, e} • S4 = {a, c}

  4. Set Cover • Define the frequency of an element to be the number of sets it is in. Let us denote the frequency of the most frequent element by f. • The various approximation algorithms for set cover achieve one of two factors : • O(log n) • f

  5. S1 b a S2 S5 d c S4 S3 e Set Cover & Vertex Cover • When f = 2 : (Ex2.7) • U = {a, b, c, d, e} • S1 = {a, b} • S2 = {a} • S3 = {d, e} • S4 = {c, e} • S5 = {b, c, d} • Factor 2 approximation algorithm in Chapter 1

  6. Set Cover & Vertex Cover • When f = 2 : (Ex2.7) • U = {a, b, c, d, e, f} • S1 = {a, b} • S2 = {a, f} • S3 = {d, e} • S4 = {c, e} • S5 = {b, c, d} • Factor 2 approximation algorithm in Chapter 1 S1 b a S2 S5 d f c S4 S3 e

  7. 2.1 The Greedy algorithm • Algorithm 2.2 Greedy set cover algorithm Iteratively pick the most cost-effective set and remove the covered elements, until all elements are covered.

  8. 2.1 The Greedy algorithm • Weighted • U = {a, b, c, d, e} • S = {S1, S2, S3, S4} • S1 = {a, b, c} , c(S1)=5 • S2 = {b, c, d} , c(S2)=2 • S3 = {d, e} , c(S3)=3 • S4 = {a, c} , c(S4)=2 • Unit • U = {a, b, c, d, e} • S = {S1, S2, S3, S4} • S1 = {a, b, c} • S2 = {b, c, d} • S3 = {d, e} • S4 = {a, c}

  9. 2.1 The Greedy algorithm • Let e1,…,en be this numbering. • Lemma 2.3 • Prove

  10. 2.1 The Greedy algorithm • Theorem 2.4 The greedy algorithm is an Hn factor approximation algorithm for the minimun set cover problem, where Hn = 1 + ½ + … + 1/n. Prove : The total cost = By lemma 2.3, this is at most Hn xOPT

  11. 2.1 The Greedy algorithm • Example 2.5 The following is a tight example for algorithm 2.2 … 1+ε 1/n 1/(n-1) 1

  12. 2.2 Layering • Let w : V -> Q+ be the function assigning weights to the vertices of the given graph G = (V,E). • Degree-weighted: if there is a constant c > 0 such that the weight of each vertex v V is c x deg(v).

  13. S1 b a S2 S5 d c S4 S3 e 2.2 Layering • Degree-weighted • w(S1) = 2c • w(S2) = 1c • w(S3) = 2c • w(S4) = 2c • w(S5) = 3c

  14. 2.2 Layering • Lemma 2.6 Let w : V -> Q+ be a degree-weighted function. Then w(V) ≤ 2OPT. Prove OPT ≥ |E|, w(V) ≤ 2|E|

  15. 2.2 Layering • Let us define the largest degree-weighted function in w as follow: • Remove all degree zero vertices from the graph • Over the remaining vertices, compute c = min{ w(v) / deg(v)}, • t(v) = c x deg(v) is the desired function • w`(v) = w(v) – t(v) to be the residual weight function.

  16. 2.2 Layering Gk Dk Gk-1 Wk-1 Dk-1 G1 W1 D1 G0 W0 D0

  17. 7 3 4 3 0 3 5 3 2 1 3 4 3 4 7 1 3 2 2.2 Layering

  18. 4 2 2 3 1 2 3 0 3 2 1 1 2.2 Layering 3

  19. 2.2 Layering • 7 3 5 4 7 3 • 4 ~ 3 3 3 2 • 2 ~ 1 x ~ 1

  20. 2.2 Layering • Theorem 2.7 The layer algorithm achieves an approximation guarantee of factor 2 for the vertex cover problem, assuming arbitrary vertex weights. Prove 1. ? The vertices we chosen is a vertex cover.

  21. 2.2 Layering • Prove 2.8 Let C* be an optimal vertex cover w(C) ≤ 2 OPT If v Wj , w(v) = If v V – C, w(v) ≥

  22. 2.3 Application to shortest superstring • Problem 2.9 Given a finite alphabet ∑, and a set of n strings, S = {s1,…,sn} ∑+, find a shortest string s that contains each sias a substring. Without loss of generality, we may assume that no string si is a substring of another string sj, i≠j.

  23. 2.3 Application to shortest superstring • Algorithm 2.10 1. Use the greedy set cover algorithm to find a cover for the instance S. Let set( ),…, set( ) be the sets picked by this cover. 2.Concatenate the string ,…, , in any order. 3.Output the resulting string. Say s.

  24. 2.3 Application to shortest superstring • Lemma 2.11 OPT ≤ OPTs ≤ 2OPT • OPT : the length of the shortest superstring • OPTs : an optimal solution to S

  25. 2.3 Application to shortest superstring

  26. 2.3 Application to shortest superstring • Theorem 2.12 This algorithm is a 2Hn factor algorithm for the shortest superstring problem, where n is the number of strings in the given instance.

More Related