Sie sind auf Seite 1von 27

The Traveling Salesman Problem

D.Moshkovitz Complexity

The Mission: A Tour Around the World

D.Moshkovitz Complexity

The Problem: Traveling Costs Money


1795$

D.Moshkovitz Complexity

Introduction
Objectives: To explore the Traveling Salesman Problem. Overview:
TSP: Formal definition & Examples TSP is NP-hard Approximation algorithm for special cases Inapproximability result

D.Moshkovitz Complexity

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

3
5

10

D.Moshkovitz Complexity

Polynomial Algorithm for TSP?


What about the greedy strategy: At any point, choose the closest vertex not explored yet?

D.Moshkovitz Complexity

The Greedy $trategy Fails


10
2

12

5
3

D.Moshkovitz Complexity

The Greedy $trategy Fails


10
2

12

5
3

D.Moshkovitz Complexity

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 cycle whose cost is at most k.

D.Moshkovitz Complexity

TSP is NP-hard
Theorem: HAM-CYCLE p TSP. Proof: By the straightforward efficient reduction illustrated below:
1 verify!

1 2 1

1 2

k=|V|

HAM-CYCLE
D.Moshkovitz Complexity

TSP
10

What Next?
Well show an approximation algorithm for TSP, with approximation factor 2 for cost functions that satisfy a certain property.

D.Moshkovitz Complexity

11

The Triangle Inequality


Definition: Well say the cost function c satisfies the triangle inequality, if u,v,wV : c(u,v)+c(v,w)c(u,w)

D.Moshkovitz Complexity

12

COR(B) 525-527

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

D.Moshkovitz Complexity

13

Demonstration and Analysis


The cost of a minimal Hamiltonian cycle the cost of a MST

D.Moshkovitz Complexity

14

Demonstration and Analysis


The cost of a preorder walk is twice the cost of the tree

D.Moshkovitz Complexity

15

Demonstration and Analysis


Due to the triangle inequality, the Hamiltonian cycle is not worse.

D.Moshkovitz Complexity

16

The Bottom Line


optimal HAM cycle preorder walk our HAM cycle

MST

D.Moshkovitz Complexity

17

What About the General Case?


Well show TSP cannot be approximated within any constant factor 1 By showing the corresponding gap version is NP-hard.

COR(B) 528

D.Moshkovitz Complexity

18

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|.
D.Moshkovitz Complexity

19

Instances
1 1 1

min cost |V|


1

|V| 0 +1

D.Moshkovitz Complexity

20

What Should an Algorithm for gap-TSP Return?


YES!
|V| DONT-CARE... |V|

NO!
min cost

gap
21

D.Moshkovitz Complexity

gap-TSP & Approximation


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

D.Moshkovitz Complexity

22

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.

D.Moshkovitz Complexity

23

The Reduction Illustrated


1 1
|V|+1

|V|+1

1 HAM-CYCLE gap-TSP

Verify (a) correctness (b) efficiency


D.Moshkovitz Complexity

24

Approximating TSP is NPhard


gap-TSP[] is NP-hard

Approximating TSP within factor is NP-hard


25

D.Moshkovitz Complexity

Summary

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

D.Moshkovitz Complexity

26

Summary

For the general case weve proven there is probably no efficient approximation algorithm for TSP. Moreover, weve demonstrated a generic method for showing approximation problems are NP-hard.

D.Moshkovitz Complexity

27

Das könnte Ihnen auch gefallen