Você está na página 1de 2

Graphs 6/7/2002 11:50 AM

Outline and Reading


Approximation Algorithms for NP-Complete
Approximation Algorithms Problems (§13.4)
„ Approximation ratios
„ Polynomial-Time Approximation Schemes (§13.4.1)
„ 2-Approximation for Vertex Cover (§13.4.2)
„ 2-Approximation for TSP special case (§13.4.3)
„ Log n-Approximation for Set Cover (§13.4.4)

Approximation Algorithms 1 Approximation Algorithms 2

Polynomial-Time Approximation
Approximation Ratios Schemes
Optimization Problems
„ We have some problem instance x that has many A problem L has a polynomial-time
feasible “solutions”. approximation scheme (PTAS) if it has a
„ We are trying to minimize (or maximize) some cost polynomial-time (1+ε)-approximation algorithm,
function c(S) for a “solution” S to x. For example,
for any fixed ε >0 (this value can appear in the
Š Finding a minimum spanning tree of a graph
Š Finding a smallest vertex cover of a graph running time).
Š Finding a smallest traveling salesperson tour in a graph 0/1 Knapsack has a PTAS, with a running time
An approximation produces a solution T that is O(n3/ ε). Please see §13.4.1 in Goodrich-
„ T is a k-approximation to the optimal solution OPT Tamassia for details.
if c(T)/c(OPT) < k (assuming a min. prob.; a
maximization approximation would be the reverse)
Approximation Algorithms 3 Approximation Algorithms 4

A 2-Approximation for
Vertex Cover Vertex Cover
Every chosen edge e
A vertex cover of graph G=(V,E) is a subset W of V, Algorithm VertexCoverApprox(G)
has both ends in C
Input graph G
such that, for every (a,b) in E, a is in W or b is in W. But e must be covered Output a vertex cover C for G
OPT-VERTEX-COVER: Given an graph G, find a vertex by an optimal cover; C ← empty set
cover of G with smallest size. hence, one end of e H←G
while H has edges
OPT-VERTEX-COVER is NP-hard. must be in OPT e ← H.removeEdge(H.anEdge())
Thus, there is at most v ← H.origin(e)
twice as many vertices w ← H.destination(e)
C.add(v)
in C as in OPT. C.add(w)
That is, C is a 2-approx. for each f incident to v or w
of OPT H.removeEdge(f)
return C
Running time: O(m)
Approximation Algorithms 5 Approximation Algorithms 6

1
Graphs 6/7/2002 11:50 AM

Special Case of the Traveling A 2-Approximation for TSP


Salesperson Problem Special Case
OPT-TSP: Given a complete, weighted graph, find Algorithm TSPApprox(G)
a cycle of minimum cost that visits each vertex. Input weighted complete graph G,
satisfying the triangle inequality
„ OPT-TSP is NP-hard Output a TSP tour T for G
„ Special case: edge weights satisfy the triangle Euler tour P of MST M M ← a minimum spanning tree for G
P ← an Euler tour traversal of M,
inequality (which is common in many applications): starting at some vertex s
Š w(a,b) + w(b,c) > w(a,c) T ← empty list
for each vertex v in P (in traversal order)
if this is v’s first appearance in P then
b T.insertLast(v)
5 4 T.insertLast(s)
Output tour T return T
a c
7
Approximation Algorithms 7 Approximation Algorithms 8

A 2-Approximation for TSP


Special Case - Proof Set Cover
The optimal tour is a spanning tour; hence |M|<|OPT|.
The Euler tour P visits each edge of M twice; hence |P|=2|M| Algorithm SetCoverApprox(G)
Each time we shortcut a vertex in the Euler Tour we will not increase OPT-SET-COVER: Given a Input a collection of sets S1…Sm
the total length, by the triangle inequality (w(a,b) + w(b,c) > w(a,c)); collection of m sets, find the Output a subcollection C with same union
smallest number of them F ← {S1,S2,…,Sm}
hence, |T|<|P|.
whose union is the same as C ← empty set
Therefore, |T|<|P|=2|M|<2|OPT| U ← union of S1…Sm
the whole collection of m sets?
while U is not empty
Si ← set in F with most elements in U
„ OPT-SET-COVER is NP-hard
F.remove(Si)
C.add(Si)
Greedy approach produces an Remove all elements in Si from U
O(log n)-approximation return C
Output tour T Euler tour P of MST M Optimal tour OPT
(at most the cost of P) (twice the cost of M) (at least the cost of MST M)
algorithm. See §13.4.4 for
details.
Approximation Algorithms 9 Approximation Algorithms 10

Você também pode gostar