1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

27
1 ©D.Moshkovi tz Complexity The Traveling Salesman Problem

Transcript of 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

Page 1: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

1©D.MoshkovitzComplexity

The Traveling Salesman Problem

Page 2: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

2©D.MoshkovitzComplexity

The Mission: A Tour Around the World

Page 3: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

3©D.MoshkovitzComplexity

The Problem: Traveling Costs Money

1795$

Page 4: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

4©D.MoshkovitzComplexity

Introduction

• Objectives:– To explore the Traveling Salesman

Problem.• Overview:

– TSP: Formal definition & Examples– TSP is NP-hard– Approximation algorithm for special cases– Inapproximability result

Page 5: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

5©D.MoshkovitzComplexity

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

432

5

1 10

Page 6: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

6©D.MoshkovitzComplexity

Polynomial Algorithm for TSP?

What about the greedy strategy:

At any point, choose the closest vertex not explored

yet?

Page 7: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

7©D.MoshkovitzComplexity

The Greedy $trategy Fails

5

0

3

1

12

10

2

Page 8: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

8©D.MoshkovitzComplexity

The Greedy $trategy Fails

5

0

3

1

12

10

2

Page 9: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

9©D.MoshkovitzComplexity

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.

Page 10: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

10©D.MoshkovitzComplexity

TSP is NP-hard

Theorem: HAM-CYCLE p TSP.

Proof: By the straightforward efficient reduction illustrated below:

HAM-CYCLE TSP

1 21

1

1

2 k=|V|

verify!

Page 11: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

11©D.MoshkovitzComplexity

What Next?

• We’ll show an approximation algorithm for TSP,

• with approximation factor 2 • for cost functions that satisfy

a certain property.

Page 12: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

12©D.MoshkovitzComplexity

The Triangle Inequality

Definition: We’ll say the cost function c satisfies the triangle inequality, ifu,v,wV : c(u,v)+c(v,w)c(u,w)

Page 13: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

13©D.MoshkovitzComplexity

Approximation Algorithm

1. Grow a Minimum Spanning Tree (MST) for G.

2. Return the cycle resulting from a preorder walk on that tree.

COR(B) 525-527

Page 14: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

14©D.MoshkovitzComplexity

Demonstration and Analysis

The cost of a minimal

Hamiltonian cycle the cost of a

MST

Page 15: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

15©D.MoshkovitzComplexity

Demonstration and Analysis

The cost of a preorder walk is twice the cost of

the tree

Page 16: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

16©D.MoshkovitzComplexity

Demonstration and Analysis

Due to the triangle inequality, the

Hamiltonian cycle is not worse.

Page 17: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

17©D.MoshkovitzComplexity

The Bottom Line

optimal HAM cycle

MSTpreorder

walk

our HAM cycle

= ½· ½·

Page 18: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

18©D.MoshkovitzComplexity

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.

COR(B) 528

Page 19: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

19©D.MoshkovitzComplexity

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|.

Page 20: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

20©D.MoshkovitzComplexity

Instances

min cost

|V| |V|

1

1

1

0+1

0

0

1

Page 21: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

21©D.MoshkovitzComplexity

What Should an Algorithm for gap-TSP Return?

|V| |V|

YES! NO!

min cost

gap

DON’T-CARE...

Page 22: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

22©D.MoshkovitzComplexity

gap-TSP & Approximation

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

Page 23: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

23©D.MoshkovitzComplexity

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.

Page 24: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

24©D.MoshkovitzComplexity

The Reduction Illustrated

HAM-CYCLE gap-TSP

1 |V|+11

1

1

|V|+1

Verify (a) correctness (b)

efficiency

Page 25: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

25©D.MoshkovitzComplexity

Approximating TSP is NP-hard

gap-TSP[] is NP-hard

Approximating TSP within factor is NP-hard

Page 26: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

26©D.MoshkovitzComplexity

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.

Page 27: 1 ©D.Moshkovitz Complexity The Traveling Salesman Problem.

27©D.MoshkovitzComplexity

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.