CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a...
Transcript of CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a...
![Page 1: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/1.jpg)
CHAPTER 2 Greedy algorithms and Local search
![Page 2: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/2.jpg)
Introduction
• A greedy algorithm builds a solution step by step: Each time
going for the option that gives the most profit or smallest cost at
that step. It stops when a feasible solution is found.
• A local search algorithm starts with a feasible solution and
changes the solution step by step: Each time selecting an
improved solution in the neighborhood of the current solution.
It stops when no local improvement is possible.
![Page 3: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/3.jpg)
k-center
Instance: Set V of n points in a metric space. Integer k.
Solution: S ⊆ V with |S|=k
Cost: maxj∈ V dist(j,S) ( dist(j,S):= mins∈S dist(j,s) )
Goal: Find a solution of minimum cost.
k=3
![Page 4: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/4.jpg)
k-center
Instance: Set V of n points in a metric space. Integer k.
Solution: S ⊆ V with |S|=k
Cost: maxj∈ V dist(j,S) ( dist(j,S):= mins∈S dist(j,s) )
Goal: Find a solution of minimum cost.
k=3
![Page 5: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/5.jpg)
k-center
Instance: Set V of n points in a metric space. Integer k.
Solution: S ⊆ V with |S|=k
Cost: maxj∈ V dist(j,S) ( dist(j,S):= mins∈S dist(j,s) )
Goal: Find a solution of minimum cost.
k=3
j dist(j,S)
![Page 6: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/6.jpg)
k-center
Instance: Set V of n points in a metric space. Integer k.
Solution: S ⊆ V with |S|=k
Cost: maxj∈ V dist(j,S) ( dist(j,S):= mins∈S dist(j,s) )
Goal: Find a solution of minimum cost.
k=3
Connect each to its nearest center
![Page 7: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/7.jpg)
k-center
Greedy: Pick the first center arbitrarily. Next, always choose the point
that is furthest away from the set of centers already chosen.
k=3
![Page 8: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/8.jpg)
k-center
Greedy: Pick the first center arbitrarily. Next, always choose the point
that is furthest away from the set of centers already chosen.
k=3
![Page 9: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/9.jpg)
k-center
Greedy: Pick the first center arbitrarily. Next, always choose the point
that is furthest away from the set of centers already chosen.
k=3
![Page 10: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/10.jpg)
k-center
Theorem: Greedy is a 2-approximation algorithm.
Proof: Let S*, r* be, respectively, optimal solution and its value.
All points are within distance r* from S*
![Page 11: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/11.jpg)
k-center
Proof (cont.):
Take any v∈ V. There must be an s*∈ S* with dist(v,s*) ≤ r*.
If there is an s∈ S with dist(s,s*) ≤ r*. Then OK by triangle inequality.
What if no such s?
v
≤ r*
≤ r* s
s*
![Page 12: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/12.jpg)
k-center
Proof (cont.):
Another Greedy solution:
![Page 13: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/13.jpg)
k-center
Proof (cont.):
Another Greedy solution:
![Page 14: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/14.jpg)
k-center
Proof (cont.):
Another Greedy solution:
![Page 15: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/15.jpg)
k-center
Proof (cont.):
Can not use the same argument here.
There must be a center ji with at least 2
centers from S within radius r*.
No Greedy center in here.
v ji
![Page 16: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/16.jpg)
k-center
Proof (cont.):
Can not use the same argument here.
There must be a center ji with at least 2
centers from S within radius r*.
No Greedy center in here.
v ji
≤ 2r*
![Page 17: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/17.jpg)
k-center
Proof (cont.):
• j was picked after j’.
• j had maximum distance to the chosen centers when it was picked.
• Any point has distance ≤ 2r* to S.
v ji
≤ 2r* j’
j
![Page 18: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/18.jpg)
k-center
Theorem Greedy is not better than a 2-approximation.
Proof See example.
OPT
Possible Greedy solution
![Page 19: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/19.jpg)
k-center
Theorem There is no α-approximation algorithm for any α < 2, unless P=NP.
Proof By a reduction from the Dominating Set problem. (Next slides)
![Page 20: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/20.jpg)
1
Dominating Set
Similar to Vertex Cover. 3
4
2
1
5
2
5
Vertex Cover:
Any edge has an endpoint in I
Dominating Set:
Any vertex is in I or has a neighbour in I.
I={1,3,4}
I={3,5}
3
4
![Page 21: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/21.jpg)
Dominating Set
Fact: Dominating Set is NP-complete (Somebody once proved this).
Corollary: There is no α-approximation algorithm for any α < 2, unless P=NP.
Proof: Let G=(V,E) be an instance of DS. Is OPT≤ k? This can be answered if
we would have an α-approximation algorithm ALG for k-center with α < 2.
cij=1 cij=2
OPTDS≤ k
Dominating Set instance (DS) k-center instance (kc)
OPTkc=1 ALG≤ αOPTkc < 2 ALG=1
OPTDS> k OPTkc=2 ALG=2
![Page 22: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/22.jpg)
Traveling Salesman Problem
The current best known results for
the Mona Lisa TSP are:
Tour: 5,757,191
Lower Bound: 5,757,084
Gap: 107 (0.0019%)
$1,000 prize to the first person to
find a tour shorter than 5,757,191.
Source:
http://www.math.uwaterloo.ca/tsp/data/ml/monalisa.html
![Page 23: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/23.jpg)
Traveling Salesman Problem
![Page 24: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/24.jpg)
Traveling Salesman Problem
TSP Metric (Δ-inequality) Non-metric
Symmetric
Asymmetric
3 2
4
1 2
4
2
1 2
1
3
2
2
1 2
1
3
7
No α-approx.
Section 2.4
O(log n) -approx.
Exercise 1.3
No α-approx.
Section 2.4
A special case of Symmetric metric TSP is Euclidean TSP
(Pictures on previous slides)
1.5-approx.
Section 2.4
![Page 25: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/25.jpg)
Traveling Salesman Problem
Theorem For TSP without the triangle inequality assumption, there does
not exist an α-approximation algorithm for any α ≥ 1, provided P≠NP.
Proof (next slide) Follows from a reduction from Hamiltonian Cycle (HC).
We show that, if there exists an α-approximation algorithm ALG with α≥1,
then the HC problem can be solved in polynomial time.
![Page 26: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/26.jpg)
Traveling Salesman Problem
Fact The Hamiltonian Cycle problem is NP-complete
(Somebody once proved this)
Corrolary For TSP without the triangle inequality assumption, there does
not exist an α-approximation algorithm for any α ≥ 1, provided P≠NP.
G=(V,E), |V|=n TSP-instance.
HC? Yes.
cij=1
cij=K (large number)
OPTTSP=n ALG≤ αn
HC? No OPTTSP≥ K+n-1 ALG≥ K+n-1 Take K ≥ αn
ALG ≥ αn+1
![Page 27: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/27.jpg)
Traveling Salesman Problem
Three algorithms for metric symmetric TSP:
• Double tree
• Nearest addition
• Christofides’ algorithm
![Page 28: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/28.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 29: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/29.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 30: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/30.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 31: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/31.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 32: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/32.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 33: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/33.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 34: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/34.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 35: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/35.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 36: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/36.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 37: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/37.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 38: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/38.jpg)
k-center
Prim’s Minimum Spanning Tree (MST) algorithm:
Start with any point. Keep adding the point that is nearest to the already
chosen points.
![Page 39: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/39.jpg)
k-center
Algorithm Double Tree:
1. Find an MST
2. Double the edges
3. Find an Euler tour
4. Cut short
![Page 40: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/40.jpg)
k-center
Algorithm Double Tree:
1. Find an MST
2. Double the edges
3. Find an Euler tour
4. Cut short
![Page 41: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/41.jpg)
k-center
Algorithm Double Tree:
1. Find an MST
2. Double the edges
3. Find an Euler tour
4. Cut short
![Page 42: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/42.jpg)
Algorithm Double Tree:
1. Find an MST
2. Double the edges
3. Find an Euler tour
4. Cut short
k-center
Euler tour: 1,2,3,4,5,4,3,6,7,6,8,9,8,6,3,2,1
1 2
5
4
3
8
9
7
6
![Page 43: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/43.jpg)
Algorithm Double Tree:
1. Find an MST
2. Double the edges
3. Find an Euler tour
4. Cut short
k-center
TSP tour: 1,2,3,4,5, 4,3,6,7,6,8,9,8,6,3,2,1
1 2
5
4
3
8
9
7
6
![Page 44: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/44.jpg)
Theorem Double Tree is a 2-approximation algorithm
Proof [1] running time. OK
[2] Feasible OK
[3] Ratio:?
Cost of the Eulertour is 2cost(T) < 2OPT. Shortcutting does not increase
the length since triangle inequality holds.
k-center
Lemma
Let T be an MST and OPT the value of the smallest TSP tour.
Then cost(T) < OPT.
Proof Take an optimal TSP tour and remove one edge. This
gives a spanning tree. The cost of this tree is no more than
cost(T).
![Page 45: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/45.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 46: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/46.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 47: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/47.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 48: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/48.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 49: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/49.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 50: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/50.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 51: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/51.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 52: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/52.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 53: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/53.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 54: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/54.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 55: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/55.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 56: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/56.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 57: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/57.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 58: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/58.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 59: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/59.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 60: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/60.jpg)
k-center
Nearest addition:
1. Start with a tour on 2 points
2. Keep adding the nearest point.
![Page 61: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/61.jpg)
Theorem Nearest Addition is a 2-approximation algorithm
Proof [1] running time. OK
[2] Feasible OK
[3] Ratio:
The algorithm behaves exactly like Prim’s MST algorithm:
The edges defining the minimum distance, together form an MST.
k-center
i
j
k
![Page 62: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/62.jpg)
Theorem Nearest Addition is a 2-approximation algorithm
Proof [1] running time. OK
[2] Feasible OK
[3] Ratio:
By triangle inequality: cjk ≤ cji + cik cjk – cik ≤ cji
Cost in this step: cij + cjk – cik ≤ 2cij. Total cost ≤ 2cost(MST) ≤ 2OPT.
k-center
i
j
k
![Page 63: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/63.jpg)
k-center
Christofides’ Algorithm
1. Find a minimum spanning tree T
2. Find a minimum matching M for the odd-degree vertices in T
3. Add M to T
4. Find an Euler tour
5. Cut short
![Page 64: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/64.jpg)
k-center
Christofides’ Algorithm
1. Find a minimum spanning tree T
2. Find a minimum matching M for the odd-degree vertices in T
3. Add M to T
4. Find an Euler tour
5. Cut short
![Page 65: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/65.jpg)
k-center
Christofides’ Algorithm
1. Find a minimum spanning tree T
2. Find a minimum matching M for the odd-degree vertices in T
3. Add M to T
4. Find an Euler tour
5. Cut short
![Page 66: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/66.jpg)
k-center
Christofides’ Algorithm
1. Find a minimum spanning tree T
2. Find a minimum matching M for the odd-degree vertices in T
3. Add M to T
4. Find an Euler tour
5. Cut short
![Page 67: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/67.jpg)
k-center
Christofides’ Algorithm
1. Find a minimum spanning tree T
2. Find a minimum matching M for the odd-degree vertices in T
3. Add M to T
4. Find an Euler tour
5. Cut short
1 2
5
4
3
8
9
7
6
Euler tour: 1,2,3,4,5,3,6,7,6,8,9,1
![Page 68: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/68.jpg)
k-center
Christofides’ Algorithm
1. Find a minimum spanning tree T
2. Find a minimum matching M for the odd-degree vertices in T
3. Add M to T
4. Find an Euler tour
5. Cut short
1 2
5
4
3
8
9
7
6
Short cut: 1,2,3,4,5,3,6,7,6,8,9,1
![Page 69: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/69.jpg)
k-center
Theorem
Christofides’ Algorithm is a 1.5-approximation algorithm
Proof
[1] Time? MST and Matching can be found in polynomial time.
[2] Feasible. OK
[3] Cost of TSP is at most the cost of the Euler tour.
Cost of Euler tour is cost(T)+cost(M)
Know: cost(T) < OPT.
Claim: cost(M) ≤ OPT/2.
![Page 70: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/70.jpg)
k-center
Theorem
Christofides’ Algorithm is a 1.5-approximation algorithm
Proof
Claim: cost(M) ≤ OPT/2.
OPT
![Page 71: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/71.jpg)
k-center
Theorem
Christofides’ Algorithm is a 1.5-approximation algorithm
Proof
Claim: cost(M) ≤ OPT/2.
≤ OPT
![Page 72: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/72.jpg)
k-center
Theorem
Christofides’ Algorithm is a 1.5-approximation algorithm
Proof
Claim: cost(M) ≤ OPT/2.
Two matchings.
Both have cost ≥ cost(M)
OPT ≥ 2cost(M)
![Page 73: CHAPTER 2CHAPTER 2 Greedy algorithms and Local search Introduction •A greedy algorithm builds a solution step by step: Each time going for the option that gives the most profit or](https://reader033.fdocuments.us/reader033/viewer/2022051809/600f3a8e5d15eb18ce0f04a2/html5/thumbnails/73.jpg)