WINSEM2014-15_CP2400_13-Apr-2015_RM01_Approximation_Vertex_cover_LSI.ppt - An introduction to Approximation Algorithms Overview Introduction Performance

# WINSEM2014-15_CP2400_13-Apr-2015_RM01_Approximation_Vertex_cover_LSI.ppt

• Notes
• 54

This preview shows page 1 out of 54 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 Semidefinite 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 Must sacrifice one of three desired features. Solve problem to optimality. Solve problem in poly-time. Solve arbitrary instances(parts) of the problem. -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. Spring 2003 Approximation Algorithmes 6 Challenge. Need to prove a solution's value is close to optimum, without even knowing what optimum value is! But we want the answer … If the input is small use backtrack. Isolate the problem into P-problems ! Find the Near-Optimal solution in polynomial time.( either worst case or average case) Spring 2003 Approximation Algorithmes 7 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 8 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 9 C= approx soln Performance ratios … c*=optimal soln Spring 2003 Approximation Algorithmes 10 Approximation Algorithm E.g.: If the total weigh of a MST(Minimum Spanning Tree) of graph G is 20 is c* since it’s a minimization problem) A algorithm can produce some spanning trees, and they are not MSTs, but their total weights are always smaller than 25 is c its the result that algorithm produces , approx value) What is the approximation ratio? 25/20 = 1.25 This algorithm is called? 1.25 approximation algorithm. This ratio is 2 in TSP hence its 2 approx alg Spring 2003 Approximation Algorithmes 11 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 12 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 13 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 14 Some examples: Vertex cover problem. Traveling salesman problem. Set cover problem. Spring 2003 Approximation Algorithmes 15 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 16 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 17 The vertex-cover problem … APPROX-VERTEX-COVER(G) 1 C←Ø 2 E′ ← E[G] 3 while E′ ≠ Ø 4 do let (u, v) be an arbitrary edge of E′ 5 C ← C U {u, v} 6 remove every edge in E′ incident on u or v 7 return C Spring 2003 Approximation Algorithmes 18 The vertex-cover problem … Near Optimal size=6 Spring 2003 Approximation Algorithmes Optimal Size=3 19 Demo Compare this cover to20the 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) 21 Correctness The set of vertices our algorithm returns is clearly a vertex-cover, since we iterate until every edge is covered. 22 Vertex-cover problem and a 2-approximation algorithm Vertex-cover problem and a 2-approximation algorithm 1 2 3 4 5 6 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 38 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 39 Vertex-cover problem and a 2-approximation algorithm 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 41 Traveling salesman problem Exact exponential solution: Branch and bound Spring 2003 Lower bound: (sum of two lower degree of vertices)/2 Approximation Algorithmes 42 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 43 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 44 Traveling salesman problem Near Optimal solution Spring 2003 Faster More easy to impliment. Approximation Algorithmes 45 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 46 Traveling salesman problem with triangle inequality. MS T roo t Pre-Order walk Spring 2003 Approximation Algorithmes Hamiltonia n Cycle 47 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 48 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 49 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 50 The set-Cover … Minimal Covering set size=3 Spring 2003 Approximation Algorithmes 51 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 52 The set-Cover … 1st chose 3rd chose 2nd chose Greedy Covering set size=4 4th chose Spring 2003 Approximation Algorithmes 53 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 54 ...
View Full Document