Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell (1872 - 1970)

Similar presentations


Presentation on theme: "1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell (1872 - 1970)"— Presentation transcript:

1 1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell ( ) * *TSP = Traveling Salesman Problem Based upon slides of Dana Moshkovitz

2 2 Approximation Algorithms A “good” algorithm is one whose running time is polynomial in the size of the input. Any hope of doing something in polynomial time for NP-Complete problems? Lets look at the Traveling Salesman Problem.

3 3 The Mission: A Tour Around the World

4 4 The Problem: Traveling Costs Money 1795$

5 5 Introduction Objectives: To explore the Traveling Salesman Problem. Overview: TSP: Formal definition & Examples TSP is NP-hard Approximation algorithm for special cases Hardness of Approximation in general.

6 6 TSP Given a weighted graph G=(V,E) V = Vertices = Cities E = Edges = Distances between cities Find the shortest tour that visits all cities

7 7 TSP Instance: A complete weighted undirected graph G=(V,E) (all weights are non-negative). Problem: To find a Hamiltonian cycle of minimal cost

8 8 Naïve Solution Try all possible tours and pick the minimum Dynamic Programming Definitely we need something better

9 9 What can we do? Give up on polynomial time algorithms? Try Heuristics by giving up on optimality? Try approximation algorithms?

10 10 Polynomial Algorithm for TSP? What about the greedy strategy: At any point, choose the closest vertex not explored yet?

11 11 The Greedy Strategy Fails   

12 12 The Greedy Strategy Fails   

13 13 Another Example Greedy strategy fails Even monkeys can do better than this !!!monkeys

14 14 TSP is NP-hard The corresponding decision problem: Instance: a complete weighted undirected graph G=(V,E) and a number k. Problem: to find a Hamiltonian path whose cost is at most k.

15 15 TSP is NP-hard Theorem: HAM-CYCLE  p TSP. Proof: By the straightforward efficient reduction illustrated below: HAM-CYCLETSP 1 cn n = k = |V| verify! cn

16 16 What Next? We will see what are approximation algorithms. We’ll show an approximation algorithm for TSP, with approximation factor 2 for cost functions that satisfy a certain property.

17 17 c -approximation algorithm The algorithm runs in polynomial time The algorithm always produces a solution which is within a factor of c of the value of the optimal solution c For all inputs x. OPT(x) here denotes the optimal value of the minimization problem

18 18 c -approximation algorithm The algorithm runs in polynomial time The algorithm always produces a solution which is within a factor of c of the value of the optimal solution c For all inputs x. OPT(x) here denotes the optimal value of the maximization problem

19 19 So why do we study Approximation Algorithms As algorithms to solve problems which need a solution As a mathematically rigorous way of studying heuristics Because they are fun! Because it tells us how hard problems are

20 20 TSP Is a minimization problem. We want a 2-approximation algorithm But only for the case when the cost function satisfies the triangle inequality.

21 21 The Triangle Inequality Cost Function: Let c(x,y) be the cost of going from city x to city y. Triangle Inequality: In most situations, going from x to y directly is no more expensive than going from x to y via an intermediate place z.

22 22 The Triangle Inequality Definition: We’ll say the cost function c satisfies the triangle inequality, if  x,y,z  V : c(x,z)+c(z,y)  c(x,y) x y z

23 23 Approximation Algorithm 1. Grow a Minimum Spanning Tree (MST) for G. 2. Return the cycle resulting from a preorder walk on that tree.

24 24 Demonstration and Analysis The cost of a minimal Hamiltonian cycle  the cost of a MST 

25 25 Demonstration and Analysis The cost of a preorder walk is twice the cost of the tree

26 26 Demonstration and Analysis Due to the triangle inequality, the Hamiltonian cycle is not worse.

27 27 The Bottom Line optimal HAM cycle MST preorder walk our HAM cycle  = ½·  ½·

28 28 What About the General Case? We’ll show TSP cannot be approximated within any constant factor  1 By showing the corresponding gap version is NP-hard.

29 29 gap-TSP[  ] Instance: a complete weighted undirected graph G=(V,E). Problem: to distinguish between the following two cases: There exists a Hamiltonian cycle, whose cost is at most |V|. The cost of every Hamiltonian cycle is more than  |V|.

30 30 Instances min cost |V|  |V|    0  +1  0 0 1

31 31 What Should an Algorithm for gap-TSP Return? |V|  |V| YES!NO! min cost gap DON’T-CARE...

32 32 gap-TSP & Approximation Observation: Efficient approximation of factor  for TSP implies an efficient algorithm for gap-TSP[  ].

33 33 gap-TSP is NP-hard Theorem: For any constant  1, HAM-CYCLE  p gap-TSP[  ]. Proof Idea: Edges from G cost 1. Other edges cost much more.

34 34 The Reduction Illustrated HAM-CYCLEgap-TSP 1  |V| Verify (a) correctness (b) efficiency

35 35 Approximating TSP is NP- hard gap-TSP[  ] is NP-hard Approximating TSP within factor  is NP-hard

36 36 Summary We’ve studied the Traveling Salesman Problem (TSP). We’ve seen it is NP-hard. Nevertheless, when the cost function satisfies the triangle inequality, there exists an approximation algorithm with ratio-bound 2. 

37 37 Summary For the general case we’ve proven there is probably no efficient approximation algorithm for TSP. Moreover, we’ve demonstrated a generic method for showing approximation problems are NP-hard. 


Download ppt "1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell (1872 - 1970)"

Similar presentations


Ads by Google