140 likes | 298 Vues
APPROXIMATION ALGORITHMS VERTEX COVER – MAX CUT PROBLEMS. SELIM KALAYCI FIU-SCS 04/13/2005. S ome optimi z ation problems are “ NP- hard” (by hardness of related decision problem), there is no poly-time algorithm unless P = NP . • largest clique • smallest vertex cover
E N D
APPROXIMATION ALGORITHMS VERTEX COVER – MAX CUT PROBLEMS SELIM KALAYCI FIU-SCS 04/13/2005
Some optimization problems are “NP-hard” (byhardness of relateddecision problem), there is no poly-time algorithm unless P = NP. • largest clique • smallest vertex cover • largest maximum cut • . . . But: sometimes sub-optimal solutions are kind of OK • pretty large clique • pretty small vertex cover • pretty large maximum cut • . . . if algorithms run in poly time (preferably small exponents). Motivation
APPROXIMATION ALGORITHMS • Definition:Approximation algorithm • An approximation algorithm for a problem is a polynomial-time algorithm that, when given input I, outputs an element of FS(I). • Feasible solution set • A feasible solution is an object of the right type but not necessarily an optimal one. FS(I) is the set of feasible solutions for I.
APPROXIMATION RATIO • Approximation algorithm hasapproximation ratio of ρ(n), if for any inputof size n, the outcome Oof its solution is within factor ρ(n) of outcome of optimal solution O*, i.e. 1≤Max (O/O*, O*/O) ≤ρ(n) Minimization problem Maximization problem
APPROXIMATION RATIO • An algorithm with guaranteed approximation ratio of ρ(n)is called a ρ(n)-approximation algorithm. • A 1-approximation algorithm is optimal, and the larger theratio, the worse the solution. • For many NP-complete problems, constant-factor approximations(i.e. computed clique is always at leasthalf the size of maximum-size clique), • Sometimes best known approx ratio grows with n,
Problem: Given graph G = (V,E), find smallest s.t. if (u, v)E, then u V′or vV′ or both. Decision problem is NP-complete (3SAT ≤p VC, Sipser 7.5) Optimization problem isat least as hard. VERTEX COVER PROBLEM
VERTEX COVER ALGORITHM • Here is a trivial 2-approximation algorithm • Input is some graph G = (V,E). APPROX-VERTEX-COVER 1: C ←Ø ; 2: E′← E 3: while E′ ≠Ø; do 4: let (u, v) be an arbitrary edge of E′ 5: C ←C {(u, v)} 6: remove from E′all edges incident on either u or v 7: end while
b c d a e f g VERTEX COVER EXAMPLE Input Graph b c d a e f g Optimal result, Size 3
b c d b c d b c d b c d a e f g a e f g a e f g a e f g VECTOR COVER ALGORITHM EXAMPLE Step 1: choose edge (c,e) Step 2: choose edge (d,g) Step 3: choose edge (a,b) Result: Size 6
PROOF Theorem. APPROX-VERTEX-COVER is a poly-time 2-approximation algorithm. Proof. The running time is trivially bounded by O(V * E) (at most |E| iterations, each of complexity at most O(V )). Correctness: C clearly is a vertex cover.
PROOF cont. Size of the cover: let A denote set of edges that are picked ({(c, e), (d, g), (a, b)} in example). 1. In order to cover edges in A, any vertex cover, in particularan optimalcover C*, must include at least oneendpoint of each edge in A. By construction of the algorithm, no two edges in Ashare an endpoint(once edge is picked, all edges incidenton either endpoint areremoved). Therefore, no two edges in A are covered by the samevertex in C*, and |C*|≥ |A|. 2. When an edge is picked, neither endpoint is already inC, thus |C| = 2|A|. Combining (1) and (2) yields |C| = 2|A| ≤2|C*| q.e.d
MAX CUT PROBLEM • Given an undirected graph G (V,E): Separate vertices of G into two disjoint sets S and T, such that number of cut edges is maximum. (Maximization Problem) • Cut edge: An edge between a node in S and a node in T.
MAX-CUT ALGORITHM Another 2-approximation algorithm : Given G (V,E) 1- S ←Ø and T ← V 2- If moving a single node from S to T, or from T to S increases the number of cut edges, make the move. Repeat 2. 3- Output the number of cut edges.