1 / 107

More On Intractability & Beyond CS161: Online Algorithms Monday, August 11 th

More On Intractability & Beyond CS161: Online Algorithms Monday, August 11 th. Announcements. PS#6 due w ednesday at midnight Project evaluation/ c ompetition r esults on Wednesday Final exam i nformation (later this lecture) Evaluations for the class is open on axess.

Download Presentation

More On Intractability & Beyond CS161: Online Algorithms Monday, August 11 th

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. More On Intractability & Beyond CS161: Online Algorithms Monday, August 11th

  2. Announcements PS#6 due wednesday at midnight Project evaluation/competition results on Wednesday Final exam information (later this lecture) Evaluations for the classis open on axess

  3. Outline For Today Approximate Set Cover Approximate Vertex Cover Final Exam Information Beyond CS 161: Online Algorithms

  4. Recap: Knapsack FPTAS I: (wi, vi, W) Knapsack Algorithm ≥ (1-ε)*OPT (1-ε)-approx accuracy ε (say 0.01) Key Takeaway: We are approximating an NP-complete problem to arbitrary precision.

  5. Note On Approximating NP-complete Problems • Knapsack is NP-complete. • All NP problems (e.g., TSP) reduce to it. • If we solved Knapsack exactlywe solve all NP problems exactly. Poly-time TSP -> KNPS Converter Alg for KNPS Π2 ∈ KNPS Π1 ∈ TSP Poly-time KNPS Sol. -> TSP Solution Converter Solution to KNPS Solution to TSP

  6. Note On Approximating NP-complete Problems But there are NP problems which can’t be approximated to any constant (e.g. TSP)! X Poly-time TSP -> KNPS Converter Poly-time Approx.Alg for KNPS Π2 ∈ KNPS Π1 ∈ TSP Poly-time KNPS Sol. -> TSP Solution Converter Approx Solution to TSP Approx. Solution to KNPS

  7. Note On Approximating NP-complete Problems Key Takeaway: Although we can maintain the exact solutions through reductions, approximate solutions cannot be maintained in general. In other words: The information about the approximate solutions can be lost across reductions (though exact solutions can be maintained)!

  8. Outline For Today Approximate Set Cover Randomized Approximate Vertex Cover Final Exam Information Beyond CS 161: Online Algorithms

  9. Set Cover Problem (Sec 11.3) • Input: U={1, …, n} items, S1, …, Sm sets s.t. • S1∪S2∪ … ∪Sm=U • Output: minimum # sets required to cover U • Fact: Set Cover is NP-complete: one of Karp’s 21 NP-complete algorithms (Vertex Cover ≤p Set Cover)

  10. Set Cover Example S3 S1 S2 S4 9 10 11 12 1 5 9 2 6 10 5 6 7 8 3 U 1 2 3 4 1 2 3 4 5 6 7 8 9 10 11 12 S5 S6 6 10 7 11 4 8

  11. Set Cover Example S1 S2 S3 S4 1 5 9 2 6 10 S5 3 7 11 4 8 12 S6

  12. Set Cover Example S1 S2 S3 1 5 9 2 6 10 Copt: S1∪S2∪S3 3 7 11 4 8 12

  13. Set Cover Example 1 5 9 2 6 10 3 7 11 4 8 12

  14. Greedy Set-Cover Algorithm Idea: Iteratively pick the set that covers the most “uncovered” elements. procedureGreedy-SetCover(U, S1,…,Sn): C = ∅ whileU is not empty pick Sithat maximizes |Si ∩ U| C = C + Si U = U \ Si return C min(|U|, n) iterations, each iteration O(n*|U|) Total: O(n*|U|*min(|U|, n)) time.

  15. Greedy Algorithm Simulation S1 S2 S3 S4 1 5 9 2 6 10 Cgreedy: S5 3 7 11 4 8 12 S6

  16. Greedy Algorithm Simulation S1 S2 S3 S4 1 5 9 2 6 10 Cgreedy: S4 S5 3 7 11 4 8 12 S6

  17. Greedy Algorithm Simulation S1 S2 S3 1 5 9 2 6 10 Cgreedy: S4 S5 3 7 11 4 8 12 S6

  18. Greedy Algorithm Simulation S1 S2 S3 1 5 9 2 6 10 Cgreedy: S4, S2 S5 3 7 11 4 8 12 S6

  19. Greedy Algorithm Simulation S1 S3 1 5 9 2 6 10 Cgreedy: S4, S2 S5 3 7 11 4 8 12 S6

  20. Greedy Algorithm Simulation S1 1 5 9 2 6 10 Cgreedy: S4, S2, S3 S5 3 7 11 4 8 12 S6

  21. Greedy Algorithm Simulation S1 1 5 9 2 6 10 Cgreedy: S4, S2, S3 3 7 11 4 8 12 S6

  22. Greedy Algorithm Simulation 1 5 9 2 6 10 Cgreedy: S4, S2, S3, S1 Size is 4, Not Optimal 3 7 11 4 8 12

  23. Thought Experiment Cost of each set in the output is 1. Distribute the cost of each set Si over the new elements that Si covers when it’s picked.

  24. Thought Experiment Simulation S1 S2 Costs of Elements S3 S4 1 5 9 1 5 9 2 6 10 2 6 10 S5 3 7 11 3 7 11 4 8 12 4 8 12 S6

  25. Thought Experiment Simulation Costs of Elements S4 1 5 9 1 1/6 5 1/6 9 1/6 2 6 10 2 1/6 6 1/6 10 1/6 3 7 11 3 7 11 4 8 12 4 8 12

  26. Thought Experiment Simulation S2 Costs of Elements S4 1 5 9 1 1/6 5 1/6 9 1/6 2 6 10 2 1/6 6 1/6 10 1/6 3 7 11 3 7 11 4 8 12 4 8 12

  27. Thought Experiment Simulation S2 Costs of Elements S4 1 5 9 1 1/6 5 1/6 9 1/6 2 6 10 2 1/6 6 1/6 10 1/6 3 7 11 3 1/3 7 1/3 11 4 8 12 4 8 1/3 12

  28. Thought Experiment Simulation S2 Costs of Elements S3 S4 1 5 9 1 1/6 5 1/6 9 1/6 2 6 10 2 1/6 6 1/6 10 1/6 3 7 11 3 1/3 7 1/3 11 4 8 12 4 8 1/3 12

  29. Thought Experiment Simulation S2 Costs of Elements S3 S4 1 5 9 1 1/6 5 1/6 9 1/6 2 6 10 2 1/6 6 1/6 10 1/6 3 7 11 3 1/3 7 1/3 11 1/2 4 8 12 4 8 1/3 12 1/2

  30. Thought Experiment Simulation S1 S2 Costs of Elements S3 S4 1 5 9 1 1/6 5 1/6 9 1/6 2 6 10 2 1/6 6 1/6 10 1/6 3 7 11 3 1/3 7 1/3 11 1/2 4 8 12 4 8 1/3 12 1/2

  31. Thought Experiment Simulation S1 S2 Costs of Elements S3 S4 1 5 9 1 1/6 5 1/6 9 1/6 2 6 10 2 1/6 6 1/6 10 1/6 3 7 11 3 1/3 7 1/3 11 1/2 4 8 12 4 1/1 8 1/3 12 1/2

  32. Q1: “Cost of the Universe” U? 1 1/6 5 1/6 9 1/6 A: |Cgreedy| b/c each time the greedy algorithm picks a new set we distribute a cost of 1 to newly covered elements. 2 1/6 6 1/6 10 1/6 3 1/3 7 1/3 11 1/2 4 1/1 8 1/3 12 1/2

  33. Q1: “Cost of the Universe” U? 1 1/6 5 1/6 9 1/6 b/c each time the greedy algorithm picks a new set we distribute a cost of 1 to newly covered elements. 2 1/6 6 1/6 10 1/6 3 1/3 7 1/3 11 1/2 4 1/1 8 1/3 12 1/2

  34. Q2: Sum of the “Costs of the Sets” in Copt? 1 1/6 5 1/6 9 1/6 2 1/6 6 1/6 10 1/6 3 1/3 7 1/3 11 1/2 4 1/1 8 1/3 12 1/2

  35. Q2: Sum of the “Costs of the Sets” in Copt? S1 1 1/6 5 1/6 9 1/6 2 1/6 6 1/6 10 1/6 1/6 + 1/6+ 1/3 + 1/1 3 1/3 7 1/3 11 1/2 4 1/1 8 1/3 12 1/2

  36. Q2: Sum of the “Costs of the Sets” in Copt? S1 S2 1 1/6 5 1/6 9 1/6 2 1/6 6 1/6 10 1/6 1/6 + 1/6+ 1/3 + 1/1 3 1/3 7 1/3 11 1/2 1/6 + 1/6+ 1/3 + 1/3 4 1/1 8 1/3 12 1/2

  37. Q2: Sum of the “Costs of the Sets” in Copt? S3 S1 S2 1 1/6 5 1/6 9 1/6 2 1/6 6 1/6 10 1/6 1/6 + 1/6+ 1/3 + 1/1 3 1/3 7 1/3 11 1/2 1/6 + 1/6+ 1/3 + 1/3 1/6 + 1/6+ 1/2 + 1/2 4 1/1 8 1/3 12 1/2

  38. Q2: Sum of the “Costs of the Sets” in Copt? b/c Copt is a set cover.

  39. Goal To say that Cgreedy is not much larger than Copt We currently have: Bound the cost of each set in Copt then, we can get a bound on |Cgreedy| in terms of |Copt|

  40. “Cost of Each Set S” is ≤ H(|S|)=O(ln(|S|) Claim: Cost of set S (not just the ones in Copt but in any set S) is ≤ H(|S|)=O(ln(|S|) If the claim is true then:

  41. Proof of Claim: by picture S a b c d e f g H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7

  42. Proof of Claim: by picture S a b c d e f g H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7 Q: Suppose the first time S’s elements are covered, 3 are covered: e, f, g. What can you assert about the costs they get?

  43. Proof of Claim: by picture S a b c d e ≤1/7 f ≤1/7 g ≤1/7 H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7 A: ≤ 1/7 (b/c S had 7 uncovered elements but S was not picked. So the set that’s picked must have had at least 7 uncovered elements.)

  44. Proof of Claim: by picture S a b c d e ≤1/7 f ≤1/7 g ≤1/7 H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7 Q: Suppose the 2nd time S’s elements are covered, 1 was covered: d What can you assert about the cost of d?

  45. Proof of Claim: by picture S a b c d ≤1/4 e ≤1/7 f ≤1/7 g ≤1/7 H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7 A: ≤ 1/4 (by the same argument)

  46. Proof of Claim: by picture S a b c d ≤1/4 e ≤1/7 f ≤1/7 g ≤1/7 H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7 Q: Suppose the 3rd time S’s elements are covered, 2 was covered: b and c What can you assert about the costs of b and c?

  47. Proof of Claim: by picture S a b ≤1/3 c ≤1/3 d ≤1/4 e ≤1/7 f ≤1/7 g ≤1/7 H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7 A: ≤ 1/3 (by the same argument)

  48. Proof of Claim: by picture S a b ≤1/3 c ≤1/3 d ≤1/4 e ≤1/7 f ≤1/7 g ≤1/7 H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7 Q:Whatcan you assert about the cost of a?

  49. Proof of Claim: by picture S a ≤1 b ≤1/3 c ≤1/3 d ≤1/4 e ≤1/7 f ≤1/7 g ≤1/7 H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7 A: ≤ 1(by the same argument)

  50. Proof of Claim: by picture S a ≤1 b ≤1/3 c ≤1/3 d ≤1/4 e ≤1/7 f ≤1/7 g ≤1/7 H(S) 1 1/2 1/3 1/4 1/5 1/6 1/7 Conclusion: costs of a + b + … + g ≤ 1 + 1/2 + 1/3 + … + 1/7 costs of a + b + … + g ≤ H(7) ≤ ln(7) Q.E.D.

More Related