15-3 Bitonic euclidean

In the euclidean traveling-salesman problem, we are given a set of nn points in the plane, and we wish to find the shortest closed tour that connects all n points. Figure 15.11(a) shows the solution to a 77-point problem. The general problem is NP-hard, and its solution is therefore believed to require more than polynomial time (see Chapter 34).

J. L. Bentley has suggested that we simplify the problem by restricting our attention to bitonic tours, that is, tours that start at the leftmost point, go strictly rightward to the rightmost point, and then go strictly leftward back to the starting point. Figure 15.11(b) shows the shortest bitonic tour of the same 77 points. In this case, a polynomial-time algorithm is possible.

Describe an O(n2)O(n^2)-time algorithm for determining an optimal bitonic tour. You may assume that no two points have the same xx-coordinate and that all operations on real numbers take unit time. (Hint:\textit{Hint:} Scan left to right, maintaining optimal possibilities for the two parts of the tour.)

First sort all the points based on their xx coordinate. To index our subproblem, we will give the rightmost point for both the path going to the left and the path going to the right. Then, we have that the desired result will be the subproblem indexed by vv, where vv is the rightmost point.

Suppose by symmetry that we are further along on the left-going path, that the leftmost path is going to the iith one and the right going path is going until the jjth one. Then, if we have that i>j+1i > j + 1, then we have that the cost must be the distance from the i1i − 1st point to the ith plus the solution to the subproblem obtained where we replace ii with i1i − 1. There can be at most O(n2)O(n^2) of these subproblem, but solving them only requires considering a constant number of cases. The other possibility for a subproblem is that jij+1j \le i \le j + 1. In this case, we consider for every kk from 11 to jj the subproblem where we replace ii with kk plus the cost from kkth point to the iith point and take the minimum over all of them. This case requires considering O(n)O(n) things, but there are only O(n)O(n) such cases. So, the final runtime is O(n2)O(n^2).