# Approximation Algorithms for the Traveling Salesperson Problem.

## Presentation on theme: "Approximation Algorithms for the Traveling Salesperson Problem."— Presentation transcript:

Approximation Algorithms for the Traveling Salesperson Problem

Approximation Algorithm Up to now, the best algorithm for solving an NP-complete problem requires exponential time in the worst case. It is too time-consuming. To reduce the time required for solving a problem, we can relax the problem, and obtain a feasible solution “close” to an optimal solution

Approximation Algorithm

Error Ratio Bound

(1+  )-approximation algorithm

An approximation algorithm for Euclidean traveling salesperson problem (ETSP) The ETSP is to find a shortest closed path through a set S of n points in the plane. The ETSP is NP-hard.

Approximation Algorithm for ETSP Input: A set S of n points in the plane. Output:An approximate traveling salesperson tour of S. Step 1: Find a minimal spanning tree T of S. Step 2: Find a minimal Euclidean weighted matching M on the set of vertices of odd degrees in T. Let G=M ∪ T. Step 3: Find an Eulerian cycle of G and then traverse it to find a Hamiltonian cycle as an approximate tour of ETSP by bypassing all previously visited vertices.

Eulerian Cycle An Eulerian path (Eulerian trail, Euler walk) in a graph is a path that uses each edge precisely once. If such a path exists, the graph is called traversable. An Eulerian cycle (Eulerian circuit, Euler tour) in a graph is a cycle with uses each edge precisely once. If such a cycle exists, the graph is called Eulerian.

L. Euler showed that an Eulerian cycle exists if and only if all vertices in the graph are of even degree and all edges are contained in the same component. L. Euler also showed an Eulerian path exists, if and only if at most two vertices in the graph are of odd degree and all edges are contained in the same component.

Leonhard Euler (April 15, 1707 - September 18, 1783) (pronounced "oiler") was a Swiss mathematician and physicist. He is considered (together with Gauss) to be the greatest mathematician ever. Leonhard Euler stated and solved the problem of Seven Bridges of Königsberg in 1736, which is the first formally discussed problem in graph theory.

Eulerian Cycle exists because degree(V1) = 4 degree(V2) = 2 degree(V3) = 4 degree(V4) = 4.

This is the Eulerian Cycle.

A Hamiltonian path (also called traceable path) is a path that visits each vertex exactly once. A Hamiltonian cycle (also called Hamiltonian circuit, vertex tour or graph cycle) is a cycle that visits each vertex exactly once, except for the starting vertex.

Minimal Euclidean Weighted Matching Problem Given a set of points in the plane, the minimal Euclidean weighted matching problem is to join the points in pairs by line segments such that the total length is minimum.

Approximation Algorithm for ETSP E.g. Step1:

Approximation Algorithm for ETSP Step2:The number of points with odd degrees must be even., which is even One edge contributes 2 degrees

Approximation Algorithm for ETSP Step3: P3 and P4 are visited twice. By bypassing P3 and P4 and connecting P6 to P1 directly, we obtain a Hamiltonian cycle.

Approximation Algorithm for ETSP Time complexity: O(n 3 ) Step 1: O(nlogn) Step 2: O(n 3 ) Step 3: O(n) How close the approximate solution to an optimal solution?

How good is the solution ? The approximate tour is within 3/2 of the optimal one. Reasoning: L: optimal ETSP tour, T: MST, Lp: a path derived by removing one edge from L (Lp is also a spanning tree)  length(T)  length(Lp)  length(L) Let Lp=j 1 …i 1 j 2 …i 2 j 3 …i 2m, where {i 1, i 2,…, i 2m } is the set of odd-degree vertices in T where indices of vertices in the set are arranged in the same order as they are in the optimal ETSP tour L.

How good is the solution ? Let M be the minimal Euclidean weighted matching. Consider the two matchings: M 1 ={[i 1,i 2 ],[i 3,i 4 ],…,[i 2m-1,i 2m ]} and M 2 ={[i 2,i 3 ],[i 4,i 5 ],…,[i 2m,i 1 ]}. We have length(L)  length(M 1 ) + length(M 2 ) (triangular inequality)  2 length(M )  length(M)  1/2 length(L ) G = T ∪ M  length(T) + length(M)  length(L) + 1/2 length(L) = 3/2 length(L)

The Bottleneck Traveling Salesperson Problem (BTSP) Minimize the longest edge of a tour. This is a mini-max problem. This problem is NP-hard. The input data for this problem fulfill the following assumptions: –The graph is a complete graph. –All edges obey the triangular inequality rule.

An Algorithm for Finding an Optimal Solution Step1: Sort all edges in G = (V,E) into a nondecreasing sequence |e 1 |  |e 2 |  …  |e m |. Let G(e i ) denote the subgraph obtained from G by deleting all edges longer than e i. Step2: i ← 1 Step3: If there exists a Hamiltonian cycle in G(e i ), then this cycle is the solution; hence, stop. Step4: i ← i+1. Go to Step 3.

An Example for BTSP Algorithm e.g. There is a Hamiltonian cycle, A-B-D-C-E-F-G-A, in G(BD). The optimal solution is 13.

Time complexity of the algorithm The Hamiltonian cycle problem is NP-hard. The algorithm cannot be a polynomial one.

Theorem for Hamiltonian Cycles Def : The t-th power of G=(V,E), denoted as G t =(V,E t ), is a graph that an edge (u,v)  E t if there is a path from u to v with at most t edges in G. Theorem: If a graph G is bi-connected, then G 2 has a Hamiltonian cycle.

An Example for the Theorem A Hamiltonian cycle: A-B-C-D-E-F-G-A G2G2

An Approximation Algorithm for BTSP Input: A complete graph G=(V,E) where all edges satisfy triangular inequality. Output: A tour in G whose longest edge is not greater than twice of the value of an optimal solution to the special bottleneck traveling salesperson problem of G. Step 1: Sort the edges into |e 1 |  |e 2 |  …  |e m |. Step 2: i := 1. Step 3: If G(e i ) is bi-connected, construct G(e i ) 2, find a Hamiltonian cycle in G(e i ) 2 and return this as the output. Step 4: i := i + 1. Go to Step 3.

An Example Add some more edges. Then it becomes bi- connected.

A Hamiltonian cycle: A-G-F-E- D-C-B-A. The longest edge: 16

Time complexity The algorithm is of polynomial time The determination of bi-connectedness can be solved by polynomial algorithms. If G is bi-connected, then there exists a polynomial algorithm to solve the Hamiltonian cycle problem of G 2.

How Good is the Solution ? The value of an approximate solution is bounded by two times that of an optimal solution. Reasoning: A Hamiltonian cycle is bi-connected. e op : the longest edge of an optimal solution G(e i ): the first bi-connected graph |e i |  |e op | The length of the longest edge in G(e i ) 2  2|e i | (triangular inequality)  2|e op |

Similar presentations