1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea...
-
Upload
tony-mount -
Category
Documents
-
view
218 -
download
1
Transcript of 1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea...
1
The TSP : Approximation and Hardness of Approximation
All exact science is dominated by the idea of approximation.-- Bertrand Russell (1872 - 1970)
*
*TSP = Traveling Salesman Problem
Based upon slides of Dana Moshkovitz
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
The Mission: A Tour Around the World
4
The Problem: Traveling Costs Money
1795$
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
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
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
8
Naïve Solution
Try all possible tours and pick the minimum
Dynamic Programming
))!1(( nO
)2( nO
Definitely we need something better
9
What can we do?
Give up on polynomial time algorithms?
Try Heuristics by giving up on optimality?
Try approximation algorithms?
10
Polynomial Algorithm for TSP?
What about the greedy strategy:
At any point, choose the closest vertex not explored
yet?
11
The Greedy Strategy Fails
5
0
3
1
12
10
2
12
The Greedy Strategy Fails
5
0
3
1
12
10
2
13
Another ExampleGreedy strategy fails
0 1-1 3 7-5-11
Even monkeys can do better than this !!!
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
TSP is NP-hard
Theorem: HAM-CYCLE p TSP.
Proof: By the straightforward efficient reduction illustrated below:
HAM-CYCLE TSP
1 cn1
1
1
n = k = |V|
verify!
cn
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
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
)(
)(
xOPT
xA c
For all inputs x.OPT(x) here denotes the optimal value of the minimization problem
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
)(
)(
xOPT
xA c
For all inputs x.OPT(x) here denotes the optimal value of the maximization problem
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
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
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
The Triangle Inequality
Definition: We’ll say the cost function c satisfies the triangle inequality, if
x,y,zV : c(x,z)+c(z,y)c(x,y)
x
yz
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
Demonstration and Analysis
The cost of a minimal
Hamiltonian cycle the cost of a
MST
25
Demonstration and Analysis
The cost of a preorder walk is twice the cost of
the tree
26
Demonstration and Analysis
Due to the triangle inequality, the
Hamiltonian cycle is not worse.
27
The Bottom Line
optimal HAM cycle
MSTpreorder
walk
our HAM cycle
= ½· ½·
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
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
Instances
min cost
|V| |V|
1
1
1
0+1
0
0
1
31
What Should an Algorithm for gap-TSP Return?
|V| |V|
YES! NO!
min cost
gap
DON’T-CARE...
32
gap-TSP & Approximation
Observation: Efficient approximation of factor for TSP implies an efficient algorithm for gap-TSP[].
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
The Reduction Illustrated
HAM-CYCLE gap-TSP
1 |V|+11
1
1
|V|+1
Verify (a) correctness (b)
efficiency
35
Approximating TSP is NP-hard
gap-TSP[] is NP-hard
Approximating TSP within factor is NP-hard
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
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.