VI. Approximation Algorithms: Travelling Salesman Problem Thomas Sauerwald Easter 2016 Outline Introduction General TSP Metric TSP VI. Travelling Salesman Problem Introduction 2 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. Formal Definition VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E Goal: Find a hamiltonian cycle of G with minimum cost. VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. 3 1 2 Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E 4 1 Goal: Find a hamiltonian cycle of G with minimum cost. 3 VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. 3 1 2 Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E 4 1 Goal: Find a hamiltonian cycle of G with minimum cost. 3 3+2+1+3=9 VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. 3 1 2 Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E 4 1 Goal: Find a hamiltonian cycle of G with minimum cost. 3 2+4+1+1=8 VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. 3 1 2 Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E 4 1 Goal: Find a hamiltonian cycle of G with minimum cost. Solution space consists of at most n! possible tours! 3 2+4+1+1=8 VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. 3 1 2 Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E 4 1 Goal: Find a hamiltonian cycle of G with minimum cost. Solution space consists of at most n! possible tours! Actually the right number is (n − 1)!/2 VI. Travelling Salesman Problem Introduction 3 2+4+1+1=8 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. 3 1 2 Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E 4 1 Goal: Find a hamiltonian cycle of G with minimum cost. Solution space consists of at most n! possible tours! Actually the right number is (n − 1)!/2 3 2+4+1+1=8 Special Instances VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. 3 1 2 Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E 4 1 Goal: Find a hamiltonian cycle of G with minimum cost. Solution space consists of at most n! possible tours! Actually the right number is (n − 1)!/2 3 2+4+1+1=8 Special Instances Metric TSP: costs satisfy triangle inequality: ∀u, v , w ∈ V : VI. Travelling Salesman Problem c(u, w) ≤ c(u, v ) + c(v , w). Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. 3 1 2 Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E 4 1 Goal: Find a hamiltonian cycle of G with minimum cost. 3 Solution space consists of at most n! possible tours! Actually the right number is (n − 1)!/2 2+4+1+1=8 Special Instances Metric TSP: costs satisfy triangle inequality: ∀u, v , w ∈ V : c(u, w) ≤ c(u, v ) + c(v , w). Euclidean TSP: cities are points in the Euclidean space, costs are equal to their (rounded) Euclidean distance VI. Travelling Salesman Problem Introduction 3 The Traveling Salesman Problem (TSP) Given a set of cities along with the cost of travel between them, find the cheapest route visiting all cities and returning to your starting point. 3 1 2 Formal Definition Given: A complete undirected graph G = (V , E) with nonnegative integer cost c(u, v ) for each edge (u, v ) ∈ E 4 1 Goal: Find a hamiltonian cycle of G with minimum cost. 3 Solution space consists of at most n! possible tours! Actually the right number is (n − 1)!/2 Special Instances Metric TSP: costs satisfy triangle inequality: ∀u, v , w ∈ V : 2+4+1+1=8 Even this version is NP hard (Ex. 35.2-2) c(u, w) ≤ c(u, v ) + c(v , w). Euclidean TSP: cities are points in the Euclidean space, costs are equal to their (rounded) Euclidean distance VI. Travelling Salesman Problem Introduction 3 History of the TSP problem (1954) Dantzig, Fulkerson and Johnson found an optimal tour through 42 cities. http://www.math.uwaterloo.ca/tsp/history/img/dantzig_big.html VI. Travelling Salesman Problem Introduction 4 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) VI. Travelling Salesman Problem Introduction 5 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) 2. Solve the linear program. If the solution is integral and forms a tour, stop. Otherwise find a new constraint to add (cutting plane) VI. Travelling Salesman Problem Introduction 5 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) 2. Solve the linear program. If the solution is integral and forms a tour, stop. Otherwise find a new constraint to add (cutting plane) x2 2x1 − 9x2 ≤ −27 5 4 max 13 x + y 3 2 1 0 1 2 3 VI. Travelling Salesman Problem 4 5 6 7 4x1 + 9x2 ≤ 36 x1 8 9 Introduction 5 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) 2. Solve the linear program. If the solution is integral and forms a tour, stop. Otherwise find a new constraint to add (cutting plane) x2 2x1 − 9x2 ≤ −27 5 4 max 13 x + y 3 2 1 0 1 2 3 VI. Travelling Salesman Problem 4 5 6 7 4x1 + 9x2 ≤ 36 x1 8 9 Introduction 5 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) 2. Solve the linear program. If the solution is integral and forms a tour, stop. Otherwise find a new constraint to add (cutting plane) x2 (3.3, 1.5) 2x1 − 9x2 ≤ −27 5 4 max 13 x + y 3 2 1 0 1 2 3 VI. Travelling Salesman Problem 4 5 6 7 4x1 + 9x2 ≤ 36 x1 8 9 Introduction 5 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) 2. Solve the linear program. If the solution is integral and forms a tour, stop. Otherwise find a new constraint to add (cutting plane) x2 (3.3, 1.5) 2x1 − 9x2 ≤ −27 5 4 Additional constraint to cut the solution space of the LP max 13 x + y x2 ≤ 3 3 2 1 0 1 2 3 VI. Travelling Salesman Problem 4 5 6 7 4x1 + 9x2 ≤ 36 x1 8 9 Introduction 5 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) 2. Solve the linear program. If the solution is integral and forms a tour, stop. Otherwise find a new constraint to add (cutting plane) x2 (3.3, 1.5) 2x1 − 9x2 ≤ −27 5 4 Additional constraint to cut the solution space of the LP max 13 x + y x2 ≤ 3 3 2 1 0 1 2 3 VI. Travelling Salesman Problem 4 5 6 7 4x1 + 9x2 ≤ 36 x1 8 9 Introduction 5 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) 2. Solve the linear program. If the solution is integral and forms a tour, stop. Otherwise find a new constraint to add (cutting plane) x2 (2.25, 3) 5 4 2x1 − 9x2 ≤ −27 Additional constraint to cut the solution space of the LP max 13 x + y x2 ≤ 3 3 2 1 0 1 2 3 VI. Travelling Salesman Problem 4 5 6 7 4x1 + 9x2 ≤ 36 x1 8 9 Introduction 5 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) 2. Solve the linear program. If the solution is integral and forms a tour, stop. Otherwise find a new constraint to add (cutting plane) x2 (2.25, 3) 5 4 2x1 − 9x2 ≤ −27 Additional constraint to cut the solution space of the LP max 13 x + y x2 ≤ 3 3 2 1 (2, 3) 0 1 2 3 VI. Travelling Salesman Problem 4 5 6 7 4x1 + 9x2 ≤ 36 x1 8 9 Introduction 5 The Dantzig-Fulkerson-Johnson Method 1. Create a linear program (variable x(u, v ) = 1 iff tour goes between u and v ) 2. Solve the linear program. If the solution is integral and forms a tour, stop. Otherwise find a new constraint to add (cutting plane) x2 2x1 − 9x2 ≤ −27 5 4 Additional constraint to cut the solution space of the LP max 13 x + y x2 ≤ 3 3 2 1 (2, 3) 0 1 2 3 4 5 6 7 4x1 + 9x2 ≤ 36 x1 8 9 More cuts are needed to find integral solution VI. Travelling Salesman Problem Introduction 5 Outline Introduction General TSP Metric TSP VI. Travelling Salesman Problem General TSP 6 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. VI. Travelling Salesman Problem General TSP 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: VI. Travelling Salesman Problem General TSP 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. VI. Travelling Salesman Problem General TSP 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem VI. Travelling Salesman Problem General TSP 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem G = (V , E) VI. Travelling Salesman Problem General TSP 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : G = (V , E) VI. Travelling Salesman Problem General TSP 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : G0 = (V , E 0 ) G = (V , E) VI. Travelling Salesman Problem General TSP 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. G0 = (V , E 0 ) G = (V , E) VI. Travelling Salesman Problem General TSP 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. 1 1 G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = Large weight will render ρ|V | + 1 otherwise. this edge useless! 1 1 G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( Can create representations of G0 and 1 if (u, v ) ∈ E, c in time polynomial in |V | and |E|! c(u, v ) = ρ|V | + 1 otherwise. 1 1 G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. 1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | 1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | 1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | 1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | 1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, 1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, 1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, ρ·4+1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, ρ·4+1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, ρ·4+1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, ρ·4+1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, ⇒ c(T ) ≥ (ρ|V | + 1) + (|V | − 1) ρ·4+1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, ⇒ c(T ) ≥ (ρ|V | + 1) + (|V | − 1) = (ρ + 1)|V |. ρ·4+1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, ⇒ c(T ) ≥ (ρ|V | + 1) + (|V | − 1) = (ρ + 1)|V |. Gap of ρ + 1 between tours which are using only edges in G and those which don’t ρ·4+1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, ⇒ c(T ) ≥ (ρ|V | + 1) + (|V | − 1) = (ρ + 1)|V |. Gap of ρ + 1 between tours which are using only edges in G and those which don’t ρ-Approximation of TSP in G0 computes hamiltonian cycle in G (if one exists) ρ·4+1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Hardness of Approximation Theorem 35.3 If P 6= NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general TSP. Proof: Idea: Reduction from the hamiltonian-cycle problem. Let G = (V , E) be an instance of the hamiltonian-cycle problem Let G0 = (V , E 0 ) be a complete graph with costs for each (u, v ) ∈ E 0 : ( 1 if (u, v ) ∈ E, c(u, v ) = ρ|V | + 1 otherwise. If G has a hamiltonian cycle H, then (G0 , c) contains a tour of cost |V | If G does not have a hamiltonian cycle, then any tour T must use some edge 6∈ E, ⇒ c(T ) ≥ (ρ|V | + 1) + (|V | − 1) = (ρ + 1)|V |. Gap of ρ + 1 between tours which are using only edges in G and those which don’t ρ-Approximation of TSP in G0 computes hamiltonian cycle in G (if one exists) ρ·4+1 1 Reduction G = (V , E) ρ·4+1 VI. Travelling Salesman Problem 1 G0 = (V , E 0 ) 1 General TSP 1 7 Proof of Theorem 35.3 from a higher perspective instances of Hamilton VI. Travelling Salesman Problem instances of TSP General TSP 8 Proof of Theorem 35.3 from a higher perspective All instances with a hamiltonian cycle instances of Hamilton VI. Travelling Salesman Problem instances of TSP General TSP 8 Proof of Theorem 35.3 from a higher perspective All instances with a hamiltonian cycle All instances with cost ≤ k instances of Hamilton VI. Travelling Salesman Problem instances of TSP General TSP 8 Proof of Theorem 35.3 from a higher perspective All instances with a hamiltonian cycle All instances with cost ≤ k All instances with cost >ρ · k instances of Hamilton VI. Travelling Salesman Problem instances of TSP General TSP 8 Proof of Theorem 35.3 from a higher perspective All instances with a hamiltonian cycle All instances with cost ≤ k x y All instances with cost >ρ · k instances of Hamilton VI. Travelling Salesman Problem instances of TSP General TSP 8 Proof of Theorem 35.3 from a higher perspective All instances with a hamiltonian cycle All instances with cost ≤ k x y f f (x) f f (y ) All instances with cost >ρ · k instances of Hamilton VI. Travelling Salesman Problem instances of TSP General TSP 8 Proof of Theorem 35.3 from a higher perspective General Method to prove inapproximability results! All instances with a hamiltonian cycle All instances with cost ≤ k x y f f (x) f f (y ) All instances with cost >ρ · k instances of Hamilton VI. Travelling Salesman Problem instances of TSP General TSP 8 Outline Introduction General TSP Metric TSP VI. Travelling Salesman Problem Metric TSP 9 Metric TSP (TSP Problem with the Triangle Inequality) Idea: First compute an MST, and then create a tour based on the tree. VI. Travelling Salesman Problem Metric TSP 10 constant approximation ratio does not exist unless P D NP. Metric TSP (TSP Problem with the Triangle Inequality) 35.2.1 The traveling-salesman problem with the triangle inequality Applying the methodology of the previous section, we shall first compute a structure—a minimum spanning tree—whose weight gives a lower bound on the length of an optimal traveling-salesman tour. We shall then use the minimum spanning tree to create a tour whose cost is no more than twice that of the minimum spanning tree’s weight, as long as the cost function satisfies the triangle inequality. The following algorithm implementsan thisMST, approach, the minimum-spanning-tree Idea: First compute and calling then create a tour based on the tree. algorithm MST-P RIM from Section 23.2 as a subroutine. The parameter G is a complete undirected graph, and the cost function c satisfies the triangle inequality. A PPROX -TSP-T OUR .G; c/ 1 select a vertex r 2 G:V to be a “root” vertex 2 compute a minimum spanning tree T for G from root r using MST-P RIM.G; c; r/ 3 let H be a list of vertices, ordered according to when they are first visited in a preorder tree walk of T 4 return the hamiltonian cycle H VI. Travelling Salesman Problem Metric TSP 10 constant approximation ratio does not exist unless P D NP. Metric TSP (TSP Problem with the Triangle Inequality) 35.2.1 The traveling-salesman problem with the triangle inequality Applying the methodology of the previous section, we shall first compute a structure—a minimum spanning tree—whose weight gives a lower bound on the length of an optimal traveling-salesman tour. We shall then use the minimum spanning tree to create a tour whose cost is no more than twice that of the minimum spanning tree’s weight, as long as the cost function satisfies the triangle inequality. The following algorithm implementsan thisMST, approach, the minimum-spanning-tree Idea: First compute and calling then create a tour based on the tree. algorithm MST-P RIM from Section 23.2 as a subroutine. The parameter G is a complete undirected graph, and the cost function c satisfies the triangle inequality. A PPROX -TSP-T OUR .G; c/ 1 select a vertex r 2 G:V to be a “root” vertex 2 compute a minimum spanning tree T for G from root r using MST-P RIM.G; c; r/ 3 let H be a list of vertices, ordered according to when they are first visited in a preorder tree walk of T 4 return the hamiltonian cycle H Runtime is dominated by MST-P RIM, which is Θ(V 2 ). VI. Travelling Salesman Problem Metric TSP 10 constant approximation ratio does not exist unless P D NP. Metric TSP (TSP Problem with the Triangle Inequality) 35.2.1 The traveling-salesman problem with the triangle inequality Applying the methodology of the previous section, we shall first compute a structure—a minimum spanning tree—whose weight gives a lower bound on the length of an optimal traveling-salesman tour. We shall then use the minimum spanning tree to create a tour whose cost is no more than twice that of the minimum spanning tree’s weight, as long as the cost function satisfies the triangle inequality. The following algorithm implementsan thisMST, approach, the minimum-spanning-tree Idea: First compute and calling then create a tour based on the tree. algorithm MST-P RIM from Section 23.2 as a subroutine. The parameter G is a complete undirected graph, and the cost function c satisfies the triangle inequality. A PPROX -TSP-T OUR .G; c/ 1 select a vertex r 2 G:V to be a “root” vertex 2 compute a minimum spanning tree T for G from root r using MST-P RIM.G; c; r/ 3 let H be a list of vertices, ordered according to when they are first visited in a preorder tree walk of T 4 return the hamiltonian cycle H Runtime is dominated by MST-P RIM, which is Θ(V 2 ). Remember: In the Metric-TSP problem, G is a complete graph. VI. Travelling Salesman Problem Metric TSP 10 Run of A PPROX -T SP -TOUR a d e b g f c h VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk X VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR Solution has cost ≈ 19.704 - not optimal! a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk X VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk X VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR Better solution, yet still not optimal! a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk X VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk X VI. Travelling Salesman Problem Metric TSP 11 Run of A PPROX -T SP -TOUR This is the optimal solution (cost ≈ 14.715). a d e b g f c h 1. Compute MST X 2. Perform preorder walk on MST X 3. Return list of vertices according to the preorder tree walk X VI. Travelling Salesman Problem Metric TSP 11 Approximate Solution: Objective 921 14 14 15 1 13 15 13 12 2 12 1 1 2 16 1 10 1 16 11 1 1 1 18 17 1 18 23 24 23 24 9 1 3 9 3 8 1 25 1 1 4 1 4 8 25 1 1 22 22 7 40 1 7 27 26 27 1 1 40 5 1 6 26 1 39 5 39 6 1 19 38 1 38 21 19 21 1 20 1 1 1 1 42 41 11 1 17 42 1 11 11 41 10 28 31 28 30 20 1 1 1 30 1 29 29 37 31 34 34 35 1 37 1 35 1 1 32 32 36 1 33 36 1 33 VI. Travelling Salesman Problem Metric TSP 12 Optimal Solution: Objective 699 14 14 15 1 1 13 15 13 12 1 2 12 1 2 16 1 10 11 1 1 11 1 9 1 3 18 1 18 23 17 23 24 1 18 25 1 22 1 1 1 22 7 1 1 1 40 1 7 27 26 27 4 4 8 25 1 24 40 5 1 6 26 391 5 1 6 39 1 1 38 1 19 21 19 21 1 20 1 41 3 9 17 42 11 411 42 1 10 1 16 38 28 31 28 30 20 37 31 1 30 1 29 29 1 34 1 34 32 1 1 37 35 35 1 1 32 1 1 36 36 33 33 VI. Travelling Salesman Problem Metric TSP 13 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: a d b f e g c h solution H of A PPROX -T SP VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: a d a d b f e b f e g c g c h h optimal solution H ∗ solution H of A PPROX -T SP VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge a d a d b f e b f e g c g c h h optimal solution H ∗ solution H of A PPROX -T SP VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge a d a d b f e b f e g c g c h solution H of A PPROX -T SP VI. Travelling Salesman Problem h spanning tree T as a subset of H ∗ Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h ⇒ yields a spanning tree T and h therefore a d a d b f e b f e g c g c h solution H of A PPROX -T SP VI. Travelling Salesman Problem h spanning tree T as a subset of H ∗ Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore a d a d b f e b f e g c g c h solution H of A PPROX -T SP VI. Travelling Salesman Problem h spanning tree T as a subset of H ∗ Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore exploiting that all edge costs are non-negative! a d a d b f e b f e g c g c h solution H of A PPROX -T SP VI. Travelling Salesman Problem h spanning tree T as a subset of H ∗ Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) a d a d b f e b f e g c g c h h optimal solution H ∗ solution H of A PPROX -T SP VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) a d a d b f e b f e g c g c h h optimal solution H ∗ minimum spanning tree Tmin VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) a d a d b f e b f e g c g c h h Walk W = (a, b, c, b, h, b, a, d, e, f , e, g, e, d, a) VI. Travelling Salesman Problem Metric TSP optimal solution H ∗ 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so a d a d b f e b f e g c g c h h Walk W = (a, b, c, b, h, b, a, d, e, f , e, g, e, d, a) VI. Travelling Salesman Problem Metric TSP optimal solution H ∗ 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so c(W ) = 2c(Tmin ) a d a d b f e b f e g c g c h h Walk W = (a, b, c, b, h, b, a, d, e, f , e, g, e, d, a) VI. Travelling Salesman Problem Metric TSP optimal solution H ∗ 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) a d a d b f e b f e g c g c h h Walk W = (a, b, c, b, h, b, a, d, e, f , e, g, e, d, a) VI. Travelling Salesman Problem Metric TSP optimal solution H ∗ 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) Deleting duplicate vertices from W yields a tour H a d a d b f e b f e g c g c h h Walk W = (a, b, c, b, h, b, a, d, e, f , e, g, e, d, a) VI. Travelling Salesman Problem Metric TSP optimal solution H ∗ 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) Deleting duplicate vertices from W yields a tour H a d a d b f e b f e g c g c h h Walk W = (a, b, c, b, h, b, a, d, e, f , e, g, e, d, a) VI. Travelling Salesman Problem Metric TSP optimal solution H ∗ 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) Deleting duplicate vertices from W yields a tour H a d a d b f e b f e g c g c h h Walk W = (a, b, c, b, h, b, a, d, e, f , e, g, e, d, a) VI. Travelling Salesman Problem Metric TSP optimal solution H ∗ 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) Deleting duplicate vertices from W yields a tour H a d a d b f e b f e g c g c h h optimal solution H ∗ Tour H = (a, b, c, h, d, e, f , g, a) VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so exploiting triangle inequality! c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) Deleting duplicate vertices from W yields a tour H with smaller cost: a d a d b f e b f e g c g c h h optimal solution H ∗ Tour H = (a, b, c, h, d, e, f , g, a) VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so exploiting triangle inequality! c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) Deleting duplicate vertices from W yields a tour H with smaller cost: c(H) ≤ c(W ) a d a d b f e b f e g c g c h h optimal solution H ∗ Tour H = (a, b, c, h, d, e, f , g, a) VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so exploiting triangle inequality! c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) Deleting duplicate vertices from W yields a tour H with smaller cost: c(H) ≤ c(W ) ≤ 2c(H ∗ ) a d a d b f e b f e g c g c h h optimal solution H ∗ Tour H = (a, b, c, h, d, e, f , g, a) VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so exploiting triangle inequality! c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) Deleting duplicate vertices from W yields a tour H with smaller cost: c(H) ≤ c(W ) ≤ 2c(H ∗ ) a d a d b f e b f e g c g c h h optimal solution H ∗ Tour H = (a, b, c, h, d, e, f , g, a) VI. Travelling Salesman Problem Metric TSP 12 Proof of the Approximation Ratio Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Proof: Consider the optimal tour H ∗ and remove an arbitrary edge ( h (( h ( h c(T ) ≤ c(H ∗ ) ⇒ yields a spanning tree T and h therefore Let W be the full walk of the minimum spanning tree Tmin (including repeated visits) ⇒ Full walk traverses every edge exactly twice, so exploiting triangle inequality! c(W ) = 2c(Tmin ) ≤ 2c(T ) ≤ 2c(H ∗ ) Deleting duplicate vertices from W yields a tour H with smaller cost: c(H) ≤ c(W ) ≤ 2c(H ∗ ) a d a d b f e b f e g c g c h h optimal solution H ∗ Tour H = (a, b, c, h, d, e, f , g, a) VI. Travelling Salesman Problem Metric TSP 12 Christofides Algorithm Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. VI. Travelling Salesman Problem Metric TSP 13 Christofides Algorithm Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Can we get a better approximation ratio? VI. Travelling Salesman Problem Metric TSP 13 Christofides Algorithm Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Can we get a better approximation ratio? 1: 2: 3: 4: 5: 6: 7: 8: C HRISTOFIDES(G, c) select a vertex r ∈ G.V to be a “root” vertex compute a minimum spanning tree T for G from root r using MST-PRIM(G, c, r ) compute a perfect matching M with minimum weight in the complete graph over the odd-degree vertices in T let H be a list of vertices, ordered according to when they are first visited in a Eulearian circuit of T ∪ M return H VI. Travelling Salesman Problem Metric TSP 13 Christofides Algorithm Theorem 35.2 A PPROX -T SP -TOUR is a polynomial-time 2-approximation for the traveling-salesman problem with the triangle inequality. Can we get a better approximation ratio? 1: 2: 3: 4: 5: 6: 7: 8: C HRISTOFIDES(G, c) select a vertex r ∈ G.V to be a “root” vertex compute a minimum spanning tree T for G from root r using MST-PRIM(G, c, r ) compute a perfect matching M with minimum weight in the complete graph over the odd-degree vertices in T let H be a list of vertices, ordered according to when they are first visited in a Eulearian circuit of T ∪ M return H Theorem (Christofides’76) There is a polynomial-time 32 -approximation algorithm for the travelling salesman problem with the triangle inequality. VI. Travelling Salesman Problem Metric TSP 13 Run of C HRISTOFIDES a d e b f g c h VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit All vertices in T ∪ M have even degree! VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X All vertices in T ∪ M have even degree! VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle X VI. Travelling Salesman Problem Metric TSP 14 Run of C HRISTOFIDES Solution has cost ≈ 15.54 - within 10% of the optimum! a d e b f g c h 1. Compute MST X 2. Add a minimum-weight perfect matching M of the odd vertices in T X 3. Find an Eulerian Circuit X 4. Transform the Circuit into a Hamiltonian Cycle X VI. Travelling Salesman Problem Metric TSP 14 Concluding Remarks Theorem (Christofides’76) There is a polynomial-time 32 -approximation algorithm for the travelling salesman problem with the triangle inequality. VI. Travelling Salesman Problem Metric TSP 15 Concluding Remarks Theorem (Christofides’76) There is a polynomial-time 32 -approximation algorithm for the travelling salesman problem with the triangle inequality. Theorem (Arora’96, Mitchell’96) There is a PTAS for the Euclidean TSP Problem. VI. Travelling Salesman Problem Metric TSP 15 Concluding Remarks Theorem (Christofides’76) There is a polynomial-time 32 -approximation algorithm for the travelling salesman problem with the triangle inequality. Both received the Gödel Award 2010 Theorem (Arora’96, Mitchell’96) There is a PTAS for the Euclidean TSP Problem. VI. Travelling Salesman Problem Metric TSP 15 Concluding Remarks Theorem (Christofides’76) There is a polynomial-time 32 -approximation algorithm for the travelling salesman problem with the triangle inequality. Both received the Gödel Award 2010 Theorem (Arora’96, Mitchell’96) There is a PTAS for the Euclidean TSP Problem. “Christos Papadimitriou told me that the traveling salesman problem is not a problem. It’s an addiction.” Jon Bentley 1991 VI. Travelling Salesman Problem Metric TSP 15 Concluding Remarks Theorem (Christofides’76) There is a polynomial-time 32 -approximation algorithm for the travelling salesman problem with the triangle inequality. Both received the Gödel Award 2010 Theorem (Arora’96, Mitchell’96) There is a PTAS for the Euclidean TSP Problem. “Christos Papadimitriou told me that the traveling salesman problem is not a problem. It’s an addiction.” Jon Bentley 1991 VI. Travelling Salesman Problem Metric TSP 15
© Copyright 2026 Paperzz