Clustering Approach For Solving Traveling Salesman Problems Via Ising Model Based Solver
Clustering Approach For Solving Traveling Salesman Problems Via Ising Model Based Solver
Probability
using the Ising model-based solver, both the execution speed 0.6
and the quality of solutions deteriorate significantly due to
the quadratically increasing spin counts and strong constraints 0.4
placed on the spins. In this paper, we propose a recursive
clustering approach that accelerates the calculations of the Ising 0.2
model and that also helps to obtain high-quality solutions.
Through evaluations using the TSP benchmarks, the qualities 0.0
with the proposed method have been improved by up to 67.1% 6 7 8 9 10 11 12 13
The number of vertices
and runtime were reduced by 73.8x. Fig. 1. The probability of finding an optimal solution using the Ising model
solver for different sizes of TSPs.
I. I NTRODUCTION
Since combinatorial optimization problems are abundant
in the real world, development of efficient solvers for such spins, which represent the city number and visiting order.
problems is important. In general, due to the combinatorial The interconnections between spins expresses the constraints
explosion of the search space, it is difficult to find exact and distance. The objective function is formulated as the
solutions to those optimization problems as the problem size summation of the distances along the route and the number of
increases. To address these problems, various approaches have constraint violations. However, there are several issues when
been proposed [1]–[3]. using this setup. First, the graph becomes quadratically large
Ising model-based solvers [4]–[6] have recently attracted in terms of node and edge counts, thus making it difficult
increased attention as efficient methods for finding approxi- to implement when using hardware that physically places
mate solutions to combinatorial optimization problems. The nodes as flip-flops and routes the wires with the weights
Ising model is a mathematical model, which is commonly representing the interactions between the nodes. Second, most
used in statistical mechanics to simulate the properties of of the solutions given by the Ising model fail to satisfy the
ferromagnetism [7]. In the Ising model-based solvers, a spin constraints when the solution quality is addressed. Alterna-
having one of two states, either {+1, −1} is connected to tively, if the constraint term is emphasized, the solution quality
adjacent spins with interactions. Two procedures for each will significantly deteriorate. Furthermore, as long as naive
spin are alternatively carried out to find the spin states that Ising model solvers are used, the probability of obtaining an
minimize the total energy of the system: 1) a deterministic optimal solution is very low for TSPs of any useful size. Fig. 1
state transition called annealing that lowers the local energy shows the probability of finding the optimal solution using a
of a spin calculated by the interaction with adjacent spins, naive Ising model-based solver. For problems larger than 12
and 2) a stochastic state transition called random flip that cities, it is nearly impossible to obtain an optimal solution,
inverts the states of randomly selected spins to help escape and even a satisfactory solution is not possible for problems
from local minima. Various Ising model-based solvers have that involve more than 30 cities. For this reason, there is not
been proposed thus far, such as quantum annealing computers much published work reporting on the applications of Ising
and CMOS annealing machines [8]–[10]. model-based solvers for such strongly constrained problems
The traveling salesman problem (TSP) is a well-known such as the TSP.
combinatorial optimization problem. In the TSP, we find the In this paper, we propose an efficient algorithm for solv-
route with the lowest total travel cost for visiting all cities ing TSPs via the Ising model-based solver. Starting from a
once, given the distance between the cities. The TSP can be coarse outline, the travel route is refined by a hierarchical
applied to a wide range of problems such as printed circuit application of clustering and Ising-based optimization. More
board wiring, transportation route planning, scheduling, and specifically, the vertices are clustered to limit the visiting order
protein structure analysis. The development of solvers that of the vertices, and thereby eliminates the spins and their
obtain high-quality approximate solutions has continued in interactions. With this preprocessing approach, the probability
terms of both hardware and software [11]–[13]. of obtaining solutions that satisfy the constraints is improved
When solving TSPs using the Ising model-based solver, and the solution quality is also improved. Our contributions
n-cities are modeled by a lattice-like graph that uses n2 are summarized as follows.
Authorized licensed use limited to: Shanghai Jiaotong University. Downloaded on February 26,2023 at 09:10:24 UTC from IEEE Xplore. Restrictions apply.
𝑢 H Spin update Algorithm 1 Annealing
1: Initialize spin randomly.
2: T ← Ts
𝑙 𝑖 𝑟 3: while ⌊n2 T + 0.5⌋ > 0 do
4: NRF ← ⌊n2 T ⌋
Random flip
𝑑 5: Do random flip.
Solution space 6: Select ⌊n2 R⌋ spins randomly (σ1 , σ2 , · · · , σ⌊n2 R⌋ ).
Fig. 2. Typical structure of the Fig. 3. Optimization by annealing 7: for z = 1 to ⌊n2 R⌋ do
Ising model. with random flip. 8: σz ← argmin H( σz )
9: end for
10: T ← αT
• We propose a novel clustering-based algorithm that sig- 11: if H < HBest then
nificantly reduces both the number of spins and interac- 12: HBest ← H
tions for solving the TSP. This significantly increases the 13: SBest ← S
size of tractable problems for Ising model-based solvers. 14: end if
• We propose a hierarchical application of the Ising model- 15: end while
based solver to obtain coarse to fine-grained solutions, 16: Output spin state SBest as solution.
thereby accelerating the calculations.
The rest of this paper is organized as follows. In Sec. II, the
preliminary steps for applying the Ising model solver to TSP
2) Annealing with random flip: Fig. 3 shows a conceptual
are explained. Then, Sec. III describes the proposed clustering-
picture of the optimal solution search by annealing and random
based method. Sec. IV evaluates the proposed method com-
flips. In annealing, the search is performed by the local energy
pared with the existing methods. In Sec. V, the conclusions
minimization of each spin using Eq. (1). This critical action
of this paper are presented.
is called spin update.
II. BACKGROUND Annealing is performed according to Alg. 1, where temper-
A. Ising model-based solver ature T represents the ratio of spins inverted in random flips,
A part of a two-dimensional Ising model is depicted in Ts is the initial temperature, R is the update coefficient that
Fig. 2. The spins, each having either an upward (+1) or represents the ratio of spins updated, α is the cooling rate of
downward (−1) state, are arranged in a lattice-like form. the temperature to reduce the ratio of the number of spins
Through interactions with adjacent spins and combined with selected by random flips, and HBest and SBest are the best
the external bias for each spin, the local energy of spin i is result and its spin state, respectively.
expressed as: Although the spin updates decrease the local energy, it
∑ is highly likely that the local energy will fall into a local
Hi (σi ) = − Jij σi σj − hi σi , (1) minimum from the total energy standpoint. In order to help
j∈{u,d,r,l} the model to escape from a local minimum, it is necessary to
temporarily increase the energy. For that purpose, Ising model
where j ∈ {u, d, r, l} is the subscripts of the adjacent spins,
based solvers occasionally execute random flip, in which the
σi , σj ∈ {−1, +1} are the spin values, Jij is the interaction
values of randomly selected spins are inverted. By gradually
between spins i and j, and hi is the external magnetic field
reducing the number of spins, the spin states in the model
(bias) applied to spin i.
converge to the global minimum value.
The total energy of the Ising model is expressed as shown
in Eq. (2) as the sum of all spin energies. 3) Interpretation: Interpret the all the spin states and con-
∑∑ ∑ vert them backward to the solution of the original problem.
H=− Jij σi σj − hi σi (2)
i j i B. Solving the TSP using the Ising model-based solver
Minimization of the total energy is achieved by updating each TSPs are combinatorial optimization problems that find the
spin in the direction that lowers its energy. The spin energy smallest sum of weights (distance) in a circuit that passes
evaluations through the interactions with adjacent spins can through all vertices in a graph once. A n-vertices TSP is
be carried out in parallel. Hence, the total energy of the Ising formulated as:
model can be minimized very efficiently with a hardware ∑∑
implementation. minimize Wkl aik a(i+1)l
In general, solving a combinatorial optimization problem k̸=l i
∑ ∑
using the Ising model-based solver proceeds in the following subject to ∀i, aik = 1, ∀k, aik = 1, aik ∈ {0, 1}.
steps, Mapping, Annealing with random flip, and Interpreta- k=1 i=1
tion [14]. (3)
1) Mapping: The formulated combinatorial optimization The variable aik represents that vertex k is (is not) visited as
problem is transformed into the form of Eq. (2) [15]. The the i-th city when aik = 1(0). Wkl represents the weight (or
mapping of the TSP is described in detail in the next subsec- distance) between vertices k and l. Since the total number of
tion. possible routes is (n − 1)!/2, it is currently difficult to obtain
Authorized licensed use limited to: Shanghai Jiaotong University. Downloaded on February 26,2023 at 09:10:24 UTC from IEEE Xplore. Restrictions apply.
its optimal solution by brute force methods in a realistic time → Vertex
A B C D E F
↓ Order
frame as n becomes larger. 1
1) Mapping: In this paper, without loss of generality, we E 2
assume two-dimensional Cartesian coordinates are given for
D
n vertices (cities) in the TSP. We explain a mapping for C
3
If we consider the energy function of the quadratic, uncon- Fig. 4. Ising spins in conventional mapping.
strained binary optimization (QUBO) format [16] using this
binary variable, the TSP is expressed by:
∑∑ fully connected by the links to all spins in the same row
H = A Wkl aik a(i+1)l σi∗ , to those in the same column σ∗,k , and those in the
k̸=l i upper and lower rows σi−1,∗ and σi+1 (the row numbers
∑∑ ∑∑ are wrapped around for the circuit to close). Hence, mapping
+ B ( aik − 1)2 + C ( aik − 1)2 . (5)
using hardware becomes very difficult as n becomes larger.
i k k i
The minor embedding is also known as NP-hard [18] and is
The first term represents the total weight of the circuit, which thus difficult to apply.
is the objective function. The second term is a constraint that 2) Random flip for TSP: According to the definition of
represents a penalty for visiting multiple vertices ∑as the i-th random flips in the Ising model, the spins are randomly
visit, which takes a minimum value of 0 when k aik = 1. selected and their values are inverted [9]. The number of
The third term is also a constraint representing the penalty for selected spins is gradually reduced as annealing is repeated.
∑ k twice or more, and takes the minimum
visiting the vertices During these procedures, random flips bring the spins to a
value 0 when i aik = 1. A, B, and C are hyperparameters state that does not satisfy the constraints in Eqs. (8) and (9).
of positive values, which balance the relative strength of the In order to cause the spins to satisfy the constraints, we assign
objective function and the constraints [17]. heavier weights for HB and HC . In that case, the constraints
Here, using Eq. (6), aik ∈ {0, 1} is converted to Ising model may be satisfied but the solution obtained deteriorates. If the
spin σik ∈ {−1, 1}. hyperparameters for the constraints are weakened, we may end
σik + 1 up with no solution that satisfies the constraints.
aik = (6) 3) Interpretation: After repeating annealing with random
2
flips, the spin states will be interpreted as the solution for the
Then, the first, second, and third terms of Eq. (5) are repre-
TSP. The legal solution corresponds to the states in which
sented as follows, respectively.
for all rows and all columns, there is only one spin that is
A ∑∑ A ∑∑ valued at 1, and those of other spins are all −1. According
HA = Wkl σik σ(i+1)l + Wkl σik +const.
(7)
4 2 to the definition, σik = 1 can be interpreted as “k-th vertex
k̸=l i k̸=l i
is the i-th city to visit.” Note that the illegal solutions that
B ∑∑∑ n − 2 ∑∑ do not satisfy any of the constraints are practically useless.
HB = σik σil + B σik +const.(8)
4 i 2 i Due to the use of n2 spins, finding a good hyperparameter set
k l k
C ∑∑∑ n − 2 ∑∑ that gives the allowed solutions is difficult as it contradicts the
HC = σik σjk + C σik +const.(9) parameters that improve the quality of the solutions.
4 i j
2 i
k k
III. H IERARCHICAL I SING M ODEL S OLVER
In Eqs. (7),(8), and (9), the first term is the interaction between
spins, the second term is the bias applied to the spin, and the A. Key Concept
third term is a constant that can be ignored in minimization. In the conventional Ising model-based solvers, the solutions
Thus, Eq. (10) is the energy function when solving the TSP that are both legitimate and of high quality are increasingly
via the Ising model-based solver. difficult to obtain as the size of the problem becomes larger.
To alleviate this issue, we propose a hierarchical clustering
H = HA + HB + HC (10)
approach.
As shown in Fig. 4, Eq. (10) is represented by n × n spins We consider TSPs, Vp = {vp,1 , vp,2 , . . . , vp,np }, where vp,k
that are arranged in a lattice form. By comparing Eq. (2) is a coordinate of the vertices and p distinguishes the TSPs in
and Eq. (10), the interactions between spins and the bias different hierarchies. The number of the vertices is np for the
of each spin are determined. Typically, for hardware-based TSP of the p-th hierarchy.
Ising model-based solvers, the number of interactions that can As shown in Fig. 5, the proposed method is divided into
be coupled to a spin is limited due to routing congestion. two phases, hierarchical vertex clustering and incremental
When an n-vertex TSP is mapped, the number of spins is annealing. Starting from the original problem V0 , the vertices
n2 . In addition, it is also as shown in Fig. 4; a spin σik is are recursively clustered to reduce the number of nodes. After
Authorized licensed use limited to: Shanghai Jiaotong University. Downloaded on February 26,2023 at 09:10:24 UTC from IEEE Xplore. Restrictions apply.
Algorithm 2 Optimization with Hierarchical clustering Hierarchical vertex clustering
1: Set K1 , K2 , . . . , Km (K1 > K2 > · · · > Km > 0) V0 V1 V2
2: for p = 0 to m − 1 do
3: Clustering Vp into Kp+1 clusters.
4: Compute the centroids of the vertices of each cluster.
5: Define the centroids as a new T SP Vp+1 .
6: end for
7: Mapping Vm to the Ising model.
8: Do Algorithm 1.
9: for p = 0 to m − 1 do
10: Determine the order of cluster visits for Vm−p−1 .
11: Mapping Vm−p−1 to the Ising model to correspond to
the clustering results and the cluster visit order.
12: Do Algorithm 1.
13: end for
14: Output spin state SBest as solution of the original problem Incremental annealing
V0 . Fig. 5. Example of hierarchical clustering and incremental annealing.
Authorized licensed use limited to: Shanghai Jiaotong University. Downloaded on February 26,2023 at 09:10:24 UTC from IEEE Xplore. Restrictions apply.
→ Vertex
A B C D E F 50
↓ Order
1 Optimal solution
② K1 = 1 (Conventional)
E 2 40 K1 = 24,K2 = 12,K3 = 6
Frequency
D ①
C 3
30
4
F A 5
20
B
③
6
10
(a) (b)
Fig. 6. Mapping on the Ising model using the proposed method. 0
500 1000 1500 2000 2500 3000
→ Vertex
Total distance
↓ Order
A B C D A B C D Fig. 8. Solution distribution (eil101).
1 1
Authorized licensed use limited to: Shanghai Jiaotong University. Downloaded on February 26,2023 at 09:10:24 UTC from IEEE Xplore. Restrictions apply.
TABLE I
O PTIMIZATION RESULTS ( BOLD FONT INDICATES BETTER RESULT. K1 = 1 CORRESPONDS TO THE CONVENTIONAL METHOD .)
large scale Max Cut problems via tabu search,” J. Heuristics, vol. 19,
no. 4, pp. 565–571, 2011.
[3] K.-L. Du and M. N. S. Swamy, Search and optimization by metaheuris-
tics. Springer International Publishing, 2016.
[4] M. Yamaoka, C. Yoshimura, M. Hayashi, T. Okuyama, H. Aoki, and
H. Mizuno, “20k-spin Ising chip for combinational optimization problem
with CMOS annealing,” in Dig. Tech. Papers, IEEE Intl. Solid-State
Circuits Conf., Feb 2015, pp. 1–3.
103 [5] P. L. McMahon, A. Marandi, Y. Haribara, R. Hamerly, C. Langrock,
S. Tamate, T. Inagaki, H. Takesue, S. Utsunomiya, K. Aihara et al.,
“A fully programmable 100-spin coherent Ising machine with all-to-all
0 6 12 18 24 connections,” Science, vol. 354, no. 6312, pp. 614–617, 2016.
K1 [6] H. Gyoten, H. Hiromoto, and T. Sato, “Enhancing the solution quality of
hardware Ising-model solver via parallel tempering,” Proc. IEEE/ACM
Fig. 9. The number of required spins (eil101). Intl. Conf. on Computer-Aided Design, pp. 70:1–70:8, 2018.
[7] H. Nishimori, Statistical physics of spin glasses and information pro-
cessing. Oxford University Press, 2001.
[8] T. Kadowaki and H. Nishimori, “Quantum annealing in the transverse
to each spin, and hence it is necessary to update the spins Ising model,” Physical Review E, vol. 58, no. 5, pp. 5355–5363, 1998.
in series. Otherwise, the quality of the solution degrades due [9] M. Yamaoka, C. Yoshimura, M. Hayashi, T. Okuyama, H. Aoki, and
H. Mizuno, “A 20k-spin Ising chip to solve combinatorial optimization
to the so-called bang-bang effect. We therefore updated the problems with CMOS annealing,” IEEE J. Solid-State Circuits, vol. 51,
spins serially. By contrast, in the proposed clustering based no. 1, pp. 303–309, 2016.
approach, the spins that belong to non-adjacent clusters were [10] C. Cook, H. Zhao, T. Sato, M. Hiromoto, and S. X.-D. Tan, “GPU-
based ising computing for solving max-cut combinatorial optimization
not connected and could thus be updated simultaneously. problems,” Integration, vol. 69, pp. 335 – 344, 2019. [Online]. Available:
In the conventional method, the number of spin updates is http://www.sciencedirect.com/science/article/pii/S0167926019301348
proportional to n2 . Meanwhile, assuming that n vertices are [11] M. Erol and F. Bulut, “Real-time application of travelling salesman prob-
lem using google maps api,” Electric Electronics, Computer Science,
equally divided into K clusters, the proposed method can Biomedical Engineerings’ Meeting, pp. 1–5, 2017.
update spins in non-adjacent clusters in parallel, so the number [12] R. Takahashi, “Quantitative evaluation of iterative extended changing
of updates is proportional to 2×(n/K)2 , which leads to K 2 /2 crossover operators to solve the traveling salesman problem: Diversity
measurement and its application to selection strategies in genetic algo-
times faster spin updates than when using naive methods. rithms,” Intl. Conf. on Natural Computation, pp. 235–244, 2014.
[13] M. Dorigo and L. M. Gambardella, “Ant colony system: a cooperative
V. C ONCLUSION learning approach to the traveling salesman problem,” IEEE Transac-
In this paper, we proposed a hierarchical clustering approach tions on evolutionary computation, vol. 1, no. 1, pp. 53–66, 1997.
[14] H. Gyoten, M. Hiromoto, and T. Sato, “Area efficient annealing proces-
for solving TSPs using the Ising model-based solver. Through sor for ising model without random number generator,” IEICE Trans.
simulations, benchmark problems were solved by the existing Information and Systems, vol. E101-D, no. 2, pp. 314–323, 2018.
method and by the proposed method using the Ising model- [15] A. Zaribafiyan, D. Marchand, and S. Rezaei, “Systematic and determin-
istic graph minor embedding for cartesian products of graphs,” Quantum
based solver and were compared. The solution quality of the Information Processing, vol. 16, no. 5, p. 136, 2017.
proposed method has been improved by up to 67.1% while [16] E. Boros, P. Hammer, and G. Tavares, “Local search heuristics for
the runtimes have become 73.8x shorter than when using the quadratic unconstrained binary optimization (QUBO),” J. Heuristics,
vol. 13, no. 2, pp. 99–132, 2007.
conventional method. [17] S. Kanamaru, D. Oku, M. Tawada, S. Tanaka, M. Hayashi, M. Yamaoka,
M. Yanagisawa, and N. Togawa, “Efficient Ising model mapping to
ACKNOLEGEMENT solving slot placement problem,” IEEE Itnl. Conf. Consumer Electronics,
This work was partially supported by JSPS KAKENHI pp. 1–6, 2019.
[18] J. Cai, W. G. Macready, and A. Roy, “A practical heuristic for finding
Grant No. 17H01713. graph minors,” 2014.
[19] “TSPLIB,” softlib.rice.edu/pub/tsplib/tsp/.
R EFERENCES
[1] S. Kirkpatrick, C. D. Gelatt, and M. P. Vecchi, “Optimization by
simulated annealing,” Science, vol. 220, no. 4598, pp. 671–680, 1983.
Authorized licensed use limited to: Shanghai Jiaotong University. Downloaded on February 26,2023 at 09:10:24 UTC from IEEE Xplore. Restrictions apply.