An Analysis of Several Heuristics for the Traveling Salesman Problem I: Nearest Neighbor Tours Can Be Far from OptimalResearch Paper
Motivation
The traveling salesman problem with the triangle inequality asks for a shortest closed tour through points whose distances form a metric. It is NP-hard, so in practice tours are built by fast construction heuristics, and the natural question is how far such a tour can be from optimal in the worst case. Rosenkrantz, Stearns and Lewis (SIAM J. Comput. 6(3), 1977) gave the first systematic worst-case analysis of the standard heuristics. Their results are reproduced in textbooks on approximation algorithms and combinatorial optimization, and they are the reference point against which later guarantees (Christofides' algorithm, the double-tree -approximation) are compared.
The simplest heuristic studied is the nearest neighbor algorithm (Bellmore and Nemhauser, 1968; the "next best method" of Gavett, 1965): from the current node, always move to the closest node not yet visited, and return to the start at the end. The paper shows that this greedy rule is never worse than logarithmic (Theorem 1) and that the logarithm cannot be removed (Theorem 2). This mission is about Theorem 2, the lower bound.
Setting
A traveling salesman graph on nodes is a complete graph with a distance that is symmetric, , nonnegative, , and satisfies the triangle inequality . A tour lists the nodes in a visiting order and returns to ; its length is the sum of the distances along it. OPTIMAL is the least length of a tour.
The nearest neighbor algorithm starts at an arbitrary node ; having reached , it moves to a node that minimizes over the nodes not yet visited, breaking ties arbitrarily; after the last node it returns to . The length of the resulting tour is written NEARNEIBER. Because the start node and the ties are free, one instance has in general several nearest-neighbor tours. A lower bound needs only one of them; an upper bound must hold for all.
The instances of the proof are built from a recursive family of weighted graphs. With (so ), the graph is a triangle with unit weights, and consists of two copies of joined through one new node by two edges of length and two edges of length . Each has nodes and a path from its start node to its middle node through every node, of length with , . The graph adds two closing edges to , and is the complete graph on the same nodes whose distance is the shortest-path distance of .
Formalization targets
Goal: Theorem 2 (p. 566)
For each there is a traveling salesman graph with nodes and a nearest-neighbor tour on it such that
The statement is existential in both the instance and the run of the algorithm, exactly as in the paper.
Milestones, in the order the proof uses them
- (2.12): the difference equation , , has the solution .
- is a traveling salesman graph: the shortest-path distance of is symmetric, nonnegative and satisfies the triangle inequality.
- (2.13)–(2.17): the shortest-path distances in between the seven named nodes of Fig. 1, e.g. .
- Property a): every edge of is a shortest path between its endpoints.
- Property b): the nearest neighbor algorithm started at the start node of can follow and return along the edge of length .
- The optimal tour: .
- The exact ratio: the tour along has length , so its ratio is .
- The inequality: for .
The instance for is .
Significance
Theorem 1 of the same paper shows for every nearest-neighbor tour on every traveling salesman graph. Theorem 2 shows that this bound has the right order: no constant-factor guarantee holds for the nearest neighbor rule, and the gap between the two constants ( against ) is all that remains. This separates the nearest neighbor rule from the insertion rules analysed later in the same paper, of which nearest and cheapest insertion are within a factor of optimal. It is the standard example of a natural greedy heuristic whose approximation ratio grows with .
The upper bound, Theorem 1, is already on Prove2Me with a machine-checked proof (SupplyChainTheory.nearest_neighbor_bound); its statement notes that the lower-bound instances are not formalized there. This mission supplies them: an explicit recursive family of metric instances, the shortest-path computations that certify it, and the arithmetic of its ratio. The result is proved in the paper; to our knowledge it has not been formalized in any proof assistant. The construction (a recursively defined weighted graph with a closed-form shortest-path table) is also a reusable pattern for other worst-case lower bounds of greedy heuristics.
Difficulty
The arithmetic ((2.12) and the final inequality) is routine. The content is in properties a) and b). A shortest-path distance is an infimum over all walks, and property a) asks that no detour through the recursive structure is shorter than the direct edge, at every level of the recursion. The paper handles this by an induction on (2.13)–(2.17) that tracks only seven nodes per level, and argues that distances inside a copy of are not shortened by embedding it into . Property b) then needs that at each step of the chosen node is at least as close as every unvisited node, including nodes in the other copy and nodes reached through the start or right nodes; ties occur, and the claim is only that some resolution of them follows . Checking small cases by computer does not give either property for all .
Formalization scope
Nodes of an instance are Fin n, a tour is a permutation of Fin n, the tour length is the sum over consecutive pairs including the closing edge, and OPTIMAL is a minimum over the finite set of permutations. The model is the paper's: symmetric, nonnegative distances with the triangle inequality. The distance structure also carries , a normalization not in the paper; the diagonal never enters a tour length. A nearest-neighbor tour is a permutation in which each step goes to a node at least as close as every unvisited node, from an arbitrary start with arbitrary ties.
Ratios are multiplied out: the goal is together with , the paper's standing assumption (1.1). is Real.logb 2 of , as printed. Because of the strict inequality and the conjunct , the all-zero distance does not satisfy the goal, so the statement cannot be met by a degenerate instance.
In the construction the nodes of , , are numbered from left to right (start node , middle node , right node ); in the left copy comes first, then the new node, then the right copy. Graphs are edge lists with real weights and is defined in exactly as in (2.11). The shortest-path distance is the infimum of walk weights over an inductive walk predicate; it would be for two nodes with no connecting walk, a case that does not arise because every and is connected. is defined by its difference equation; its identification with the length of the tour along is milestone 7. All construction statements assume .
A complete development needs a small library for shortest-path distances of finite weighted edge lists (symmetry, triangle inequality, attainment, behaviour under relabelling and under gluing two graphs at a few nodes); this part is reusable beyond the mission. Contributions welcome: proofs of any milestone, and such general shortest-path lemmas as separate theorems. Theorem 1 is not part of this mission.
Selected references
- D. J. Rosenkrantz, R. E. Stearns, P. M. Lewis II, An Analysis of Several Heuristics for the Traveling Salesman Problem, SIAM J. Comput. 6(3):563–581, 1977. https://doi.org/10.1137/0206041
- M. Bellmore, G. L. Nemhauser, The Traveling Salesman Problem: A Survey, Operations Research 16(3):538–558, 1968. https://doi.org/10.1287/opre.16.3.538
- J. W. Gavett, Three Heuristic Rules for Sequencing Jobs to a Single Production Facility, Management Science 11(8):B166–B176, 1965. https://doi.org/10.1287/mnsc.11.8.B166
- N. Christofides, Worst-Case Analysis of a New Heuristic for the Travelling Salesman Problem, Report 388, Graduate School of Industrial Administration, Carnegie Mellon University, 1976.