Manuscript Offprint
arXiv:2610.31513Closing All-Exp Gaps in Local Search for the Traveling Salesman Problem and Maximum Constraint Assignment
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.
Abstract
We prove the all-exp property for the Traveling Salesman Problem with the 2-opt neighborhood, and for - and -Maximum Constraint Assignment with the flip neighborhood. The all-exp property states that infinitely many instances have an initial solution from which every sequence of improving moves to a local optimum, and hence every run of local search, has exponential length. For the Traveling Salesman Problem, the all-exp property was previously known for every k-opt neighborhood with , so our result for 2-opt completes the picture for all k-opt neighborhoods. In -Maximum Constraint Assignment, each constraint involves at most p variables, each variable occurs in at most q constraints, and each domain has size r. Decreasing any of the parameters of or yields a problem in which every sequence of improving flips has polynomial length, so both Maximum Constraint Assignment results are tight. All three results settle long-standing open problems. Our proofs build on a common construction idea, which reveals a close connection between the local-search dynamics of the three problems.
*Hertz Chair for Algorithms and Optimization, University of Bonn, Germany (sheimann@uni-bonn.de)
Algorithms and Complexity Group, Faculty of Informatics, TU Wien, Austria, (phoang@ac.tuwien.ac.at) funded by the Austrian Science Fund (FWF, project 10.55776/ESP1136425)
Research Institute for Discrete Mathematics and Hausdorff Center for Mathematics, University of Bonn, Germany (hougardy@or.uni-bonn.de) funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany's Excellence Strategy – EXC-2047/1 – 390685813
Contents
1 Introduction 2
2 Preliminaries 6
2.1 Local-search problems 6
2.2 TSP with the k-opt neighborhood 7
2.3 Maximum Constraint Assignment 7
3 (3,2,2)-MCA has the all-exp property 7
4 TSP with the 2-opt neighborhood has the all-exp property 12
4.1 The construction 13
4.2 Tour characterization 14
4.3 States of the tour 16
4.4 Correctness 20
5 (2,3,2)-MCA has the all-exp property 23
5.1 Graph representation of binary MCA 24
5.2 The “following” primitive 24
5.3 The construction 25
5.4 Correctness 28
One such form of hardness concerns not the complexity of finding a local optimum but the number of iterations performed by local search. A first indication of such hardness is the is-exp property: there are infinitely many instances, each with an initial solution, from which at least one sequence of improving moves to a local optimum has exponential length. This alone, however, does not imply that local search necessarily takes exponentially many iterations. Whenever several improving neighbors are available, a pivot rule determines which one is chosen, and a suitable pivot rule may avoid the long sequence and reach a local optimum much faster. The strongest possible negative result is that a problem has the all-exp property: there are infinitely many instances, each with an initial solution, such that every sequence of improving moves from this initial solution to a local optimum has exponential length. Equivalently, even under an optimal pivot rule, local search started from these initial solutions requires exponentially many iterations. Every problem shown to be PLS-complete via a tight PLS-reduction has the all-exp property [SY91]. However, the all-exp property can also be established by direct constructions, which work even for problems not known to be PLS-complete.
One of the most prominent local-search heuristics is k-opt for the Traveling Salesman Problem (TSP). The case , called 2-opt, was already studied by Croes in 1958 [Cro58] and is the oldest and simplest local-search method for the TSP. In each iteration, 2-opt replaces two edges of the current tour with two other edges such that the resulting tour is shorter. The k-opt heuristic generalizes 2-opt by replacing up to k edges in each iteration. Both 2-opt and k-opt for general k have been studied extensively, theoretically as well as experimentally; see, for example, [Ben92, JM97, CKT99, JM02].
The TSP with the 2-opt neighborhood has long been known to have the is-exp property; the first construction establishing this property is due to Lueker [Lue75] (see also [CKT99, page 1999]). However, the is-exp property does not rule out a pivot rule that always reaches a local optimum after polynomially many iterations, and whether the TSP with the 2-opt neighborhood also has the all-exp property has remained open. The first all-exp result for the TSP with the k-opt neighborhood is due to Krentel [Kre89] and holds for all sufficiently large constants . Hoang and Hougardy [HH23] later showed that Krentel's construction requires and, by refining the construction, reduced this bound to . In 2024, Heimann, Hoang, and Hougardy [HHH24] substantially improved the bound and proved that the TSP with the k-opt neighborhood has the all-exp property for all . This result is based on the fact that Max-Cut with the flip neighborhood, in which a single vertex moves to the other side of the cut, has the all-exp property on graphs of bounded degree. For general graphs, Schäffer and Yannakakis [SY91] already showed in 1991 that Max-Cut with this neighborhood is PLS-complete via a tight reduction and hence has the all-exp property. In 2010, Monien and Tscheuschner [MT10] established the all-exp property for Max-Cut even on graphs of maximum degree four; a much simpler proof of this result was later given by Michel and Scott [MS23].
Very recently, Heimann, Hoang, and Hougardy [HHH26b] proved the all-exp property for the TSP with the 3-opt and 4-opt neighborhoods, and also with the 2.5-opt neighborhood, which lies strictly between the 2-opt and 3-opt neighborhoods and was introduced in [Ben92]. Consequently, the TSP with the k-opt neighborhood was known to have the all-exp property for every , and only the most basic and practically important case, 2-opt, remained open. In this paper, we finally settle this case.
Theorem 1. The Traveling Salesman Problem with the 2-opt neighborhood has the all-exp property.
The results of [HHH26b] for 2.5-opt, 3-opt, and 4-opt are based on reductions from Max-Cut with the flip neighborhood on graphs of bounded degree. A natural approach to proving Theorem 1 is to extend these reductions to 2-opt. However, we believe that the approach used in [HHH26b] has already been exhausted and does not allow one to prove the 2-opt case. Instead, we give a direct construction. The recursive idea behind this construction is easiest to develop for the Maximum Constraint Assignment (MCA) problem with the flip neighborhood, a generalization of Max-Cut in which the local structure of the instances is controlled by three parameters. Moreover, MCA is of independent interest, since for several small parameter values the all-exp question has been open for a long time.
An instance of -MCA consists of variables, each with a domain of size r, and constraints, each of which depends on at most p variables and assigns a weight to every combination of values of these variables; every variable occurs in at most q constraints. The goal is to find an assignment of values to the variables that maximizes the sum of the resulting constraint weights. A local-search step in the flip neighborhood changes the value of a single variable; for binary variables, that is, r = 2, this is simply a flip. Throughout this paper, we consider MCA only with the flip neighborhood.
In the terminology of constraint satisfaction, MCA is a valued constraint satisfaction problem (VCSP) with finite weights and a maximization objective. In particular, MCA naturally generalizes weighted satisfiability problems. Dumrauf and Monien [DM13] studied the problem systematically and, building on techniques introduced by Krentel [Kre89], proved that (3, 2, 3)-MCA, (2, 3, 6)-MCA, and the binary problem (6, 2, 2)-MCA are PLS-complete via tight reductions and hence have the all-exp property. Moreover, Max-Cut on graphs of maximum degree four is a special case of (2, 4, 2)-MCA, so the result of Monien and Tscheuschner [MT10] implies the all-exp property for (2, 4, 2)-MCA. More recently, Heimann, Hoang, and Hougardy [HHH26a] proved the all-exp property for (2, 2, 5)-MCA.
On the positive side, Kaznatcheev, Cohen, and Jeavons [KCJ20, Kaz20] proved that for -MCA every sequence of improving flips has length at most quadratic in the instance size. In contrast, the same authors established the is-exp property for - and -MCA [KCJ20]. More recently, Kaznatcheev and Vazquez Alferez [KVA25] strengthened the is-exp result for -MCA by showing that even the steepest-ascent pivot rule can require exponentially many flips, although their instances admit polynomial-length improving sequences under other pivot rules. Whether these problems also have the all-exp property remained open. Taking into account the known all-exp results and the fact that the all-exp property carries over to larger parameter values, exactly eleven cases were open: -, -, -, -, -, -, -, -, -, -, and -MCA.
In this paper, we prove the following two theorems.
Theorem 2. (3,2,2)-MCA with the flip neighborhood has the all-exp property.
Theorem 3. (2,3,2)-MCA with the flip neighborhood has the all-exp property.
Since every open case other than - and -MCA has parameters that are component wise at least or at least , Theorems 2 and 3 leave only these two cases open. Both theorems are tight: decreasing any of the three parameters yields a problem in which every sequence of improving flips has polynomial length. For -MCA, this is the result of Kaznatcheev, Cohen, and Jeavons mentioned above; if one of the parameters equals 1, every sequence of improving flips even has at most linear length, since then each variable can change its value at most times , each constraint can increase its weight at most times , or no move is possible at all .
Since 2-opt is the smallest k-opt neighborhood, Theorem 1 is best possible as well. The three theorems thus show that local search can require exponentially many iterations under every pivot rule, even in remarkably restricted settings. These results settle longstanding open questions at two of the most basic boundaries in discrete local search: the last open k-opt neighborhood for the TSP and the dividing line between polynomial and exponential behavior for binary MCA. In particular, binary MCA is now completely classified: -MCA has the all-exp property if and only if and .
Overview of the constructions. Our three proofs are based on a common construction idea, which reveals a close connection between the local-search dynamics of the TSP with the 2-opt neighborhood and of MCA. This idea is similar to the recursive approach used in previous all-exp constructions, such as that of Michel and Scott [MS23]. Each instance consists of a linear number of layers, with interactions between consecutive layers restricted to two interfaces. One interface controls when an improving sequence in the preceding layer can start, while the other ensures that this sequence must finish before further progress in the current layer is possible. The key idea behind the exponential behavior is that a traversal of one layer requires at least two traversals of the preceding layer. Applied recursively, this ensures that, from a suitably chosen initial solution, every maximal improving sequence, that is, every improving sequence ending in a local optimum, has exponential length. The main challenge is to enforce these dependencies so that no sequence of improving moves can bypass the recursive traversals.
Our construction for -MCA implements this idea very directly. The structure and constraint weights are chosen such that, starting from a suitable initial assignment, there is exactly one improving flip at every step, and each flip increases the objective value by exactly one. Moreover, our construction is 3-partite, meaning that we can partition the variables into three parts such that no constraint contains two variables from the same part. Despite these restrictions, the unique maximal improving sequence has exponential length.
The construction for 2-opt follows a very similar recursive pattern but requires an additional idea. We can assign states to different parts of a tour, but not every assignment of states represents a valid tour, and not every change between valid state assignments corresponds to a 2-opt move. We deliberately exploit these restrictions to exclude shortcuts that would otherwise be improving. Unlike in the previous constructions for [HHH24, HHH26b], where unwanted improving moves could be excluded by the choice of edge weights alone, the restricted nature of 2-opt makes these feasibility restrictions particularly important. They also allow us to choose the weights of two parts of each layer, which we call the upper and lower gadgets, largely independently. Further, unlike the previous constructions [HHH24, HHH26b], which rely on a reduction from Max-Cut with the flip neighborhood, we present a “direct” construction here. While we cannot enforce a unique improving move at every step, we show that all maximal improving sequences differ only in the order of a few moves that can be performed independently.
For -MCA, we build on the recursive construction of Michel and Scott [MS23] for Max-Cut with the flip neighborhood. However, their construction contains vertices of degree four, whereas every variable in -MCA may occur in at most three constraints. Reducing the degree while preserving the behavior of all improving sequences is a challenge: introducing auxiliary variables creates additional improving flips, which may allow the recursive dependencies to be bypassed. We overcome this difficulty by designing specific gadgets that reproduce the required dependencies using only variables that occur in at most three constraints. In particular, one gadget implements the dependence on three variables through Boolean operations, while another propagates the change of one variable to the next layer and ensures that the next recursive traversal can begin only after this propagation has been adequately completed. Although several improving flips may now be available simultaneously, we show that their dependencies are captured by a directed acyclic graph. Consequently, all maximal improving sequences correspond to linear extensions of this graph and have the same exponential length.
Outline. Section 2 establishes the necessary background, including key terms and notations. We then prove the results for -MCA, the TSP with the 2-opt neighborhood, and -MCA in Sections 3, 4, and 5, respectively. The three proofs are self-contained and can be read independently. We occasionally reuse notation, with its meaning defined separately in each section.
2 Preliminaries
Denote by the set . Let denote the set of all natural numbers (including zero). For , let , and write for addition modulo 2 (i.e., the XOR operation). For a statement , we write for its indicator (i.e., it is 1 if is true and 0 otherwise). For an assignment , a variable , and , we write for the assignment that agrees with on and assigns the value to .
For a directed acyclic graph , a linear extension of is an ordering of its vertices such that every edge satisfies . Equivalently, a linear extension is a topological ordering of .
2.1 Local-search problems
A local-search problem is an optimization problem that consists of a set of instances , a finite set of (feasible) solutions for each instance , an objective function that assigns an integer value to each instance and solution , and a neighborhood for each solution . The size of every solution must be bounded by a polynomial in the size of . The goal is to find a locally optimal solution for a given instance ; that is, a solution , such that no solution yields a better objective value than . Formally, this means, for all , if is a minimization problem, and if is a maximization problem.
The standard local-search algorithm for an instance I proceeds as follows. It starts with some initial solution . Then it iteratively visits a neighbor with a strictly better objective value until it reaches a local optimum. If a solution has more than one better neighbor, the algorithm has to choose one by some prespecified rule, often referred to as a pivot rule.
For a move from a feasible solution to , we define its gain as for a minimization problem, and as for a maximization problem (with the instance fixed). A move is improving if and only if its gain is positive. A sequence of solutions is an improving sequence of length if, for each , we have and the move from to is improving. It is maximal if is a local optimum.
Definition 4 (All-exp property). A local-search problem has the all-exp property if there are infinitely many pairs of an instance and an initial solution , for which the standard local-search algorithm needs an exponential number of iterations for all possible pivot rules. (By exponential, we mean a growth of at least for some constant and instances of size .)
An alternative way to define the all-exp property is to consider the transition graph of an instance I of a local-search problem P. This graph has as vertices all the solutions and there exists a directed edge if the solution is in the neighborhood of s and has a strictly better objective value than s. By definition, the transition graph is acyclic, and a directed path of length in the transition graph corresponds to iterations of the standard local-search algorithm. A local optimum corresponds to a sink in the transition graph. Hence, a local-search problem has the all-exp property if and only if there exist infinitely many pairs of instances and initial solutions such that all paths in the transition graph from the initial solution to a sink have exponential length.
2.2 TSP with the k-opt neighborhood
A Hamiltonian cycle of a graph is a cycle that contains all vertices of the graph. In this paper, we also refer to a Hamiltonian cycle as a tour.
A TSP instance is a tuple , where is a complete undirected graph , and is a function that assigns a weight to each edge of . The goal is to find a tour of that minimizes the sum of the edge weights in the tour. We call this sum the weight of the tour.
A swap is a tuple of subsets with . For an integer , a swap with is called a -swap. For a subgraph of , and two edge sets with , performing a swap on refers to the act of removing from and adding to . We also call it swapping for in . Given a tour , a swap has gain , and it is improving for if after swapping for in , we obtain a tour of smaller weight.
A swap sequence is a sequence , such that each is a swap. A sequence is improving for a tour if, for each , the swap is improving for the tour obtained from by performing .
In the local-search problem TSP with the k-opt neighborhood, the neighbors of a tour are those that can be obtained from by a k-swap. The k-opt algorithm is then the standard local-search algorithm for this problem, and an execution of the algorithm corresponds to an improving k-swap sequence.
2.3 Maximum Constraint Assignment
An instance of -Maximum Constraint Assignment, abbreviated as -MCA, consists of a set of variables and a set of constraints . Each variable takes a value in . A constraint , for , assigns an integer weight to every possible assignment of the variables appearing in it. Moreover, every variable appears in at most constraints.
For an assignment , its value is
The objective is to maximize .
In this paper, we only consider the binary case . For an assignment and a variable , the flip of is the assignment obtained from by replacing with and leaving all other variables unchanged. The flip neighborhood of an assignment consists of all assignments obtained from by flipping exactly one variable. The flip of at has gain ; it is improving if it increases the value of the assignment. For brevity, we also say that is improving if the flip of is improving. An assignment with no improving variable is a local optimum. An improving flip sequence is a sequence such that, starting from a given assignment, the flip of is improving after the preceding flips have been performed.
3 (3,2,2)-MCA has the all-exp property
In this section, we prove the following.
Theorem 2. (3,2,2)-MCA with the flip neighborhood has the all-exp property.

Figure 1: The -MCA instance , showing the values of the variables in the local optimum reached from the initial all-zero assignment: the variables of layer 2 have value 1 (red), and all other variables have value 0 (green).
In this setting, every constraint has at most three variables, each variable occurs in at most two constraints, and all variables are binary. We show the theorem above via a direct construction. For each , we give an instance with variables and constraints, together with an initial assignment. We then show that there is a unique maximal improving sequence of flips of length starting from the initial assignment. Since all constraint weights are at most , the instance can be encoded with bits, so this length is exponential in the instance size in the sense of our definition.
The construction. The instance consists of variables and constraints organized in layers. The base layer consists of two variables and one constraint , while each layer consists of six variables and four constraints , , , and . All variables can assume the values 0 and 1, which we also identify with (green) and (red), respectively. See Fig. 1. The weights of and other constraints are given by Table 1 and Table 2, respectively.
Remark 5. The instance is 3-partite, that is, its variables can be partitioned into three parts such that no constraint contains two variables of the same part. Such a partition is given by with , , and, for all , ,
Initial assignment. Every variable is initialized as zero ( ).
| 00/●● | 01/●○ | 10/○● | 11/○∞ | |
|---|---|---|---|---|
| 14 | 1 | 15 | 16 |
Table 1: The weights of constraint .
| 000/●●● | 001/●●○ | 010/●●○ | 011/●●○ | 100/○●● | 101/○●○ | 110/○●● | 111/○●○ | |
|---|---|---|---|---|---|---|---|---|
| ●●● | ●●○ | ●○● | ●○○ | |||||
| 1 | 0 | 1 | ||||||
| 2 | 0 | 0 | 14 | 2 | 12 | 12 | 14 | |
| 0 | 0 | |||||||
| 13 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | |
Table 2: The weights of the four constraints and for all .
Unique maximal improving flip sequence. We now characterize the unique maximal improving flip sequence for the construction above.
Lemma 6. Starting from the all-zero assignment, the unique maximal improving flip sequence for is given recursively by
Every flip in this sequence increases the objective value by exactly 1. The resulting number of flips is .
Proof. Recall that we identify green () with 0 and red () with 1. For , let denote the objective consisting of the sum of and all constraints with , . Thus, is the objective of the complete instance.
Let denote the assignment in which all variables in are green, and let denote the assignment in which all variables of are red while all variables in are green. For , define the auxiliary objective
This auxiliary objective is used only in the proof to capture the contribution of layer to the preceding layers during the second occurrence of in .
We prove simultaneously by induction on that
(A) with respect to , starting from , the unique maximal improving sequence is ; every flip has gain 1, and the sequence ends in the local optimum ;
(B) with respect to , starting from , the unique maximal improving sequence is again ; every flip has gain 1, and the sequence ends in the local optimum .
For , we have and
Hence, the unique maximal improving sequence from 00 is , it ends in , and both flips have gain 1. Moreover, . Starting from 11, the objective values along the same sequence of flips are 28, 29, 30 on the assignments 11, 01, 00 = , respectively, while the objective value for the assignment 10 is 15. Therefore, and hold.
Now let and assume and . Let , , and . We write the assignment of the variables in as a six-bit word in the order . For a fixed assignment of , we call the objective and , viewed as a function of the variables in , the objective on the preceding layers.
We prove and simultaneously. Initially, in , the variables in have assignment 000000, whereas in they have assignment 111111. The variables in are initially in in both cases.
We claim that the objective on the preceding layers is the same in both cases, up to an additive constant. Suppose that , as in . The constraints and contain only variables of and therefore contribute only an additive constant to the objective on the preceding layers. Moreover, for both values of , while equals for and 0 for . Thus, up to an additive constant, the objective on the preceding layers is
For the corresponding assignment in , has the same dependence on , up to an additive constant, and for both values of . The additional terms in depend only on variables in and hence also contribute only an additive constant. Therefore, the objective on the preceding layers is again , up to an additive constant.
By , at the unique improving variable with respect to is , and flipping it increases the objective value by 1. The additional term decreases the change caused by flipping by , while it does not affect the change caused by flipping any other variable. Hence, no variable in is improving in both and .
At this point . Comparing the values of in and of in before and after each possible flip in shows that is the unique improving variable in in both and , and that flipping it increases the objective value by exactly 1. Thus, is the unique improving variable in both cases.
The remaining steps use the same type of calculation. Table 3 summarizes the information about layer that we will use below. In each row, the first and second columns give the corresponding assignments of in and , respectively. The third column gives, for both assignments, the objective on up to an additive constant. The last column gives all improving variables in for the values of that occur at the corresponding point of the sequence; “none” means that no variable in is improving. Every flip listed in the last column increases the objective value by exactly 1.
For the fourth row, we use
We now continue the argument simultaneously for and . Whenever we refer to a row of Table 3, the first column gives the assignment of in , while the second column gives its assignment in . By the third and fourth columns, however, the objective on the preceding layers and the improving variables in are the same in both cases. Thus, the following argument applies to both.
Table 3: Information about layer used in the induction. The third column gives the objective on , up to an additive constant, for both assignments in the corresponding row. The last column applies to both assignments and gives all improving variables in for the indicated values of ; each listed flip increases the objective value by exactly 1.
| under | under | objective on preceding layers | improving variables in |
|---|---|---|---|
| 000000 | 111111 | for | |
| 100000 | 011111 | none for , for | |
| 110000 | 001111 | for | |
| 111000 | 000111 | none for , for | |
| 111100 | 000011 | for | |
| 111110 | 000001 | for | |
| 111111 | 000000 | none for |
After flipping , we reach the second row of Table 3, and the objective on the preceding layers is . Hence, by , their unique improving sequence is , taking to .
By the recursive definition of , the variable is its first flip and is its last flip, and these two variables are flipped exactly once. Consequently, while is performed, changes from 00 to 10 and finally to 11. By the second row of Table 3, no variable in is improving while is 00 or 10. Thus, the sequence is forced to continue. When it is complete, the preceding layers are in , which is a local optimum with respect to by , and . The second row of the table then shows that is the unique improving variable.
After flipping , we reach the third row of the table, and the objective on the preceding layers is . These variables are still in . By , is a local optimum with respect to . Since , the additional term decreases the change in the objective caused by flipping , while it does not affect any other variable. Hence, no variable in the preceding layers is improving. By the third row of Table 3, is therefore the unique improving variable.
After flipping , we reach the fourth row of the table. The objective on the preceding layers is now . By , their unique improving sequence is , now taking back to .
Again, is the first variable and the last variable flipped in . Hence, during this second occurrence of , changes from 11 to 01 and finally to 00. By the fourth row of Table 3, no variable in is improving while is 11 or 01. Thus, the sequence is again forced to continue. When it is complete, the preceding layers are in , which is a local optimum with respect to by , and . The fourth row of the table then shows that is the unique improving variable.
After flipping , we reach the fifth row of the table. The objective on the preceding layers is again , and these variables are in . By the same argument as for the initial assignment, no variable in the preceding layers is improving. The fifth row of the table therefore shows that is the unique improving variable.
After flipping , we reach the sixth row. The objective on the preceding layers is unchanged, and their assignment is still . Hence, no variable in the preceding layers is improving, and the sixth row of the table shows that is the unique improving variable.
We have therefore shown that in both and the unique improving sequence is
Every flip in this sequence increases the objective value by exactly 1: this follows from the induction hypotheses for the two occurrences of and from Table 3 for the flips of variables in .
After the final flip, the preceding layers are in , and the last row of the table applies. No variable in is improving, and the objective on the preceding layers is . As above, no variable in the preceding layers is improving either. Hence, the resulting assignment is a local optimum.
In , the variables in have changed from 000000 to 111111, while the preceding layers have returned to . Thus, the sequence ends in . In , the variables in have changed from 111111 to 000000, while the preceding layers have again returned to . Thus, the sequence ends in . This completes the induction for and . For , statement is exactly the claim of the lemma, since is the objective of and is the all-zero assignment.
It remains to count the flips. Let . From (1) and (2), we have and . Therefore, for all .
We now prove the main result of this section.
Proof of Theorem 2. Observe that has variables and constraints, and every constraint weight is at most and can thus be encoded with bits. Combining this with Lemma 6, we obtain the all-exp property for -MCA.
4 TSP with the 2-opt neighborhood has the all-exp property
In this section, we prove the following:
Theorem 1. The Traveling Salesman Problem with the 2-opt neighborhood has the all-exp property.
In particular, we construct an instance for each and an initial tour with vertices. We then show that all maximal improving swap sequences starting from this tour have length ; in fact, they are all identical up to interchanging certain commuting swaps and terminate with the same local optimum.
| Edge | AD | XA | XD | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Weight | 1 | 1 | |||||||
| Edge | BY | CE | EY | ||||||
| Weight | 3 | 1 | 1 | 2 | 4 |
Table 4: Weight assignment of the non-zero-weighted edges in the upper (top) and lower gadgets (bottom) for . Subscripts are omitted. . .

Figure 2: Left: Gadget for . Middle: Upper gadget and lower gadget for . Right: Gadget for . All subscripts are omitted.
4.1 The construction
The instance consists of layers . Each layer contains one or two gadgets as depicted in Figure 2 and described in more detail below. Two consecutive layers interact via interfaces. In particular, for a symbol , we call the path with edge weights zero a -interface. We also define and for .
Gadgets. First, has an -interface, a -interface, together with three vertices , , and . The two vertices and are connected with , , , and . Among these edges, , , , and have weights , 4, 3, and , respectively, while other edges have weight zero.
Second, for , consists of two gadgets connected by two paths of length two. The upper gadget of consists of an -interface, an -interface, and two vertices and . The lower gadget of consists of an -interface, a -interface, and three vertices , , and . We add two paths of length two and with edge weights zero. The edges with nonzero weights in this layer are listed in Table 4. Additionally, we have the following edges with zero weights:
Last, has an -interface, a -interface, and a vertex . We then add the edge with weight (recall that ), and edges , and with weight zero.
Interface identification. For two consecutive layers and , we identify the -interface with the reverse of the -interface; more precisely, , , and
. Similarly, we identify the -interface with the reverse of the -interface; that is , , and .
Initial tour. For a symbol , we denote by the path and the reverse. Then consider to be the union of the edges in the following paths:
• In , the path ;
• In for , the two paths
• In , the path , , .
By construction, is then a Hamiltonian cycle. Note that descriptions of paths in consecutive layers above overlap precisely on their identified interfaces. See Fig. 3 for an illustration of together with the prescribed initial tour.
Let denote the graph obtained from the construction above. Note that formally a TSP instance requires a complete graph. We can simply obtain this complete graph from by adding the missing edges, each with a very large weight (say , where is the largest edge weight in the ). The initial tour contains only edges of . Moreover, any 2-swap that introduces an edge of adds weight at least , while the two removed edges have total weight at most . Hence, such a swap cannot be improving. Consequently, no improving 2-opt sequence starting from the initial tour ever uses an edge of , and we may restrict our analysis from now on to .

Figure 3: Instance for n = 4 with the initial tour shown in red.
4.2 Tour characterization
In this subsection, we characterize the tours of via the notion of the layer-path invariant defined below.
Definition 7. An edge set H of satisfies the layer-path invariant if the following holds:
-
The restriction of H to is a spanning path of whose two endpoints lie on the - and -interfaces, respectively.
-
The restriction of H to is a spanning path of whose two endpoints lie on the - and -interfaces, respectively.
-
For every , the restriction of to is the disjoint union of two paths such that this union spans . Further, each of these paths has one endpoint on one of the - and -interfaces and one endpoint on one of the - and -interfaces. Moreover, the two paths have their endpoints on distinct interfaces; thus each of the four interfaces , , , contains exactly one endpoint.
We have the following simple observation.
Observation 8. Every tour of contains the edges incident to degree-two vertices (i.e., , , and for and for ).
Then we can characterize all tours of as follows.
Lemma 9. An edge set H forms a tour of , if and only if it is a 2-regular subgraph of satisfying the layer-path invariant.
Proof. ( ): Suppose forms a tour of , then it is clearly a 2-regular subgraph. Observe that for every layer for , if we remove the - and -interfaces, then we disconnect the remainder of from the remainder of . This implies that
(a) restricted to the graph is a path between a vertex of the -interface and a vertex of the -interface, and
(b) restricted to the graph is a path between a vertex of the -interface and the -interface.
Together with Observation 8, these already imply the first two conditions in Definition 7. For the last condition, by (a), we also obtain that for , restricted to is a path from a vertex of the -interface and the -interface. Combining this with (a) and Observation 8, we obtain the last condition of Definition 7.
(⇔): Starting with the unique path in , choose one of its endpoints, say the one on the -interface, and traverse the path to its endpoint on the -interface. Consider first the -endpoint. Since the -interface is identified with the (reverse of) -interface, it belongs to one of the two paths of . By the layer-path invariant, the other endpoint of this path lies on either the - or the -interface. Continuing in this way, at every intermediate layer we enter through one of its X- or Y-interfaces and leave through one of its A- or B-interfaces. Hence we eventually reach one of the two interfaces , of .
The unique path joins these two interfaces. After traversing it, we therefore return through the other sequence of paths: in every intermediate layer, the second path joins the remaining X- or Y-interface to the remaining A- or B-interface. Eventually, this traversal reaches the -interface and hence the other endpoint of .
Thus all paths occurring in every belong to a single connected component of . Since the paths in the layer-path invariant span every layer, this component contains every vertex of . As is 2-regular, it follows that is a Hamiltonian cycle.
4.3 States of the tour
We describe a tour of by assigning states to its interfaces, to the first layer, and to the upper and lower gadgets. More specifically, we associate with the part of between its two interfaces. For , we associate the symbols and with the corresponding interfaces. For , we associate and with the upper and lower gadgets of , respectively. We use the same notation for these symbols and the corresponding vertices; the meaning will be clear from the context.
Fix a tour of . For a -interface, we denote by the set . By Observation 8, both edges of the interface belong to , so each vertex in has precisely one neighbor outside of the interface in .
Definition 10. The states associated with are defined as follows.
-
For , the state of is 0 if is adjacent in to a vertex of outside its interface, and 1 if is. The state of is defined analogously. By Lemma 9, exactly one of the two endpoints has such a neighbor in .
-
The state of is 0 if its neighbor other than belongs to , and 1 if that neighbor belongs to . The other interface is joined to .
-
For , the state of is 0, 1, or 2 according as its neighbor other than is , belongs to , or belongs to . The resulting three pairings in the upper gadget are shown in Fig. 4.
-
For , the state of is determined by its two neighbors in as follows:
| State | Neighbors of |
|---|---|
| 0 | and |
| 1 | and |
| 2 | and |
| 3 | and |
| 4 | and |
The five corresponding pairings in the lower gadget are shown in Fig. 5.
The states of the interfaces determine which endpoint is used by each gadget. Together with the pairings in Figs. 4 and 5 and the fixed edges from Observation 8, they therefore determine every edge of a reachable tour. All states of are 0.

State 0

State 1

State 2
Figure 4: The three states of and the inferred connection in the upper gadget of
The lemma below describes which states encode valid tours and also asserts that a 2-swap corresponds to a change in exactly one state.
Lemma 11. An assignment of states determines a tour if and only if, for every , the following hold:

State 0
State 1
State 2
State 3
State 4
Figure 5: The five states of and the inferred connection in the lower gadget of
• the pair is not among , , , , and ;
• implies ;
• if , then ;
• if , then .
Further, every 2-swap between tours changes exactly one state. Conversely, if two valid state assignments differ in exactly one state, then the corresponding tours differ by a 2-swap, except when that state is and its two values are 0 and 3, or 1 and 4.

Figure 6: Instance for n = 4 with the initial tour (shown in bold black) and 3 possible 2-swaps. Each is depicted by a 4-cycle with the edges that can be removed from the tour shown in red and the edges that can be added to the tour shown in blue. The 2-swaps on the left, middle and right change , and , respectively.
Proof. The edges incident to degree-two vertices and the states determine the pairings within each upper and lower gadget, as shown in Figs. 4 and 5. The five forbidden pairs for are exactly those that either create a cycle within or fail to connect the interfaces according to Definition 7. Further, the last three conditions in the lemma statements exclude exactly the assignments requiring graph edges that do not exist. Conversely, under these conditions, the pairings form two spanning paths in every interior layer, so the layer-path invariant holds. By Lemma 9, they determine a tour.
Every 2-swap corresponds to a 4-cycle (i.e., a cycle of length four). By Observation 8, no edge incident to a degree-two vertex can be removed. Hence, by the structure of , a 4-cycle either lies within , within one upper or lower gadget, or contains edges from two gadgets connected through an interface between consecutive layers. In the first case, the swap changes only ; in the second case, it changes only or ; and in the last case, it changes only or . Thus every 2-swap changes exactly one state. Fig. 6 depicts examples for the three kinds of 2-swaps.
Conversely, consider two valid state assignments differing in exactly one state. If this is or , the corresponding interface has its two edges to the adjacent layers exchanged. If it is , the two edges joining , to the interfaces are exchanged. If it is , the three states in Fig. 4 specify the three possible pairings of four vertices, so changing the state exchanges exactly two edges.
Finally, consider . Each state specifies three edges, as shown in Fig. 5. The edge occurs precisely in states 1, 2, 3, and precisely in states 0, 2, 4. Moreover, the edge from to the -interface occurs in states 0, 1, and the edge from to the -interface occurs in states 3, 4. These are the only edges shared by different states. Thus any two distinct states share exactly one of their three edges, except for the pairs and , which share none.
Consequently, changing one state exchanges exactly two edges, except in the two stated cases, where it exchanges three edges. Since both state assignments determine tours, every exchange of exactly two edges is a valid 2-swap.
We say a change in a state is improving if it corresponds to an improving 2-swap. For a state T, we write if, with all other states fixed, its contribution to the objective is strictly decreasing in the displayed order. Thus a change from any earlier state to any later state decreases the objective and hence is improving, as long as the resulting state assignment is valid and the change corresponds to a 2-swap. Subject to the validity conditions, the following lemma essentially states that:
- the direction of an improving change of for depends only on the upper gadget of ;
• that of for depends only on the lower gadget of ;
• that of depends only on ;
• that of depends only on ;
• that of depends only on ;
• that of depends on and .
Lemma 12. Suppose a state assignment describes a tour of . Then all the improving changes of all states are exactly as stated in Table 5, subject to the validity conditions in Lemma 11.
| Item | Improving changes | Conditions |
|---|---|---|
| (a1) | none | |
| (a2) | ||
| (a3) | ||
| (b1) | ||
| (b2) | ||
| (b3) | ||
| (b4) | ||
| (c1) | ||
| (c2) | ||
| (d1) | ||
| (d2) | ||
| (e1) | ||
| (e2) | ||
| (e3) | ||
| (e4) |
Table 5: List of all improving changes together with the conditions for these changes (in addition to validity conditions in Lemma 11).
Proof. Note that the contribution to the objective by is determined precisely by the states of . Likewise, for , the contribution by the upper (lower) gadget of is determined by the states of (respectively, ). From the weight assignment of the edges, we can compute these contributions precisely in Table 6.
| (0,0) | 0 | (0,0) | 1 | |||
| (0,1) | (0,1) | 1 | - | |||
| (1,0) | 4 | 3 | (1,0) | |||
| (1,1) | 0 | (1,1) | - |
| (0,0) | 0 | 5 | 4 | - | - |
| (0,1) | 1 | ||||
| (1,0) | 2 | 1 | - | - | - |
| (1,1) | 2 | 1 | 0 |
Table 6: Contributions to the tour weight from and the upper and lower gadgets of , respectively, where , , and . A dash indicates that the corresponding edges do not exist.
Items (b1)-(b2) and (c1)-(e4) now follow immediately from Table 6. (a1) follows immediately from the fact that the weight difference of between and is larger than any weight in the construction.
For (a2)-(a3), consider first changing from 0 to 1, where . By Table 6, the contribution from lies between and . On the other hand, the contribution from is if , and otherwise. Since , the total gain is at least 1 in the former case and at most -1 in the latter. For , the contribution from is either -4 or . Since , the same conclusion holds. The reverse change has the opposite gain.
For (b3)–(b4), consider changing from 0 to 1. For , the contribution from is if , and 3 if , whenever both entries exist. The contribution from is again one of . Since , the total gain is negative in the case of and positive in the case of . For , the contribution from is as above with and the contribution from is zero, giving the same conclusion. The reverse change has the opposite gain.
4.4 Correctness
We now show that in the construction above, any maximal improving sequence from the initial tour has exponential length. In particular, we first describe a canonical improving swap sequence. Then we show that every other maximal improving sequence differs from it only by reordering of some swaps.
The canonical sequence. In order to describe the canonical sequence, we first define its two building blocks, the forward traversal and the return traversal for . A traversal changes the lower layers so that an improving move in the next layer becomes possible. For convenience, we label a swap by the state it changes: denote flips of the corresponding binary states, whereas and denote changes to state from state (cyclically).
Let . Define and as follows:
For , define , and for also define , by
Then the canonical sequence for is exactly . We now show that this canonical sequence is indeed a valid improving swap sequence for .
Lemma 13. Let be obtained from by deleting all occurrences of . Then is improving, and in every improving swap sequence from , the changes other than form a prefix of . Further, at each reachable tour, the only improving changes are the next unperformed change of , if it is applicable, and occurrences of whose corresponding has occurred but which have not yet been performed. The next unperformed change is inapplicable only when it is and the corresponding has not been performed.
Proof. For , Lemma 12 shows that the only successive improving changes are , after which none is improving. Hence suppose . For , let and be obtained from and by deleting all occurrences of . We call a change ordinary if it is not for any . We call a change lower than if it changes or a state with , whenever defined.
We prove the following statements simultaneously by induction on . A rearrangement of or is obtained by moving each occurrence of anywhere between its corresponding and , without changing the order of the ordinary changes. Hence, deleting the changes from any prefix of a rearrangement leaves a prefix of or , respectively.
Suppose all states in are 0. If , suppose also that is or . Then every rearrangement of is improving. After any proper prefix of a rearrangement, the only improving ordinary change lower than is the next unperformed change of , unless it is and is still pending, in which case there is none. An occurrence of lower than is improving precisely when its has occurred and it has not yet been performed. After the entire rearrangement, no change lower than is improving. The final states are if , and otherwise all states below are 0 and .
Suppose and is , , or . Suppose further that if , or, if , that all states below are 0 and . Then every rearrangement of is improving, and the same assertions about improving changes in hold for and in place of and . After the entire rearrangement, no change lower than is improving, and all states in return to 0.
Note that in the case of , may still be pending. It is a change outside the lower layers and can be performed during the traversal or afterwards. Throughout this proof, whenever we claim whether a change is improving, we use Lemma 12 and exclude changes forbidden by Lemma 11.
For , both traversals are . The successive states of are
in , and occur in reverse order in . In each case, Lemma 12 shows that only the next change is improving among the changes lower than 1. This proves the base case.
Let , let , and suppose the statements hold for smaller indices. We first consider how a recursive traversal affects the gadget . Note that is only connected to lower layers via the - and -interfaces. By Lemma 12(a1)-(b4), among the changes lower than , none affects whether a change in is improving, and only affects and . While is executed, remains 0 until its final change to 1; while is executed, remains 1 until its final change to 0. These are also the final changes of any rearrangement of the respective traversals, since by the inductive hypothesis, any must precede its corresponding , which occurs before the final -change.
| Traversal | Final | Effect on improving changes of | |
|---|---|---|---|
| enables | |||
| enables | |||
| enables | |||
| enables | |||
| remains improving |
Table 7: Effect of the final -change of a recursive traversal.
Indeed, in the first four rows the indicated change has gain 1 after the final change of , but is not improving before it. In the last row, has gain 1 both before and after changes; once it has occurred, has gain 1 when . A direct comparison of all states of , in Table 6, subject to Lemma 11, shows that there is no other improving change of these states during the recursive traversal. For example, is forbidden when , is forbidden when , and is not a 2-swap. The flip rules also exclude a newly improving change of or while the recursive traversal is running.
We now prove . Initially, is improving: for this follows from Lemma 12(a1), and for from (a2) and the specified state of . Further, by Lemma 12, since all lower layers are 0, no other change is improving.
After this change, by Lemma 12, the only potential improving change in is , since and . However, by Lemma 11, as long as , this change is not possible. For the layer lower than , since , so applies and we traverse a rearrangement of . The first row of Table 7 shows that after this traversal, is the only improving change.
After this change , as noted above the improving change is now possible. Since , there is no improving change for it, and by Lemma 12, there is no improving change newly arising from this change of . Hence, is the only improving change.
After this change , by Lemma 12, the only state that may have improving change is . By , after the previous traversal , is now . Combined with the fact that is now , is improving.
If (i.e., ), then by Lemma 12(c2) and (b2), the next two improving changes have to be and . That is, we have just performed exactly .
If , then after the change , since , and , by Lemma 12, only state can potentially have an improving change. As , by Lemma 11, cannot be 0. Hence, the only improving change is .
This change of , by Lemma 12, does not affect any vertex in . However, we now have , , and all states below are 0. Hence, applies and we perform a rearrangement of .
In both cases (i.e., whether or ), we can use the third row of Table 7 and obtain that the only improving change after this rearrangement of is . By Lemma 12, this change of makes the change improving, and no other states depends on . Hence, this is the only improving change. We have now exactly all the changes of . Note that , while other states below are 0, as claimed. Also, checking against Lemma 12 verifies that no change below is improving and we complete the inductive proof of .
We use a similar analysis for , which we briefly go through as follow. We start with . By the improving ordinary changes first follow a rearrangement of . The second row of Table 7 then gives the next change , which then enables . At this point and are both improving, and no other change is improving. For , changing enables , after which applies and we can perform a rearrangement of . For , is the first change of , and the rest of the changes of then follow. After that, by the last row of Table 7 and by the argument for the case when before we apply , either is the only improving change if has been performed by the end of the rearrangement of ; or there is no new change that becomes improving, and we have to perform , after which, becomes improving.
We claim that we may perform at any time before . Indeed, after the change that enables and until , we have . Since remains 0, by Lemma 11, it does not forbid the change . Further, by Lemma 12, regardless of whether is 0 or 1, remains improving, and it does not depend on any other state.
Moreover, we cannot omit this change , as by Lemma 12, since remains 0, cannot take value 2, and by Lemma 11, the change of from 3 to 0 does not correspond to a 2-swap. Hence, is the only improving change of and remains so until it is performed.
As argued above, after both and a rearrangement of are performed, the only improving change is . After that, we perform the only subsequent improving change , and all states lower than return to 0. Again, checking against Lemma 12 verifies that no change below is improving, and we complete the induction for .
The induction also shows that after every prefix of a rearrangement, all improving changes lower than are exactly those stated in and : the next unperformed ordinary change, unless blocked by a pending , and the available changes . In particular, shows that is improving. Finally, starting from , induction on the number of performed changes shows that every improving sequence is a prefix of a rearrangement of : every improving choice is either the next unperformed ordinary change or a currently available , and either choice preserves the required order. This proves the lemma.
Corollary 14. The canonical sequence is maximal, and every maximal improving swap sequence from is obtained from it by moving occurrences of between their corresponding and . All these sequences have length 3 if , and if .
Proof. The first statement follows immediately from Lemma 13. By the recursion of , we obtain that for all applicable , , , and for , . Hence, for . Since all maximal improving swap sequences have the same length as , the corollary then follows.
We are now ready to prove the main theorem of this section.
Proof of Theorem 1. Observe that has vertices and each weight can be encoded by bits. Combining this with Corollary 14, we obtain the all-exp property for TSP with the 2-opt neighborhood.
5 (2,3,2)-MCA has the all-exp property
This section is dedicated to showing the following.
Theorem 3. (2,3,2)-MCA with the flip neighborhood has the all-exp property.
Our construction is based on the construction to prove the all-exp property for MaxCut with the flip neighborhood by Michel and Scott [MS23]. We create one binary variable for each vertex in the Michel-Scott construction and one two-variable constraint for each edge, so that the two local-search problems behave identically at every vertex of degree at most three. The only obstacle is that the Michel-Scott construction has vertices of degree four, namely and , which would occur in four constraints and violate the bound q = 3. We replace each of them by a small gadget of degree-three variables. The gadget for consists of two XOR gates; the gadget for is a chain of copies that broadcasts the value of to the next layer and prevents one update from overtaking the preceding one.
All gadgets use a common following primitive, formalized in Section 5.2. A vertex follows a Boolean function determined by its neighbors if, for every assignment of other variables, has a strictly preferred value of . Hence, when , flipping improves the objective.
For brevity, we do not separately recap the Michel-Scott construction. Instead, we directly describe our modified construction and establish the local properties needed for the proof. The relation between our construction and the original Michel-Scott construction is discussed in Remark 18.
5.1 Graph representation of binary MCA
We use the standard constraint-graph representation of Max 2-CSP [SS09], in which variables are represented by vertices, constraints by edges, and values by unary scores on vertices and binary scores on edges. For our construction, it is convenient to use the following weighted graph representation of binary MCA. Specifically, we represent a -MCA instance by a graph of maximum degree at most , edge weights , and vertex weights , with objective
For a vertex x we use the signed difference
Thus flipping from 0 to 1 is improving iff , and flipping it from 1 to 0 is improving iff .
The following standard representation allows us to specify our MCA instance entirely by vertex and edge weights.
Lemma 15. Let . If has maximum degree at most , then any objective of the above form defines a -MCA instance with the same objective function.
Proof. Associate with every edge uv the binary constraint . The unary term can be incorporated into any binary constraint incident with x by adding to both entries corresponding to . If x is isolated, use the unary constraint and . Hence every variable occurs in at most binary constraints, or in one unary constraint if it is isolated.
From this point on, we identify each binary MCA variable with the corresponding vertex in the graph representation and use the terms variable and vertex interchangeably. By Lemma 15, it therefore suffices to construct a graph of maximum degree three with suitable edge and vertex weights.
5.2 The “following” primitive
For a vertex , a Boolean function of the values of some neighbors of , and a set of assignments, we say follows on , denoted by on , if for every assignment we have when and when . Equivalently, has a unique locally preferred value among the assignments in , namely , and if then flipping is improving. If is the set of all assignments, we simply say follows . The most important case is that is a literal or of a single neighbor .
For a neighbor y of x, define the residual incident weight
The contribution to from all neighbors other than lies in . Note that when the neighbors' values can be chosen arbitrarily, both endpoints of this range can be attained.
The following two lemmas list several statements that will be useful in our construction.
Lemma 16 (Following a literal). Let x have neighbor y and let . Then
(a) holds if and only if and ;
(b) holds if and only if and .
In particular, if , then holds if and only if , and holds if and only if .
Proof. We have with . For (a) we need whenever , i.e. for every admissible , which is equivalent to ; and we need whenever , which is equivalent to . Part (b) is the same with the roles of exchanged. The statement for follows immediately.
Lemma 17. Let , let have neighbors and possibly another neighbor . Let be , if exists, and otherwise. Suppose that .
(i) (AND-NOT) If , and , then , which is if and at most otherwise; hence .
(ii) (OR) If and , then ; hence .
(iii) (tie breaker) Suppose t exists. If and , then
Hence, on assignments with . On assignments with , if , ; if , .
Proof. Each formula follows by substituting the weights into the definition of . The first two items use . For the last item, when , since , we have (or equivalently ). When , we have . This implies that on these assignments, when and when .
5.3 The construction
Fix . Let for . Thus . The instance has the following vertices and edges; all vertex weights are 0 unless stated otherwise.
Paths. First, we add two new vertices and and an edge between them with weight . Next, for , we add a path of eight new vertices in that order, with edge weights , , , , , , from to . Last, we add three further vertices , and with edges , and with weights , and . Additionally, has vertex weight . Note that this is the only vertex with a nonzero weight among the vertices above.
Gadget for (). We want the locally preferred value of , after the auxiliary variables have settled, to be , via the gadget below.
We add nine new vertices (all indexed by ) and edges as shown in Figure 7. Table 8 specifies each new edge and gives the relation enforced at the vertex in the first column; the correctness of the following relations is shown in Lemma 19.
Table 8: Data for the gadget to connect with , and . The and variables are additionally indexed by . Each edge is listed exactly once, in the row where it is introduced.
| Variable | Follows | Edges (Weights) | Vertex weight |
|---|---|---|---|
| 0 | |||
| 0 | |||
| 0 | |||
| 0 | |||

Figure 7: Gadget for . The and variables are additionally indexed by . Once its auxiliary variables are locally stable, has preferred value .
Gadget for (). We add five new vertices (indexed by ) and edges as shown in Figure 8.
The edges , , of weights correspond to the incident edges of in the Michel-Scott construction, now attached to copies of . The purpose of the other edges is to make sure that the flip of gets propagated correctly to these copies.
Table 9: Data for the gadget to connect with , and . Each edge is listed exactly once, in the row where it is introduced. All vertex weights are zero.
| Variable | Follows | Edges (Weights) |
|---|---|---|
| common value of ; otherwise | ||

Figure 8: Gadget for . The u and q variables are additionally indexed by i.
Initial assignment . We use the all-zero assignment (i.e., for all ).
Layer. For , we call the set of all vertices indexed by the layer of the construction. See Figure 9 for an illustration of together with some following relations between variables. Note that contains all vertices of the gadget for and the gadget for , except for and themselves.

Figure 9: A layer of for with the incident vertices of the adjacent layers (gray circles with dashed borders). Directed edges indicate following relations, and denotes complementation; on a double-headed edge, applies in both directions. At a ringed vertex, filled arrowheads indicate the two main inputs and the open arrowhead indicates the tie-breaker used when they disagree. Unoriented edges record adjacency only; dependencies inside the gadget for and are omitted. For , the vertex is replaced by , and is incident to instead of and .
Remark 18. Readers familiar with the construction of Michel and Scott [MS23] for MaxCut with the flip neighborhood will recognize much of its structure in ours, particularly the paths and the recursive pattern of flips along them. In fact, as we show in the next section, the projection of our canonical flip sequence onto the path vertices is
which is exactly the recursive flip sequence in their construction.
There are two changes in the presentation. First, we use an all-zero initial assignment: relative to the Michel-Scott construction, the odd-indexed path variables and are complemented. Second, we use larger scales at each layer instead of the scales appearing in the original construction. Neither change affects the recursive flip sequence on the path vertices.
The substantive modification is at the two degree-four interfaces. We replace the interaction at and by the respective gadgets, so that every variable has degree at most three. The additional variable plays the same role for as does for at . This allows us to treat all layers uniformly in the correctness proof.
5.4 Correctness
The correctness proof has two stages. First, we verify locally that every auxiliary variable has the intended preferred value; these properties hold for every assignment and are summarized in Lemma 19 below. We then characterize all the maximal improving flip sequences by first defining a “canonical” sequence and then showing that every maximal improving flip sequence is simply a rearrangement of some flips in . More formally, we define a dependency graph that encodes a partial order of the flips in , and the rearrangement above is then simply a linear extension of this dependency graph.
Lemma 19. In , the following hold.
(a) (Gadget for ) The column “Follows” of Table 8 is correct. Specifically, , , , , , , , , , and . Further, this implies that in an assignment such that none of the variables above can be flipped to improve the objective, we have .
(b) (Gadget for ) The column “Follows” of Table 9 is correct. Specifically, , , , ; moreover when , while when .
(c) (Even path vertices) For and , .
(d) (Odd path vertices) For and , when , . When , , , and .
(e) ; ; ; , and strictly prefers the value 0 in every assignment.
(f) For , if , then ; otherwise . For , the same statement holds with in place of .
Proof. (a) We have
Hence, by Lemma 16, we have , , , and . For the remaining items in Table 8, we apply the following:
• Lemma 17(i) to , with and residual incident weight ;
• Lemma 17(ii) to with and residual incident weight ;
• Lemma 17(i) to , with and residual incident weight ; and
• Lemma 17(ii) to with , where is the absolute weight of for and of for .
This proves every following relation in the table. If all variables appearing there cannot be flipped to improve the objective, these relations give
as claimed.
(b) We have
Hence, by Lemma 16, we have , , , , as claimed. For , applying Lemma 17(iii) with yields the desired relations.
(c) We have
By Lemma 16, we obtain , , and , as claimed.
(d) The two path edges incident with have weight , those incident with have weight , and those incident with have weight . The remaining incident edge has absolute weight 1. Thus Lemma 17(iii) applies at each of these vertices. When the path neighbors agree, the vertex follows their common value. When they disagree, the sign of the unit edge gives that , , and , as claimed.
(e) These cases follow from Lemma 16 and the following observations.
Finally, . So always strictly prefers 0.
(f) when , the two main edges at , namely and , both have weight , while has weight . Hence the statement follows from Lemma 17(iii). The case is identical because has weight .
The canonical flip sequence. Recall the sequence defined in Remark 18. For , we define
We obtain from as follows: before the -th occurrence of , insert , and after every occurrence of , insert . Define in the same way, except that the string inserted before the -th occurrence of is .
Then it is easy to obtain the following explicit recursions.
Observation 20. We have . Further, for ,
Let . The recursions above give and . Hence, we obtain the following.
Observation 21. For , .
We next describe the two phases used in the induction. Let be the assignment on that gives value 1 to both of its variables. For , let be the assignment on that gives value 1 to
and value 0 to the remaining variables of . We say are in phase 0 if all their variables are 0, and in phase 1 if each is assigned according to .
Lemma 22. For every , and have the same flip parity on every variable. Starting in either phase on , applying either complete string therefore changes these layers to the other phase.
Proof. We prove by induction. The lemma statement is immediate for . For , each path variable occurs once and each variable of occurs three times. In both and , the three -blocks flip an odd number of times and every other - or -variable an even number of times. The three recursive substrings have, by induction, the same parity on lower layers. Hence, the net effect of these three is the same as the parity of one substring. The lemma then follows from all of the above together with the inductive hypothesis.
The dependency graph. We now characterize all (not necessarily maximal) improving flip sequences of via a directed graph . Intuitively, the vertices of represent occurrences of flips in , and not the variables, since a variable such as and may occur several times in . An edge in then represents that the flip at position must happen before the flip at position . In other words, encodes a partial order of the flips.
More formally, let , and . The vertices of are , which we interpret as positions in either or . For , let consist of the edge . For , we construct on as follows, with .

Figure 10: Recursive construction of , where . The vertices of are indices in ; the symbols inside the circles are the corresponding variables in , with the subscript suppressed. Each ellipse represents a shifted copy of , with only its unique source and sink displayed. The boxes are the paths corresponding to for , and to for .
-
For , if , we add the edge .
-
For , we add a copy of shifted by (i.e., for every edge of , we add the edge ).
-
We add the edges , , and , which correspond to the three cases from to in the recursion.
-
We add the edge for the following :
| r | s | ||
|---|---|---|---|
Here the superscript indicates the first, second, or third occurrence in (which is the same as in ).
See Fig. 10 for an illustration.
Lemma 23. The graph is acyclic, has unique source 1, and every vertex can reach .
Proof. All edges go from a smaller to a larger index, so is acyclic. The remainder of the statement follows by an easy induction on from the recursive construction.
All improving sequences. For , define
We use the following statement, which is formulated so that it applies both to the entire construction and to a lower-layer recursive block.
Lemma 24. Fix and . Suppose are in phase , and among the variables in these layers only is improving. Suppose further that the values of all neighbors of outside these layers remain fixed until flips. If , also suppose that the external neighbor of (i.e., when , and when ) has value and remains fixed until flips. Then all maximal improving flip sequences restricted to are exactly the strings obtained by labeling the linear extensions of with the entries of . After all flips have occurred, the layers are in phase .
Proof. We prove the statement by induction on . For , is the only improving variable by assumption. After it flips, Lemma 19(e) makes improving, and no variable of can improve again. Thus the unique improving sequence is , which is the unique linear extension of . The phase changes by Lemma 22.
Now let and assume the statement for . We follow the three recursive blocks in the definition of . At three points in the proof, two groups of flips can proceed independently. We call these groups branches: their flips may be interleaved, subject to the dependencies within each branch, but both branches must finish before the next flip outside them can occur. The flips within each branch must still respect the order specified below.
First branching stage. Initially, only is improving. By Lemma 19(a),(c), the flips , , are forced (i.e., one must happen right after another as there is no other improving flip). Note that no variable in has flipped during this flip sequence. Moreover, among the variables in these lower layers, only is adjacent to a variable whose value has changed: its preference is controlled by the outputs of the gadget for in . The external neighbor of has not changed, so every other variable in the lower layers retains its previous preference and hence remains non-improving. By Lemma 19(a),
Since the lower layers are still in phase , we have . Thus is improving, and it is the only improving variable in . The external neighbor of is , which still has value and does not flip before . Hence, the inductive hypothesis applies and yields exactly a linear extension of labeled by . No variable in becomes improving before the final flip of . Indeed, the only vertices of that are adjacent to the lower layers are , , and . By Lemma 19(a), the last two variables have their preferred values independent of the lower layers. Hence, the only possible new improving move in caused by flips in the lower layers is , and the change required at that vertex cannot occur before flips.
After the first recursive block, Lemma 19(b) forces , , , . At this point exactly and are improving: always prefers the value for , while for , since its two neighbors and disagree, . At this point, the sequence splits into two branches. The flip of affects only the preferences of and , and in the present configuration it makes neither of them improving. On the other hand, starting with forces , , . At that point the lower layers are in phase , the external neighbor of also has value , and the same XOR argument as above makes the only improving variable in the lower layers. Hence, the inductive hypothesis gives a linear extension of labeled by . The variable is adjacent to none of the variables in this branch, so its flip may be interleaved arbitrarily with it. When the second recursive block is complete, the next occurrence of is improving if and only if has already flipped; if not, is the only improving variable and must flip first. Thus, the possible interleavings are exactly those prescribed by the subgraph of on (i.e., the vertices on the path between the first occurrence of and the second occurrence of in Fig. 10).
Second branching stage. Once the second occurrence of has flipped, Lemma 19(b) forces and then . Now exactly and are improving: , because by Lemma 19(b); and , because its two neighbors and now disagree and hence by Lemma 19(d). Following a similar argument as before, we obtain two resulting branches that start with and . After the flips have occurred, the lower layers are in phase and the external neighbor of also has value . By the same argument as in the first recursive block, is then the only improving variable in . Hence, the inductive hypothesis applies and continues this branch with a linear extension of labeled by . The two branches are independent and hence may be interleaved arbitrarily, subject only to the displayed order within each branch and to the internal order of the recursive block. After the third recursive block, the next occurrence of is improving exactly when the branch has been completed; otherwise its unfinished suffix is forced first. Hence, both branches must be completed before the next flip of , as encoded in .
Final branching stage. After the third occurrence of , the flip of is forced. Then exactly and are improving. The resulting independent branches are and . They may again be interleaved arbitrarily, respecting the order in the first branch. By Lemma 19(f), becomes improving exactly after both branches have completed, and it is then the only improving variable. After flips, no variable in is improving.
The forced portions of the sequence give the consecutive top-layer dependencies in , while the three applications of the inductive hypothesis give its three copies of . Finally, the dependencies between branches account for exactly the six additional edges listed in the definition of . Hence, the possible improving flip sequences are precisely the strings obtained by labeling the linear extensions of with . Finally, Lemma 22 shows that after all flips, the layers are in phase .
Lemma 25. The map is a bijection between all linear extensions of and all maximal improving flip sequences of starting from the initial solution .
Proof. At , by Lemma 19, it is easy to check that only is improving. Moreover, the external second input of is and, by Lemma 19(e), it remains 0 forever. Hence, the hypotheses of Lemma 24 hold with and . It follows that all maximal improving flip sequences restricted to are exactly the linear extensions of labeled by the entries of .
By Lemma 19(e), and follow each other, while strictly prefers 0. Hence, they remain 0 forever. As a result, the maximal improving flip sequences restricted to are exactly the maximal improving flip sequences for . The lemma then follows.
Corollary 26. All maximal improving flip sequences of from have length and end at the same local optimum, namely the assignment in which every layer is in phase 1 and .
Consequently, we obtain the desired all-exp property.
Theorem 3. (2, 3, 2)-MCA with the flip neighborhood has the all-exp property.
Proof. The graph for has maximum degree three by construction. Hence, by Lemma 15, the constructed instance is a -MCA instance. Note that the instance has variables and each weight can be encoded by bits. By Corollary 26, every maximal improving sequence has length . The theorem then follows.
AI methodology
We obtained our three main results, Theorems 1 to 3, without the use of AI tools. We used ChatGPT 5.6 Sol and Claude Fable 5.1 to generate Python code for optimizing the weights and sizes of the constructions in our proofs; this yielded slightly simpler constructions but did not affect the statements of the results. All proofs were carried out by the authors, who take full responsibility for their correctness.
References
[Ben92] Jon Jouis Bentley. Fast algorithms for geometric traveling salesman problems. ORSA Journal on Computing, 4(4):387–411, 1992. doi:10.1287/ijoc.4.4.387.
[CKT99] Barun Chandra, Howard Karloff, and Craig Tovey. New results on the old k-opt algorithm for the traveling salesman problem. SIAM Journal on Computing, 28(6):1998–2029, 1999. doi:10.1137/S0097539793251244.
[Cro58] G. A. Croes. A method for solving traveling-salesman problems. Operations Research, 6(6):791–812, 1958.
[DM13] Dominic Dumrauf and Burkhard Monien. On the PLS-complexity of maximum constraint assignment. Theoretical Computer Science, 469:24–52, 2013.
[HH23] Hung P. Hoang and Stefan Hougardy. On the PLS-completeness of TSP/k-opt. Technical Report No: 231275, Research Institute for Discrete Mathematics, University of Bonn, 2023.
[HHH24] Sophia Heimann, Hung P. Hoang, and Stefan Hougardy. The k-opt algorithm for the Traveling Salesman Problem has exponential running time for . In 51st International Colloquium on Automata, Languages, and Programming (ICALP 2024), volume 297 of LIPIcs. Leibniz Int. Proc. Inform., pages 84:1–84:18. Schloss Dagstuhl. Leibniz-Zent. Inform., Wadern, 2024. doi:10.4230/lipics.icalp.2024.84.
[HHH26a] Sophia Heimann, Hung P. Hoang, and Stefan Hougardy. Exponential local search in bounded-occurrence MAX-CSP. arXiv:2610.16898v1 [cs.DS], 2026. doi:10.48550/arXiv.2610.16898.
[HHH26b] Sophia Heimann, Hung P. Hoang, and Stefan Hougardy. A near-complete resolution of the exponential-time complexity of k-opt for the traveling salesman problem. In Proceedings of the 2026 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 5861–5885, 2026. doi:10.1137/1.9781611978971.208.
[JM97] David S. Johnson and Lyle A. McGeoch. The traveling salesman problem: a case study. In Emile Aarts and Jan Karel Lenstra, editors, Local Search in Combinatorial Optimization, chapter 8, pages 215–310. Wiley, 1997.
[JM02] David S. Johnson and Lyle A. McGeoch. Experimental analysis of heuristics for the STSP. In Gregory Gutin and Abraham P. Punnen, editors, The traveling salesman problem and its variations, chapter 9, pages 369–443. Kluwer Academic Publishers, 2002.
[JPY88] David S. Johnson, Christos H. Papadimitriou, and Mihalis Yannakakis. How easy is local search? Journal of Computer and System Sciences, 37(1):79–100, 1988.
[Kaz20] Artem Kaznatcheev. Algorithmic Biology of Evolution and Ecology. PhD thesis, Oriel College, University of Oxford, 2020.
[KCJ20] Artem Kaznatcheev, David A. Cohen, and Peter G. Jeavons. Representing fitness landscapes by valued constraints to understand the complexity of local search. Journal of Artificial Intelligence Research, 69:1077–1102, 2020. doi:10.1613/jair.1.12156.
[Kre89] Mark W. Krentel. Structure in locally optimal solutions. In 30th Annual Symposium on Foundations of Computer Science, pages 216–221. IEEE Computer Society, 1989.
[KVA25] Artem Kaznatcheev and Sofia Vazquez Alferez. Greed is slow on sparse graphs of oriented valued constraints. In Maria Garcia de la Banda, editor, 31st International Conference on Principles and Practice of Constraint Programming (CP 2025), volume 340 of Leibniz International Proceedings in Informatics (LIPIcs), pages 18:1–18:13. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2025. doi:10.4230/lipics.cp.2025.18.
[Lue75] George Lueker. Notes on two-changes. Unpublished, Princeton University, 1975.
[MS23] Lukas Michel and Alex Scott. Superpolynomial smoothed complexity of 3-FLIP in Local Max-Cut. arXiv:2310.19594v3 [cs.DS], 2023. arXiv:2310.19594.
[MT10] Burkhard Monien and Tobias Tscheuschner. On the power of nodes of degree four in the local max-cut problem. In Tiziana Calamoneri and Josep Diaz, editors, Algorithms and Complexity, volume 6078 of Lecture Notes in Comput. Sci., pages 264–275. Springer Berlin Heidelberg, 2010. doi:10.1007/978-3-642-13073-1_24.
[SS09] Alexander D. Scott and Gregory B. Sorkin. Polynomial constraint satisfaction problems, graph bisection, and the Ising partition function. ACM Trans. Algorithms, 5(4):Art. 45, 27, 2009. doi:10.1145/1597036.1597049.
[SY91] Alejandro A. Schäffer and Mihalis Yannakakis. Simple local search problems that are hard to solve. SIAM Journal on Computing, 20(1):56–87, 1991.