Integration of Structural Constraints into TSP Models

. Several models based on constraint programming have been proposed to solve the traveling salesman problem (TSP). The most eﬃ-cient ones, such as the weighted circuit constraint (WCC), mainly rely on the Lagrangian relaxation of the TSP, based on the search for spanning tree or more precisely ”1-tree”. The weakness of these approaches is that they do not include enough structural constraints and are based almost exclusively on edge costs. The purpose of this paper is to correct this drawback by introducing the Hamiltonian cycle constraint associated with propagators. We propose some properties preventing the existence of a Hamiltonian cycle in a graph or, conversely, properties requiring that certain edges be in the TSP solution set. Notably, we design a propagator based on the research of k -cutsets. The combination of this constraint with the WCC constraint allows us to obtain, for the resolution of the TSP, gains of an order of magnitude for the number of backtracks as well as a strong reduction of the computation time.


Introduction
The traveling salesman problem (TSP) is an NP-Hard problem. It has many applications and has been motivated by concrete problems, such as school bus routes, logistics, routing, etc. Almost all types of resolution methods (MIP, SAT, CP, evolutionary algorithms, etc.) have been used to solve it. When the graph is Euclidean, the most efficient program is the Concorde software [1]. Unfortunately, it cannot deal with additional constraints that are very present in realworld problems such as Pickup & Delivery, Dial-a-Ride, automatic harvesting, etc.
Solving the TSP is difficult since it involves finding a single cycle passing through all the vertices of a graph such that the sum of the costs of the edges it contains is minimal. It is quite easy to model the fact that each vertex belongs to a cycle. Indeed, it is sufficient that each vertex has at least two distinct neighbors, in other words, each vertex must be the end of at least two edges. Such a result can be obtained by modeling the problem as an assignment problem, which is solved in polynomial time. However, this model is not sufficient to obtain a single cycle in the graph, because the assignment corresponds to a coverage of the vertices by a set of disjoint cycles. From this model, we obtain solutions where each vertex belongs to a cycle, but not to a unique cycle. The covering by a unique cycle can be achieved by imposing that the subgraph generated by the selected edges is connected. The combination of these two aspects is what makes the TSP so difficult.
Unlike the previous approach, a model can be built based on the notion of a connected subgraph. It was exactly the idea of Held and Karp [7,8] who represented this notion by a 1-tree that is formed by a node x, two adjacent edges of x and a spanning tree of the graph without x. A 1-tree such that each node has a degree 2 is a Hamiltonian cycle, and a minimum 1-tree with these constraints is an optimal solution of the TSP. The use of a 1-tree is interesting because a minimum 1-tree is a good lower bound of the TSP. In addition, its computation is strongly related to the computation of a minimum spanning tree.
Held and Karp proposed to relax the degree constraints with a Lagrangian relaxation. More precisely, the cost of the edges are modified in order to integrate the violation of these degree constraints. If a node has a degree strictly greater than 2, then the cost of its adjacent edges are decreased, and if the degree is strictly less than 2 then the cost of its adjacent edges are increased. A convergence towards the optimal solution is obtained by computing a succession of minimum 1-tree based on the Lagrangian relaxation.
The weighted circuit constraint (WCC) [2] implements the approach in constraint programming. This constraint can be considered as the state of the art in CP as mentioned by Ducomman et al. [4]: "The best approach regarding the number of instances solved and quality of the bound is the Held and Karp's filtering".
In this paper, we propose to improve the WCC by adding methods for solving Hamiltonian cycles (i.e. TSP without costs). To do this, we consider the work of Cohen and Coudert [3] on the structure of the Hamiltonian cycles carried out for the FHCP Challenge [6]. Fig. 1 shows an example in which the structure of the graph is important for the Hamiltonian cycle search. There is no Hamiltonian cycle in this graph, because it is impossible to find a cycle that visits all the vertices that pass only once through node C. Such a graph is said to be 1connected: there is a vertex in the graph such that its removal disconnects it. We can therefore define a new structural constraint: if a graph is 1-connected, then it does not contain a Hamiltonian cycle. This idea can be extended to edges. For instance, consider two edges a 1 and a 2 whose deletion disconnects the graph (i.e. it is 2-edge-connected). If there exists an Hamiltonian cycle then it necessarily contains a 1 and a 2 . We propose to study k-edge-connected graphs for k > 1, and in particular values k = 2 and k = 3, which are common in practice. From this study, we defined a general filtering algorithm named k-cutset propagator.
This article is organized as follows: first, we recall some concepts of graph theory. Then, we formally define the structural constraints used in our method of solving the TSP. Next, we define a new data structure called cycled spanning tree, which is used to define a new algorithm to exploit structural constraints. The last part experimentally shows the advantages of our method. Finally, we conclude.

Definitions
The definitions about graph theory are taken from [12].
A directed graph or digraph G = (X, U ) consists of a vertex set X and an arc set U, where every arc (u, v) is an ordered pair of distinct vertices. We will denote by X(G) the vertex set of G and by U (G) the arc set of G. The cost of an arc is a value associated with the arc. An undirected graph is a digraph such that for each arc (u, v) ∈ U , (u, v) = (v, u). If G 1 = (X 1 , U 1 ) and G 2 = (X 2 , U 2 ) are graphs, both undirected or both directed, . The path is simple if all its nodes are distinct. The path is a cycle if k > 1 and v 1 = v k . A cycle is Hamiltonian if [v 1 , ..., v k−1 ] is a simple path and contains every vertex of X. The length of a path p, denoted by length(p), is the sum of the costs of the arcs contained in p. For a graph G, a solution to the traveling salesman problem (TSP) in G is a Hamiltonian cycle HC ∈ G minimizing length(HC). An undirected graph G is connected if there is a path between each pair of vertices, otherwise it is disconnected. The maximum connected subgraphs of G are its connected components. A k-edge-connected graph is a graph in which there is no edge set of cardinality strictly less than k disconnecting the graph. A tree is a connected graph without a cycle. A tree T = (X , U ) is a spanning tree of G = (X, U ) if X = X and U ⊆ U . The U edges are the tree edges T and the U − U edges are the non-tree edges T . A bridge is an edge such that its removal increases the number of connected components. A partition (S, T ) of the vertices of G = (X, U ) such that S ⊆ X and T = X − S is a cut. The set of edges (u, v) ∈ U having u ∈ S and v ∈ T is the cutset of the (S, T ) cut. A k-cutset is a cutset of cardinality k. A k-cutset is minimum iff there is no subset of the k-cutset that disconnects the graph.

HCWME : Hamiltonian cycle with mandatory edges
CP-based algorithms solving the TSP tend to: • Eliminate edges that cannot be part of the optimal solution. • Define edges belonging to any optimal solution, called mandatory edges. Since each optimal solution of the TSP is a Hamiltonian cycle, the TSP solution set is a subset of the solutions of the Hamiltonian cycle problem (HCP).

Structural constraints
We will use the following notations G = (X, U ), n = |X|, m = |U |, M ⊆ U the set of mandatory edges of G, P = HCMWEP(G, M ). When not specified we will assume that G is symmetrical, connected and that a k-cutset is minimum. Proposition 1. Let K be a k-cutset, then any Hamiltonian cycle C contains an even and strictly positive number of edges from K.
Proof. Consider a k-cutset of G and C a hamiltonian cycle. The k-cutset partition G into two sets of vertices X 1 and X 2 . Let u be our starting vertex in X 1 , by definition C visits all the vertices of G and ends up visiting u (its starting vertex). Thus, visiting the vertices of X 2 involves taking one edge of the k-cutset and taking a different one to come back into X 1 , at that moment: either all the vertices of X 2 have been visited and we end up joining u without using other edges of the k-cutset, or we have to visit X 2 again and return to X 1 , every time we visit X 2 from X 1 we need an edge to go in, and another to go back: this means an even number of edges and the proposition holds.
From Proposition 1, we define Properties 3, 4, 5, 6 and 7.  Property 5. If there is a k-cutset with k even containing k − 1 mandatory edges in G, then the non-mandatory edge a becomes mandatory: M ← M + {a}. Property 6. If there is a 1-cutset in G, then P has no solution.
Property 7. If there is a k-cutset with k odd containing k mandatory edges in G, then P has no solution.
Definition 1. It is said that two problems P and P are equivalent if their solution sets are in bijection. We then note that P = P . Corollary 1. Given P = P. If one or more of Properties 3, 4, 5, 6 or 7 are applied to P, then P and P remain equivalent.
We write a * ∈ U a mandatory edge. From Properties 3, 4 and 5, we can remove some edges from Fig. 2 and make them mandatory: • {a 4 , a 5 } is a 2-cutset: if we want to connect the "left" part of H and I to the "right" part of J and K by a cycle we must take (H,J) and (I,K) so a 4 and a 5 become mandatory.
it is a cutset with an odd cardinality with an even number of mandatory edges. Then we can delete a 3 , because by choosing it the cutset would become a mandatory set of edges with an odd cardinality.
• {a * 6 , a * 7 , a * 8 , a 9 } is a 4-cutset and with {a * 6 , a * 7 , a * 8 } mandatory: it is a cutset with an even cardinality with 3 mandatory edges, so a 9 must be mandatory.  • {a * 1 , a * 2 , a * 3 } forms a 3-cutset with three mandatory edges. Properties 3, 4, 5, 6 or 7 are based on the cardinality of the cutsets, so it is reasonable to ask how many cutsets a graph can have. Proof. Any part S ⊆ X forms an (S, T ) cut. The cardinality of the powerset of S ⊆ X is 2 n , so there are 2 n cutsets.
In the case of the undirected graph, an (S, T ) cut has the same cutset as the (T, S) cut. Hence, the number of distinct cutsets is 2 n /2 = 2 n−1 .
In the case of a very dense graph, there is a low probability of satisfying Properties 3, 4, 5, 6 or 7 for a small value of k. Nor does it seem very reasonable to apply these properties with a high value of k for at least two reasons: • The complexity of the algorithms of k-cutset increases with k because they are enumeration algorithms [14].
• The relationship between the cardinality of the cutset and the number of mandatory edges is strong. The more k increases and the less chance we have of satisfying one of Properties 3, 4, 5, 6 or 7.
Consequently, we propose to study k =1, 2 and 3 with the following behaviors: • 1-cutsets: raise a fail. • 2-cutsets: make the edges of the 2-cutset mandatory. • 3-cutsets: consider only the 3-cutsets with at least 2 mandatory edges. If it contains a non-mandatory edge, then it must be removed, otherwise a fail is raised.

k-cutset Propagator
We must be able to find the k-cutsets with k = 1, 2, 3 and two mandatory edges for k = 3. If we split the problem, finding the 1-cutset, which are actually bridges, can be done with the Tarjan algorithm [11] in O(m + n); finding 2-cutset can be done with the Tsin algorithm [13] in O(m + n). The strength of Tsin's algorithm is that it also allows us to find bridges, so we can manage k = 1, 2 at the same time. We now have to manage k = 3 with at least two mandatory edges.
By the cut definition, if you remove a k-cutset edge, then it becomes a (k − 1)-cutset. We can then propose a first simple algorithm: For each mandatory edge a * ∈ M , we look for the 2-cutsets of G − {a * }. In this way, each of the 2-cutset found forms a 3-cutset with at least one mandatory edge. It is then sufficient to keep only the 3-cutsets with 2 mandatory edges.
The number of considered mandatory edges can be reduced. To do this, we will build a special structure called CST. The CST is not a required structure for the proper functioning of the k-cutset propagator, just an improvement.

CST : Cycled Spanning Tree
A CST is a 2-edge-connected subgraph of G such that for each edge a of G there is a cycle in G formed only by edges of the CST and a.
One way to build a CST is to calculate T a spanning tree, then add some edges to T until all the edges, those of T and those outside of T , belong to a CST cycle. Any edge a ∈ T belongs to a cycle composed of a and only T edges.
For the edges of T , the CST is built by adding edges to the spanning tree such that each tree edge belongs to a cycle of CST. This can be done in linear time by marking the tree edges each time a cycle is found. More precisely, we consider three graphs at the same time: G the graph, T the spanning tree, and CST the CST, initially equal to T . All tree edges are unmarked. We traverse the non tree edges of G until we find a T = (i, j) / ∈ T such that there is a cycle formed by at least an unmarked edge of T , some edges of T and a T . We add a T to CST and we mark all the tree edges of C. We repeat this operation until there is no more unmarked edge in T . Clearly, at the end, each tree edge which has been marked belongs to a cycle. In addition, there is at least one tree edge in each cycle, so the number of added edges is bound by n. An example of a construction is shown in Fig. 5. This algorithm can be efficiently implemented, similarly to Kruskal's algorithm, by using a union-find data structure to avoid traversing each edge of each cycle. If we consider first the non mandatory edges for the construction of the spanning tree and for the construction of the CST, then we can expect to reduce the number of mandatory edges in the CST.
W.l.o.g. we assume that G is a connected bridgeless graph. Thus, there exist a CST in G.  Proof. By construction, the CST is connected and covers the graph with cycles. So each cut has a cardinality greater than or equal to two. Corollary 3. If there is a 3-cutset containing at least two mandatory edges, then at least one mandatory edge belongs to the CST.
Definition 2. The identification edges are the mandatory edges for which a 2-cutset algorithm is run.
From Corollary 3, the simple algorithm can be improved by reducing the number of mandatory edges that are considered. Considering the identification edges as each mandatory edge a * of CST, the algorithm becomes: for each identification edges, search for the 2-cutsets of G − {a * }. For each 3-cutset found, we obtain either a 3-cutset with three mandatory edges, or a 3-cutset with two mandatory edges or a 3-cutset with one mandatory edge. Then, we apply Properties 3, 4, 5, 6 and 7.
Since mandatory edges outside the CST are not considered as identification edges and the edges in the CST are chosen during construction, it is a good idea to minimize the number of mandatory edges in the CST.

Additional improvement
The proposed algorithm is highly dependent on the number of identification edges. From Corollary 2, if two edges belong to the same 2-cutset and are mandatory, then they are identification edges. However, when searching for the 3-cutsets with an identification edge, it is not necessary to repeat the search for all the edges forming a 2-cutset with it. More precisely, the problem of searching for 3-cutsets with a * as an identification edge has the same set of solutions as the problem of searching for 3-cutsets with each of the edges forming a 2-cutset with a * . Fig. 6 illustrates it well since the 2-cutset is a path.  Property 9. Let S 1 be a k-cutset and S 2 be a 2-cutset such that k > 1 and S 2 ⊆ S 1 . If ∃a ∈ S 1 such that a ∈ S 2 then (S 1 ∪ S 2 ) − {a} forms a k-cutset.
Proof. Given S 2 = {a 1 , a 2 } a 2-cutset and a 1 ∈ S 1 . Removing S 1 from the graph disconnects it into two connected components. In the modified graph, Removing a 2 further increases the number of connected components: there are now three. If we put back a 1 , G is disconnected into two connected components, its cutset is ( there is no subset of it that disconnects the graph other than the k-cutset itself. If (S 1 ∪ S 2 ) − {a 1 } disconnects the graph then it is a k-cutset because we delete and add an edge in a set of initial cardinality k.
Consider S 1 a 3-cutset, S 2 = {a 1 , a 2 } and S 3 two distinct 2-cutsets. From Property 9 the number of identification edges is reduced: Thus, the set of identification edges is defined by the mandatory edges of the CST that do not belong to any 2-cutset and the subset of edges belonging to all 2-cutsets of G that maximizes its cardinality such that there is no combination of it forming a 2-cutset.
To avoid any inconsistency, all 2-cutsets must be searched before performing the 3-cutset search. Otherwise, there may be a 2-cutset containing at least one non-mandatory edge. This may result in a edge being marked as removable when searching for 3-cutsets while it is necessary for the existence of a Hamiltonian cycle. In addition, deleting an edge in a 3-cutset may create a 2-cutset and so either we perform a 2-cutset search immediately or we wait until the end of the search of all 3-cutsets to make the deletions effective. The first possibility is too time-consuming, a better solution is to postpone the deletions.
With this method we consider a subset of the identification edges. The higher the mandatory number of edges required, the more likely it is that the number of edges considered will be reduced.
Finally, CST has another advantage: it is incremental. Indeed, as long as no CST edges are removed, all edges outside the CST belong to a cycle composed of CST edges, so there is no need to rebuild it.

Implementation
Algorithm 1 is a possible implementation of the k-cutset filtering. The main function is propagKCutset(G,M). Function propag2Cutset(G, M, set) defines a 2-cutset filtering. Function propag3Cutset(G, M, a * ) defines a 3-cutset filtering. Both filtering functions use find2Cutset(G, bridge, 2cutsandF ound) which finds all 2-cutsets in G as proposed in [13] with a complexity in O(n + m), this function is used as a black box. Filtering functions also have two subfunctions, bridge() and 2cutsetFound(M,a 1 ,a 2 ) describing the behavior that the find2Cutset(G, bridge, 2cutsetF ound) algorithm must have when it finds a bridge or a 2-cutset in G. Function mergeCutpairs(S, set, id) allows the use of the improvement proposed in section 4.2. We will now describe the overall behavior of the algorithm. In Function propagKCutset(G, M ), we define set as a set of pairs of edges forming 2-cutsets in G. Then, we use the filtering propag2Cutset(G, M, set) to find and make mandatory all the edges belonging to a 2-cutset in G, the 2-cutsets are stored in set. The id array represents for each edge its 2-cutset identifier. In order to create sets of edges forming 2-cutsets between them Function mergeCutpairs(S, set, id) is called. Each disjoint set will finally have a different identifier and each edge belonging to the same set will have the same identifier. Then, we define an array visited to allow us to consider only one edge per set described above. The identif icationEdges set contains the mandatory edges which are in the CST. Then, we consider one edge per set calculated by mergeCutpairs(S, set, id) and all the edges of the CST not being in any set. For each of its edges, the filtering propag3Cutset(G, M, a * ) is performed, i.e. the Properties 4, 5 and 7 are used. As recommended in section 4.2, deletions are postponed. The final complexity of the Algorithm 1 is O(k * (n+m)) where k <= |M | <= n. Tsin's algorithm (O(n + m)) is called k times.

Experiments
The algorithms are implemented in Java 11 in a locally developed constraint programming solver. The experiments were performed on a Windows 10 machine using an Intel Core i7-3930K CPU @ 3.20 GHz and 64 GB of RAM. The reference instances are from the TSPLib [9], a library of reference graphs for the TSP. For fairness, we naturally took up the instances given by the state of the art [5]. All instances considered are symmetrical graphs. We present the results in tables. Each of them reports the solving time in milliseconds. Timeout (t.o) is set at 30 minutes. The number of backtracks is denoted by #bk. Tables include a column expressing the ratio of solving time and number of backtracks.  Table 1 shows the performance of adding k-cutset filtering to the WCC. This table is composed of three main columns (1, 2 and 3) showing the following results respectively: WCC without k-cutset filtering, WCC with k-cutset filtering Surprisingly, Table 2 shows that the k-cutset filtering is not interesting for the LCFirst maxCost strategy. The fact is that for the selected instances, the geometric mean of the solving times increases from 6788ms to 11559ms when k-cutset filtering is used. From our experiments, the strategy seems very ad hoc in regards to the propagator of the WCC constraint and in particular to the Lagrangian relaxation. It seems to partially correct the lack of structural Table 3 underlines the interest of using a structural filtering such as the kcutset filtering. In comparison to the state of the art, we reduced the size of the search space for most instances by a very significant factor in order to obtain an improvement in solving time. There is a huge gain (solving time improved by 23.4) for the problem brg180. If we exclude this problem we improve the mean of the solving times by a factor of 1.5 and the mean of the number of backtracks by a factor of 3.6. The number of backtracks is reduced for each instance. The solving time is improved for 92% of the instances.
Note that the interaction of the k-cutset filtering with Lagrangian relaxation is not clear (the WCC is built around Lagrangian relaxation), a more in-depth study will have to be conducted to better understand it. Adding filtering can then disrupt the convergence of the latter and sometimes slow it down [10]. This explains why the gain factor of the number of backtracks is always much higher than that of the solving time.

Conclusion
We introduced a new structural constraint in the WCC based on the search for k-cutsets in the graph. The experimental results show the interest of our approach in practice. We observed that the number of backtracks is reduced by an order of magnitude depending on the chosen strategy and resolution times are significantly improved. The interactions between this constraint and the research strategy, as well as between this constraint and the Lagrangian model of the WCC, deserve further study.