Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

CS 306 DAA, IIITDM Jabalpur

11/16/2012

Approximation Algorithms

Hard Problems
In 1971, Cook was able to prove that the boolean Satisfiability (SAT) problem was NP-complete. Proofs now exist showing that many problems in NP are efficiently reducible to the satisfiability problem. Thus we have a large class of problems which will are all related to each other: finding an efficient solution to one will result in an efficient solution for them all. An efficient solution has so far eluded a very large number of researchers but there is also no proof that these problems cannot be solved in polynomial time, so the search continues.

CS 306 DAA, IIITDM Jabalpur

11/16/2012

Optimization Problems
For a minimization problem with instance I
let us denote the optimal solution by OPT(I) Our algorithm A, when run on the instance I returns a solution with value A(I) The approximation ratio is defined as

Set Cover

CS 306 DAA, IIITDM Jabalpur

11/16/2012

Set Cover
Is NP-Complete A greedy algorithm may a good approximation But, how good?
Let k be the number of vertices in the optimal set cover Let nt be the number of vertices left to be covered after t iterations We can write n1 <= n0 n0/k Similarly, n2 <= n1 n1/k <= n0(1 - 1/k)2 and so on So nt <= n0(1 - 1/k)t We can write that nt < n0(e-1/k)t as (1-x) <= e-x for x < 1 nt will be < 1 for t = k lg n0, which mean no more vertices left to be covered So, the number of nodes included in the set cover will be not more than lg n times the optimal cover set.

Set Cover
Can we do better? A better approximation algorithm is based on the notion of matching
A subset of edges that have no vertices in common A matching is maximal if no more edges can be added to the subset

CS 306 DAA, IIITDM Jabalpur

11/16/2012

Matching

Set Cover: Another Approximation Algorithm


What is the relationship between matching and vertex cover
Any vertex cover of a graph G must be at least as large as the number of edges in any matching in G This is simply because each edge of the matching must be covered by one of its endpoints in any vertex cover

CS 306 DAA, IIITDM Jabalpur

11/16/2012

Set Cover: The Better Algorithm


let S be a set that contains both endpoints of each edge in a maximal matching M Then S must be a vertex cover The S contains 2*|M| vertices And, any vertex cover must have size at least |M| We are done !

Set Cover: Summary


Though we do not know the optimal vertex cover However, we know a lower bound on vertex cover (give by maximal matching information) And the approximation ratio <=2

CS 306 DAA, IIITDM Jabalpur

11/16/2012

Solving TSP
A guess for a good lower bound for TSP? One simple approach is the find the minimum spanning tree. One possible tour simple traverses the MST twice. So we can find a tour which is at most twice as long as the optimum tour in polynomial time Various heuristics can now be applied to reduce this tour, e.g. by taking shortcuts

Solving TSP
Removing any edge from a traveling salesman tour leaves a path p through all the vertices, which is a spanning tree
TSP Cost >= cost of p >= MST cost

CS 306 DAA, IIITDM Jabalpur

11/16/2012

Solving TSP

This tour has a length at most twice the MST cost However, not a legal tour!

Solving TSP
To fix the problem, the tour should simply skip any city it is about to revisit, and instead move directly to the next new city in its list By the triangle inequality, these bypasses can only make the overall tour shorter What if the triangle inequality does not hold?

CS 306 DAA, IIITDM Jabalpur

11/16/2012

Solving TSP
Another strategy which works well in practice is to divide the "map" into many small regions and to generate the optimum tour by exhaustive search within those small regions. A greedy algorithm can then be used to link the regions. While this algorithm will produce tours as little as 5% longer than the optimum tour in acceptable times, it is still not guaranteed to produce the optimal solution.

Summary
For NP-Complete problems, next best thing may be to compromise for the optimal solution We can design approximation algorithms that can compute sub-optimal solutions in efficient time Moreover, these algorithms give some kind of guarantee about how worse can be the solution in comparison with the optimal solution We have seen two approximation algorithms for the SET COVER and TSP problems

CS 306 DAA, IIITDM Jabalpur

11/16/2012

References
Chapter 9, Algorithms by S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani

You might also like