Papers
Topics
Authors
Recent
Search
2000 character limit reached

2.5-opt Algorithm in TSP

Updated 6 July 2026
  • The 2.5-opt algorithm is a local search strategy for TSP defined by 2.5-swaps that exchange either 2 edges or 3 edges (with an adjacent pair) to form a new tour.
  • It exhibits the all-exp property, meaning that adversarial instances can force exponentially many iterations regardless of the chosen pivot rule.
  • Its analysis introduces novel gadget constructions and Max-Cut reductions, positioning it theoretically between 2-opt and full 3-opt in TSP neighborhood methods.

The 2.5-opt algorithm is a local-search algorithm for the traveling salesman problem (TSP) whose neighborhood consists of exchanges that are stronger than 2-opt but weaker than full 3-opt. In the formalization used in recent complexity work, a 2.5-swap is a swap that either removes two tour edges or removes exactly three tour edges with an incident pair; an improving 2.5-swap is accepted if the replacement yields a tour of lower weight. In that sense, 2.5-opt is a generalization of 2-opt and a restricted version of 3-opt (Heimann et al., 16 Jul 2025). Earlier work on approximation guarantees for kk-opt and parameterized Lin–Kernighan does not define 2.5-opt explicitly, but places it naturally in the family of small, structured exchange neighborhoods used in TSP local search (Zhong, 2019).

1. Definition and neighborhood structure

In the formal model used for TSP local search, a swap is a pair (E1,E2)(E_1,E_2) of edge sets with E1=E2|E_1|=|E_2|. A 2.5-swap is then defined by the condition

either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}

A swap is improving for a tour τ\tau if replacing E1E_1 by E2E_2 yields a tour of lower weight. The 2.5-opt algorithm is the local search procedure that repeatedly performs improving 2.5-swaps until none exists (Heimann et al., 16 Jul 2025).

This definition fixes a point that is often left informal in heuristic discussions. Under this formalization, 2.5-opt contains all 2-swaps and a restricted subset of 3-swaps, namely those in which the deleted 3-edge set has an adjacent pair. The paper also states that 2.5-opt was introduced by Bentley as $2H$-opt, and characterizes it as a restricted version of 3-opt (Heimann et al., 16 Jul 2025).

Neighborhood Allowed move types Edges changed incident to at most
2-opt type (a) only 4 vertices
2.5-opt types (a) and (b), but not (c) 5 vertices
3-opt types (a), (b), and (c) 6 vertices

The structural interpretation is that 2.5-opt extends 2-opt by permitting some nontrivial 3-edge exchanges, but excludes the fully disjoint 3-edge exchange available to full 3-opt. Equivalently, it is the subset of 3-opt moves in which the removed edge set is either of size $2$, or of size $3$ with an adjacent pair (Heimann et al., 16 Jul 2025).

2. Position in the (E1,E2)(E_1,E_2)0-opt/(E1,E2)(E_1,E_2)1-opt/(E1,E2)(E_1,E_2)2-opt hierarchy

The standard (E1,E2)(E_1,E_2)3-opt framework defines a (E1,E2)(E_1,E_2)4-move as a replacement of at most (E1,E2)(E_1,E_2)5 tour edges by other edges so as to obtain a new tour; a tour is (E1,E2)(E_1,E_2)6-optimal if no improving (E1,E2)(E_1,E_2)7-move exists. In that language, 2-opt and 3-opt are exact neighborhood classes, while 2.5-opt is not a standard separate combinatorial class in the approximation-ratio analysis of (E1,E2)(E_1,E_2)8-opt (Zhong, 2019).

That paper explicitly states that it does not define or analyze 2.5-opt. Instead, it gives the theoretical setting in which 2.5-opt is best understood as either a restricted 3-opt neighborhood or “2-opt plus a one-node insertion,” i.e. removal of one city followed by reinsertion elsewhere. It further states that the best formal analogy is a restricted 3-opt neighborhood, while the best algorithmic analogy is a small-depth structured local-search move in the spirit of Lin–Kernighan (Zhong, 2019).

The relation to Lin–Kernighan is conceptual rather than definitional. The Lin–Kernighan generalization studied there searches not over arbitrary (E1,E2)(E_1,E_2)9-edge replacements but over structured changes in which added and deleted edges alternate along a closed alternating walk. This places 2.5-opt naturally among the small exchange neighborhoods that are stronger than plain 2-opt but far less general than unrestricted E1=E2|E_1|=|E_2|0-opt or full variable-depth Lin–Kernighan search (Zhong, 2019).

A useful summary is therefore

E1=E2|E_1|=|E_2|1

with the caveat that the middle term is formalized differently across the literature. In the recent dedicated complexity analysis, the definition above is exact; in older heuristic usage, “2.5-opt” often functions as a name for a restricted 3-opt or one-vertex-relocation neighborhood (Heimann et al., 16 Jul 2025).

3. Worst-case iteration complexity

The main dedicated worst-case result is:

E1=E2|E_1|=|E_2|2

The all-exp property means that there are infinitely many instances and initial tours such that the standard local-search algorithm requires exponentially many improving steps for all pivot rules. In the formal definition used there, “exponential” means

E1=E2|E_1|=|E_2|3

on instances of size E1=E2|E_1|=|E_2|4 (Heimann et al., 16 Jul 2025).

This is a statement about iteration complexity, not approximation ratio. It says that there are families of instances on which every improving run of 2.5-opt is exponentially long. The result is stronger than a bad-pivot-rule construction: it implies that even an optimal pivot rule cannot avoid exponential-length trajectories on those instances. The paper also states that the same conclusion holds for the metric TSP, using the standard transformation in which adding a sufficiently large constant to all edge weights preserves the transition graph of the local search while enforcing the triangle inequality (Heimann et al., 16 Jul 2025).

The result places 2.5-opt at a sharp threshold in the landscape of small TSP local-search neighborhoods. Before this work, all-exp was already known for larger E1=E2|E_1|=|E_2|5, and had been pushed to all E1=E2|E_1|=|E_2|6; the practically important open cases included 3-opt, 4-opt, and 2.5-opt. The paper proves all-exp for 3-opt, 4-opt, and 2.5-opt, while stating that 2-opt remains open (Heimann et al., 16 Jul 2025).

4. Proof architecture and gadget construction

The 2.5-opt lower bound is not a corollary of the 3-opt or 4-opt construction. The paper states that it requires a different reduction, new gadgets, and a more delicate Max-Cut construction. The reduction starts from a hard local-search problem for Max-Cut/Flip, using a further modified Michel–Scott construction E1=E2|E_1|=|E_2|7, and proves that any maximal improving flip sequence of E1=E2|E_1|=|E_2|8 from the designated initial cut has exponential length (Heimann et al., 16 Jul 2025).

A central novelty is the use of irregular node gadgets together with star gadgets. In the 3-opt and 4-opt reductions, the relevant gadgets behave “regularly,” meaning that when the tour passes through a gadget, the two incident external tour edges belong to the same neighboring gadget. For 2.5-opt, some vertices are allowed to behave irregularly, so that the two external tour edges can belong to different neighboring gadgets. The paper identifies this as the mechanism that reduces the number of exchanged edges needed to simulate a Max-Cut flip from three to two (Heimann et al., 16 Jul 2025).

The gadget family used in the 2.5-opt proof consists of regular and irregular node gadgets and of star-E1=E2|E_1|=|E_2|9 gadgets for either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}0, specifically star-1, star-2-IR, star-2-II, star-3, and the specialized star-4 gadget. For either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}1, the star gadgets have standard subtours indexed by either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}2, and the paper proves a uniqueness-and-weight lemma for these subtours. For the star-4 gadget, only 14 standard subtours are used, because the reduction only needs to realize a specific cyclic sequence of states rather than all possible state transitions (Heimann et al., 16 Jul 2025).

The state control is organized around the 4-tuple

either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}3

whose state is a bit vector in either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}4. The paper shows that along any improving flip sequence these states follow a fixed cyclic sequence either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}5. This is exactly what makes the star-4 gadget sufficient: it only needs to implement the successor transitions in either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}6, not every transition of an arbitrary 4-star (Heimann et al., 16 Jul 2025).

At the level of complete tours, the reduction defines a class of standard tours corresponding to cuts of the Max-Cut instance. There is a map either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}7 from standard tours to cuts, and the proof shows that improving 2.5-swaps from a standard tour remain within the standard-tour class. More precisely, if the underlying graph either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}8 has girth at least nine, then a 2.5-swap from a standard tour produces another standard tour, and the corresponding cuts either remain the same or differ by a single flip. The objective-value correspondence is not exact, but the discrepancy is bounded in the interval

either E1=2,or E1 contains exactly three edges, two of which are incident.\text{either } |E_1|=2,\quad \text{or } E_1 \text{ contains exactly three edges, two of which are incident.}9

which is chosen to be smaller than the gain of any improving flip. After deleting consecutive repetitions in the sequence

τ\tau0

one obtains an improving flip sequence in the Max-Cut instance, and maximal improving 2.5-swap sequences correspond to maximal improving flip sequences. Exponentiality of the latter yields exponentiality of the former (Heimann et al., 16 Jul 2025).

5. Approximation ratios and broader complexity context

Although 2.5-opt now has a dedicated iteration-complexity lower bound, the approximation-ratio theory is still formulated for τ\tau1-opt and certain Lin–Kernighan variants rather than for 2.5-opt itself. For Metric TSP, one paper proves that for fixed τ\tau2, the approximation ratio of τ\tau3-Opt is τ\tau4, with matching lower bounds under the Erdős girth conjecture and unconditional matching bounds for τ\tau5. In particular, for full 3-opt it proves the sharp asymptotic

τ\tau6

but it explicitly does not define or analyze 2.5-opt (Zhong, 2019).

This suggests that 2.5-opt should be benchmarked theoretically against 3-opt rather than against 2-opt. A plausible implication is that a restricted neighborhood such as 2.5-opt should not be expected to have a better worst-case guarantee than full 3-opt, and may be weaker. The paper itself states this only as a contextual reading, not as a theorem (Zhong, 2019).

Fine-grained complexity results provide a complementary backdrop. In the graph setting, 2-opt can be solved in τ\tau7 time, while 3-opt detection is equivalent, with respect to truly subcubic algorithms, to All-Pairs Shortest Paths on weighted digraphs. The same work shows that for every fixed τ\tau8, the best τ\tau9-move can be found in

E1E_10

time, so that 4-opt is solvable in E1E_11 time, matching the best-known asymptotic bound for 3-opt (Berg et al., 2016).

These results do not mention 2.5-opt, but they sharpen its theoretical placement. Since 2.5-opt is a restricted subset of 3-edge exchanges, it lies between a neighborhood with exact quadratic search complexity and one whose detection problem is tied to APSP-style fine-grained hardness. The papers stop short of assigning 2.5-opt a corresponding exact search complexity class (Berg et al., 2016).

Complexity of reaching local optima gives yet another perspective. A later paper proves that TSP/E1E_12-Opt is PLS-complete for E1E_13, for both general and metric TSP, under the formal neighborhood in which one replaces at most E1E_14 edges by the same number of edges. That paper does not mention 2.5-opt; therefore no PLS-completeness theorem is stated for it. Still, it shows that sufficiently rich edge-exchange neighborhoods can encode hard local-search structure even when the objective is only to find a local optimum rather than a global optimum (Heimann et al., 11 Mar 2026).

6. Practical interpretation, nomenclature, and unresolved questions

The term 2.5-opt is not fully standardized. In the dedicated lower-bound paper it has a precise swap-based definition, but in heuristic TSP usage it is often understood either as a restricted 3-opt move or as “2-opt plus a one-node insertion,” also described as Or-opt(1). That terminological variation explains why some theoretical papers on E1E_15-opt and Lin–Kernighan discuss the relevant neighborhood ideas without naming 2.5-opt explicitly (Zhong, 2019).

The worst-case exponential iteration bound does not contradict empirical success. The all-exp theorem says only that there are infinitely many adversarial instances on which every improving run is exponentially long. It does not imply that typical Euclidean or benchmark instances exhibit that behavior. The paper explicitly notes that this is a worst-case result and that it says nothing contradictory to the empirical observation that 2.5-opt often improves on 2-opt without the overhead of full 3-opt (Heimann et al., 16 Jul 2025).

For move-search engineering, the sharpest available algorithmic results in the supplied literature concern 2-opt rather than 2.5-opt. One paper gives an exact method for finding the best 2-OPT move that is much faster than quadratic enumeration on average for random tours, proving average-time E1E_16 heuristics for uniform random edge weights and E1E_17 heuristics for random Euclidean tours, together with a hybrid strategy that switches back to exhaustive search near local optimality. It does not define 2.5-opt, but its central principle—using the current best gain to prune anchors that cannot beat the incumbent—suggests a plausible design template for accelerated 2.5-opt search, although no theorem for 2.5-opt is given there (Lancia et al., 2024).

The current theoretical boundary is therefore unusually clear. 2.5-opt is formally stronger than 2-opt and weaker than 3-opt; it has a precise modern definition; it already exhibits the full all-exp pathology in both general and metric TSP; yet it lacks a dedicated approximation-ratio theory comparable to that known for 3-opt, and its exact best-move search complexity remains uncharacterized in the supplied literature. In that sense, 2.5-opt is both a practically motivated intermediate neighborhood and a theoretically significant threshold: a very restricted extension beyond 2-opt is already powerful enough to support exponentially long local-search trajectories under every pivot rule (Heimann et al., 16 Jul 2025).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to 2.5-opt Algorithm.