WINSEM2015-16_CP2075_12-APR-2016_RM02_Approximation_Vertex_cover_LSI.ppt - An introduction to Approximation Algorithms Overview Introduction Performance

WINSEM2015-16_CP2075_12-APR-2016_RM02_Approximation_Vertex_cover_LSI.ppt

This preview shows page 1 out of 60 pages.

You've reached the end of your free preview.

Want to read all 60 pages?

Unformatted text preview: An introduction to Approximation Algorithms Overview Introduction Performance ratios The vertex-cover problem Traveling salesman problem Set cover problem Spring 2003 Approximation Algorithmes 2 Introduction In computer science and operations research , approximation algorithms are algorithms used to find approximate solutions to optimization problems. Approximation algorithms are often associated with NP-hard problems Approximation algorithms are increasingly being used for problems where exact polynomial-time algorithms are known but are too expensive due to the input size. A typical example for an approximation algorithm is the one vertex cover in graph. Spring 2003 Approximation Algorithmes 3 The essential techniques to design and analyze approximation algorithms Combinatorial methods Linear programming Semi definite programming Primal-dual and relaxation methods Hardness of approximation polynomial time. Spring 2003 Approximation Algorithmes 4 There are many important NP-Complete problems There is no fast solution ! Suppose I need to solve an NP-hard problem. What should I do? A Theory says you're unlikely to find a poly-time algorithm. Spring 2003 Approximation Algorithmes 5 Coping With NP-Hardness Brute-force algorithms. Heuristics. Develop clever enumeration strategies. Guaranteed to find optimal solution. No guarantees on running time. Develop intuitive algorithms. Guaranteed to run in polynomial time. No guarantees on quality of solution . Must sacrifice one of three desired features. Solve problem to optimality. Solve problem in poly-time. Solve arbitrary instances of the problem. 6 Approximation algorithm Approximation algorithm. Guaranteed to run in poly-time. Guaranteed to solve arbitrary instance of the problem Guaranteed to find solution within ratio of true optimum. Guaranteed to find "high quality" solution, say within 1% of optimum. Obstacle: need to prove a solution’s value is close to optimum, without even knowing what optimum value is! Approximation Algorithmes 7 Approximation algorithm Challenge.: Need to prove a solution's value is close to optimum, without even knowing what optimum value is! Motivation: Many problems are NP-complete, so unlikely find efficient algorithms But we want the answer … If the input is small use backtrack. If input size is small, exponential algorithm is OK. Isolate important special case and find poly algorithms for them. Find the Near-Optimal solution in polynomial time.( either worst case or average case) So approximate algorithms: An algorithm returning a near-optimal solution is called approximate algorithm Spring 2003 Approximation Algorithmes 8 Some Characteristics of Approximation Algorithms Time-efficient (sometimes not as efficient as heuristics) Don’t guarantee optimal solution Guarantee good solution within some factor of the optimum Rigorous mathematical analysis to prove the approximation guarantee Often use algorithms for related problems as subroutines - Depending on the problem , an optimal solution may be defined as the problem of maximization or minimization problem. Performance ratios We are going to find a Near-Optimal solution for a given problem.(either Worst Case or Average Case) We assume two hypothesis : Spring 2003 Each potential solution has a positive cost. The problem may be either a maximization or a minimization problem on the cost. Approximation Algorithmes 10 Performance ratios … If for any input of size n, the cost C of the solution produced by the algorithm is within a factor of ρ(n) of the cost C* of an optimal solution: Max ( C/C* , C*/C ) ≤ ρ(n) We call this algorithm as an ρ(n)-approximation algorithm. Spring 2003 Approximation Algorithmes 11 Approximation algorithms for NPC problems Performance ratios … Spring 2003 Approximation Algorithmes 13 Approximation Algorithm E.g.: If the total weigh of a MST(Minimum Spanning Tree) of graph G is 20 A algorithm can produce some spanning trees, and they are not MSTs, but their total weights are always smaller than 25 What is the approximation ratio? 25/20 = 1.25 This algorithm is called? 1.25 approximation algorithm. Spring 2003 Approximation Algorithmes 14 Approximation scheme Approximation scheme is an approximation algorithm that takes as input an instance of the problem and Є>0 such that for any fixed Є>0, the scheme is (1+Є)-approximation algorithm. There are 2 schemes 1. polynomial time approximation scheme 2. Fully Polynomial-time approximation scheme Spring 2003 Approximation Algorithmes 15 Approximation schemePolynomial-time approximation scheme scheme is a We say that an approximation polynomial time approximation scheme if for any fixed Є>0 , the scheme runs in time polynomial in the size n of its input instance Polynomial-time approximation scheme is such algorithm that runs in time polynomial in the size of input. As the Є decreases the running time of the algorithm can increase rapidly: For example it might be O(n2/Є) If Є decreases by constant factor the running time should not increase by more than a constant factor. ie., the running time to be polynomial in 1/Є as well as in n. Spring 2003 Approximation Algorithmes 16 Approximation scheme- Fully Polynomial-time approximation scheme We have Fully Polynomial-time approximation scheme when its running time is polynomial not only in n (input size instance) but also in 1/ Є For example it could be O((1/Є)3n2) Therefore any constant –factor decrease in Є can be achieved with a corresponding constant factor increase in the Running Time. Spring 2003 Approximation Algorithmes 17 Some examples: Vertex cover problem. Traveling salesman problem. Set cover problem. Spring 2003 Approximation Algorithmes 18 The vertex-cover problem A vertex-cover of an undirected graph G is a subset of its vertices such that it includes at least one end of each edge. The problem is to find minimum size of vertex-cover of the given graph. This problem is an NP-Complete problem. Spring 2003 Approximation Algorithmes 19 The vertex-cover problem … Finding the optimal solution is hard (its NP!) but finding a near-optimal solution is easy. There is an 2-approximation algorithm: Spring 2003 It returns a vertex-cover not more than twice of the size optimal solution. Approximation Algorithmes 20 The vertex-cover problem … APPROX-VERTEX-COVER(G) 1 2 3 4 5 6 C←Ø E′ ← E[G] while E′ ≠ Ø do let (u, v) be an arbitrary edge of E′ C ← C U {u, v} remove every edge in E′ incident on u or v 7 return C Spring 2003 Approximation Algorithmes 21 The vertex-cover problem … Near Optimal size=6 Spring 2003 Approximation Algorithmes Optimal Size=3 22 Demo Compare this cover to23the one from the example Polynomial Time •C • E’ E O(n2) • while E’ do – let (u,v) be an arbitrary edge of E’ – C C {u,v} O(n2) – remove from E’ every edge incident to either u or v • return C O(1) O(n) 24 Correctness The set of vertices our algorithm returns is clearly a vertex-cover, since we iterate until every edge is covered. 25 Vertex-cover problem and a 2-approximation algorithm Vertex-cover problem and a 2-approximation algorithm 1 b 1 b c 2 3 d 4 a 5 e 6 f g 7 Are the red vertices a vertex-cover? No. why? Edges (5, 6), (3, 6) and (3, 7) are not covered by it Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 Are the red vertices a vertex-cover? No. why? Edge (3, 7) is not covered by it 7 Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 Are the red vertices a vertex-cover? Yes What is the size? 4 7 Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 Are the red vertices a vertex-cover? Yes What is the size? 7 7 Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 Are the red vertices a vertex-cover? Yes What is the size? 5 7 Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 Are the red vertices a vertex-cover? Yes What is the size? 3 7 Vertex-cover problem and a 2-approximation algorithm Vertex-cover problem Given a undirected graph, find a vertex cover with minimum size. Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 A minimum vertex-cover 7 Vertex-cover problem and a 2-approximation algorithm Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 7 Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 It is then a vertex cover Size? 6 How far from optimal one? Max(6/3, 3/6) = 2 7 Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 7 Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 It is then a vertex cover Size? 4 How far from optimal one? Max(4/3, 3/4) = 1.33 7 Vertex-cover problem and a 2-approximation algorithm THEOREM:35.1 APPROX-VERTEX-COVER(G) is a 2approximation algorithm AIM: When the size of minimum vertex-cover is s The vertex-cover produced by APPROXVERTEX-COVER is at most 2s Proof : APPROX-VERTEX-COVER(G) runs in Polynomial time. Let ‘A’ denote the set of edges that were picked in line -4 of Algorithm. In order to cover the edges in A, an optimal cover C*(U* denoted in proof) must include at least one end point of each edge in A.(By example C* includes b,e,d) No two edges in A share an END POINTS,since once an edge is picked , all the edges incident on it are deleted from E‘.(By example –A ={ (b,c),(e,f), (d,g)} ) Thus no two edges in A are covered by the same vertex from C* and we have the lower bound. Spring 2003 Approximation Algorithmes 41 NOTE: To decide the size of the optimal cover we utilize the lower bound on the optimal cover . By relating the size of the solution returned to the lower bound , we obtain our approximation ratio. Spring 2003 Approximation Algorithmes 42 Vertex-cover problem and a 2-approximation algorithm The set-Cover Generalization of vertex-cover problem. We have given (X,F) : Spring 2003 X : a finite set of elements. F : family of subsets of X such that every element of X belongs to at least one subset in F. Solution C : subset of F that Includes all the members of X. Approximation Algorithmes 44 The set-covering problem X: a b d e F: f1: a b f2: b f3: c f4: d h e f5: a c h {f1, f3, f4} is a subset of F covering X {f1, f2, f3, f4} is a subset of F covering X {f2, f3, f4, f5} is a subset of F covering X Here, {f1, f3, f4} is a minimum cover set The set-covering problem The set-Cover … Minimal Covering set size=3 Spring 2003 Approximation Algorithmes 48 The set-Cover … GREEDY-SET-COVER(X,F) 1M←X 2C←Ø 3 while M ≠ Ø do 4 select an SЄF that maximizes |S ‫ ח‬M| 5 M←M–S 6 C ← C U {S} 7 return C Spring 2003 Approximation Algorithmes 49 The set-Cover … 1st chose 3rd chose 2nd chose Greedy Covering set size=4 4th chose Spring 2003 Approximation Algorithmes 50 The set-Cover … This greedy algorithm is polynomialtime ρ(n)-approximation algorithm ρ(n)=H(max{|S| : S Є F}) Hd =∑ d i=1 The proof is beyond of scope of this presentation. Spring 2003 Approximation Algorithmes 51 Traveling salesman problem Given an undirected weighted Graph G we are to find a minimum cost Hamiltonian cycle. Satisfying triangle inequality or not this problem is NP-Complete. Spring 2003 We can solve Hamiltonian path. Approximation Algorithmes 52 Traveling salesman problem Exact exponential solution: Branch and bound Spring 2003 Lower bound: (sum of two lower degree of vertices)/2 Approximation Algorithmes 53 Traveling salesman problem 3 3 a 7 b 4 e c 6 2 Spring 2003 6 4 5 A: 2+3 B: 3+3 C: 4+4 D: 2+5 E: 3+6 = 35 Bound: 17,5 d Approximation Algorithmes 54 Traveling salesman problem 17.5 All Terms 17.5 18.5 ab ~ab 20.5 17.5 ab,ac => ~ac,ad ab 21 18.5 ~ab,~ac ab,ac 23 Ab,~ac,~ad 18 23 Ab,~ac,ad Ab,~ac,ad~ac,bc Spring 2003 21 Ab,~ac,ad,~ac,~bc Approximation Algorithmes 55 Traveling salesman problem Near Optimal solution Spring 2003 Faster More easy to impliment. Approximation Algorithmes 56 Traveling salesman problem with triangle inequality. APPROX-TSP-TOUR(G, c) 1 select a vertex r Є V[G] to be root. 2 compute a MST for G from root r using Prim Alg. 3 L=list of vertices in preorder walk of that MST. 4 return the Hamiltonian cycle H in the order L. Spring 2003 Approximation Algorithmes 57 Traveling salesman problem with triangle inequality. MS T roo t Pre-Order walk Spring 2003 Approximation Algorithmes Hamiltonia n Cycle 58 Traveling salesman problem This is polynomial-time 2approximation algorithm. (Why?) Preorder Solutio n Spring 2003 Because: APPROX-TSP-TOUR is O(V2) C(MST) ≤ C(H*) C(W)=2C(MST) C(W)≤2C(H*) C(H)≤C(W) C(H)≤2C(H*) Optimal Approximation Algorithmes 59 Traveling salesman problem In General Theorem: If P ≠ NP, then for any constant ρ≥1, there is no polynomial time ρapproximation algorithm. c(u,w) ={uEw ? 1 : ρ|V|+1} ρ|V|+1+|V|-1>ρ|V| Selected edge not in E Spring 2003 Rest of edges Approximation Algorithmes 60 ...
View Full Document

  • Spring '19
  • Computational complexity theory, NP-complete problems, Approximation algorithm, NP-complete, Algorithmes

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture