Improving solutions by embedding larger subproblems in a DWave quantum annealer
Abstract
Quantum annealing is a heuristic algorithm that solves combinatorial optimization problems, and DWave Systems Inc. has developed hardware implementation of this algorithm. However, in general, we cannot embed all the logical variables of a largescale problem, since the number of available qubits is limited. In order to handle a large problem, qbsolv has been proposed as a method for partitioning the original large problem into subproblems that are embeddable in the DWave quantum annealer, and it then iteratively optimizes the subproblems using the quantum annealer. Multiple logical variables in the subproblem are simultaneously updated in this iterative solver, and using this approach we expect to obtain better solutions than can be obtained by conventional local search algorithms. Although embedding of large subproblems is essential for improving the accuracy of solutions in this scheme, the size of the subproblems are small in qbsolv since the subproblems are basically embedded by using an embedding of a complete graph even for sparse problem graphs. This means that the resource of the DWave quantum annealer is not exploited efficiently. In this paper, we propose a fast algorithm for embedding larger subproblems, and we show that better solutions are obtained efficiently by embedding larger subproblems.
Introduction
Combinatorial optimization problems, the minimization of cost functions with discrete variables, have significant realworld applications. The cost function of a combinatorial optimization problem can generally be mapped to the Hamiltonian of a classical Ising model [Ising_mapping]. Inspired by simulated annealing [SA_original], quantum annealing (QA) [QA_original] was proposed as a method for searching the ground state of a Hamiltonian with a complicated energy landscape. While SA employs thermal fluctuations to escape local minima, QA utilizes quantum fluctuations. Numerous studies have investigated whether QA outperforms SA in terms of the computational time required to obtain a highaccuracy solution. Most of the studies have shown that QA is superior to SA [QA_sup1, QA_sup2, QA_sup3], while a few have also suggested that it is inferior [QA_inf]. Recently, a commercial quantum annealer based on superconducting flux qubits [Dwave] has been developed by DWave Systems Inc. Experimental studies using the DWave quantum annealer have been performed to compare the performance of QA and SA [Dwave_SA1, QA_sup3] and to demonstrate the applicability of the DWave quantum annealer to practical problems [opt_application1, opt_application2, opt_application3].
The generic form of a timedependent Hamiltonian in QA is
(1) 
where is the classical Hamiltonian which represents the cost function to be minimized, and is the quantum fluctuation term for which the ground state is trivial. At the beginning of QA, the coefficients of the timedependent Hamiltonian are set to , , and the system is in trivial ground state determined by . At the end of QA, the coefficients are set to and where is the annealing time. The system evolves according to the Schrödinger equation:
(2) 
where is a state vector of the system and is set to for simplicity. The system will remain closed to the instantaneous ground state of the timedependent Hamiltonian if the system changes sufficiently slowly and if the adiabatic condition [adiabatic_condition],
(3) 
is always satisfied during QA. Here and are eigen vectors and eigen energies of the instantaneous ground state and first excited state, respectively. Thus, by setting the annealing time large enough, we ultimately obtain the ground state of the classical Hamiltonian , which represents the optimal solution.
The current version of DWave quantum annealer (DWave 2000Q) implements QA with a transverse magnetic field:
(4) 
where represents the total number of qubits. A cost function that the DWave quantum annealer can handle is:
(5) 
where the interactions between qubits are restricted to Chimera graph, which is constructed as an grid of complete bipartite graphs [Comp_Embed1]. Chimera graph for is shown in Fig. 1, where the vertices and edges represent qubits and the interactions between them, respectively. Although the Chimera graph for DWave 2000Q is , the number of operable qubits is less than , since there are defects in the qubits and connectivities.
Limited connectivity between the qubits is a restriction to employing the DWave quantum annealer for realworld applications. Before solving an optimization problem, it is necessary to map a problem graph onto a subgraph of the hardware graph. This process is called “minor embedding”. The problem graph is defined as a graph in which the vertices and edges represent the logical variables and interactions between them, respectively. The hardware graph is defined as a graph for which the vertices and edges represent the qubits and interactions between them, respectively. It is known to be NPhard [embed_hard] to find an optimal minor embedding of an arbitrary problem graph into an arbitrary hardware graph. There exist various algorithms to find the minor embeddings, and a heuristic algorithm proposed by Cai et al. [heuristic_Embed] is the most versatile option so far. While this general algorithm searches for a minor embedding of an arbitrary problem graph into an arbitrary hardware graph, the computational time increases drastically with the number of qubits, especially for sparse problem graphs. To reduce the computational time for the minor embedding, some algorithms that exploit features of the hardware graphs and specific problem graphs have been developed. Although the number of logical variables embeddable into hardware graphs is small, utilizing complete graph embedding [Comp_Embed2, Comp_Embed3] is the simplest way to reduce the computation time. Complete graph embedding can be applied to arbitrary problem graphs with less than 64 logical variables for a Chimera graph with without defects. This is basically the embedding used in qbsolv [qbsolv]. Other embedding algorithms [Virtual_Embed] can find the minor embedding efficiently in reasonably dense problem graphs by exploiting the bipartite structure of the Chimera graph [bipartite_chimera], and it is possible to embed a larger number of logical variables than for a complete graph embedding [Comp_Embed2, Comp_Embed3]. A minor embedding of the Cartesian product of two complete graphs, which often appears in realworld optimization problems, has been proposed in the literature [Cartesian_Embed]. However, efficient embedding algorithms for sparse problem graphs do not exist, despite the fact that sophisticated minor embeddings for sparse problem graphs are more important than for dense problem graphs in order to exploit the potential of the DWave quantum annealer. More logical variables can be embedded with shorterlength chains for sparse problem graphs.
In the methods section below, we propose a fast algorithm for embedding larger subproblems based on Cai’s algorithm [heuristic_Embed]. We do not need to embed all of the logical variables of a problem graph in embedding of subproblems, and the logical variables that can be embedded easily are selected as a part of the subproblem in our proposed algorithm. As a result, the proposed algorithm can embed larger subproblems than complete graph embedding [Comp_Embed2, Comp_Embed3], with shorter computational time than the Cai’s algorithm [heuristic_Embed], not only for dense problem graphs but also for sparse problem graphs.
In the following section, we show the improvement in solutions achieved by embedding larger subproblems for a ferromagnetic model and a spinglass model on a threedimensional Ising model with 1,000 logical variables. Since the cubic lattice with 1,000 variables is not embeddable into DWave 2000Q, we extract embeddable subproblems into DWave 2000Q and iteratively optimize them using a quantum annealer like qbsolv. In this study, we utilized two algorithms to embed subproblems into the Chimera graph of DWave 2000Q, with few defects in the qubits and connectivities. One is the proposed algorithm, which can embed 380 logical variables, and the other is complete graph embedding [Comp_Embed3], which can embed only 63 logical variables. We have confirmed that better solutions can be achieved with less number of iterations for both the ferromagnetic and spinglass models by embedding large subproblems.
Results
In this section, we demonstrate that better solutions are obtained efficiently by embedding larger subproblems for the ferromagnetic and spinglass models on the threedimensional Ising model with logical variables
The optimization process implemented in this study is shown in Fig. 2. The problem graph is the cubic lattice with logical variables. We partition the original large problem into subproblems and then iteratively optimize the subproblems using a quantum annealer. Two algorithms are utilized to embed subproblems in this study. One is the proposed algorithm, which can embed 380 logical variables, and the other is a completegraph embedding [Comp_Embed3], which can embed only 63 logical variables into the Chimera graph of the DWave 2000Q with few defects in the qubits and connectivities. After embedding and optimizing the subproblem, the logical variables of the subproblem are updated in the output of DWave 2000Q. Then, a greedy algorithm is executed by a conventional digital computer to get to an exact (local) minimum. In this greedy algorithm, one logical variable is randomly selected, and it is flipped if the energy decreases. We finish refining the solution using the greedy algorithm if the energy change caused by flipping each logical variable is completely nonnegative. Finally, the best solution obtained by this procedure is updated. These processes are iterated, and we confirm that the solutions are improved by embedding larger subproblems.
The Hamiltonian optimized in this study is shown below:
(6)  
(7) 
where represents a logical variable, is the interaction between nearest neighbors in the cubic lattice, and is the probability that , the antiferromagnetic interaction. We evaluated solutions for a ferromagnetic model with and a spinglass model with [3D_phase_annealer]. The ferromagnetic model has no frustration, so that and are the trivial ground states. However, it is often the case that logical variables are divided into two kinds of domains, with the logical variables equal to in one domain and in the other domain. The boundaries of the domains are called domain walls, and it is essential to eliminate domain walls to obtain the ground state of ferromagnetic model. While domain walls cannot be eliminated efficiently by singlespinflip algorithms such as simulated annealing, cluster Monte Carlo algorithms [cluster_monte_carlo] address domain walls well by flipping logical variables in the same domain simultaneously. Although the structures of clusters in these algorithms [cluster_monte_carlo] are different from those of the subproblems extracted by the proposed algorithm, we expect that domain walls can be eliminated efficiently by embedding larger subproblems. In the spinglass model with , there are many frustrations, and the energy landscape is rugged with many local minima. In order to obtain better solutions, it is essential to search for as many local minima as possible. By embedding larger subproblems, the phase space searched by optimizing the subproblem grows exponentially, and it is possible to search for better local minima that could be distant from the current solution in the phase space. As a result, we expect that better solutions can be obtained efficiently by embedding larger subproblems for both the ferromagnetic and the spinglass models.
The energies obtained for and are shown in Figs. 3(a) and 3(b), respectively. The average energies for 32 trials are plotted, and the same initial states are used for each run [ and , with the two embedding algorithms illustrated in Fig. 2]. For both and , lower energies are obtained with a smaller number of iterations by embedding larger subproblems. The ground state energy for is and the ground state is obtained for all the trials after 45 iterations.
Discussion
In the present paper, we showed that better solutions are obtained efficiently by embedding larger subproblems for the spinglass and ferromagnetic models on the cubic lattice with logical variables. The energy landscape of the spinglass model is rugged with many local minima. It is essential to search for as many local minima as possible, and this can be achieved by embedding larger subproblems, for which the phase space is exponentially larger than that of small subproblems. For the ferromagnetic model, although there are no frustrations and a trivial ground state exists, eliminating the domain walls from which singlespinflip algorithms suffer is essential to obtain the ground state. The logical variables in small domains can be flipped simultaneously by embedding larger subproblems, and as a result the ground state can be obtained efficiently with a smaller number of iterations. Although we demonstrated the improvements in the solutions specifically for the spinglass and ferromagnetic models on a cubic lattice, we expect that better solutions can be obtained efficiently for a wide range of optimization problems by embedding larger subproblems.
For practical applications, it is essential to utilize the DWave quantum annealer as a part of an iterative solver like qbsolv, as long as the problem size embeddable in the DWave quantum annealer remains limited. A hybrid use of classical algorithms and the DWave quantum annealer is inevitable for this scheme. Although we simply adopted a greedy algorithm as a classical optimization algorithm, a myriad of classical algorithms can be combined with the DWave quantum annealer [qbsolv, hybrid1, hybrid2]. One guideline for selecting a classical solver is to exploit the complementary advantages of QA and classical algorithms [qbsolv]. For example, a more versatile optimization algorithm may be constructed by combining QA and SA [Modernizing], since QA performs well for the energy landscape with many high and thin barriers, while SA efficiently explores the phase space with low and wide barriers [simple_case].
Although QA was initially proposed as an optimization method, the DWave quantum annealer has recently been considered as a sampling machine. It has been assumed that the output of DWave quantum annealer is close to a Boltzmann distribution of the Hamiltonian at a freezeout point during annealing [freezeout], and applications that utilize the quantum annealer as a sampling machine have been reported [sample1, sample2, sample3, sample4]. In addition, a local search around a specific initial state using the DWave quantum annealer has been proposed in the literature [Modernizing] and it is implemented in DWave 2000Q. This is called “reverse annealing”[reverse]. By combining reverse annealing and the embedding algorithm proposed in this paper, it may be possible to implement Markov chain Monte Carlo methods efficiently for large problems.
In future work, we will evaluate the utility of embedding larger subproblems for various optimization problems and construct highperformance optimization algorithms that exploit the proposed embedding algorithm.
Methods
In this section, we describe a fast algorithm for embedding larger subproblems into a hardware graph.
Definition of minor embedding
In general, a problem graph is not a subgraph of a Chimera graph, and the problem graph must be mapped onto a subgraph of a Chimera graph in order to solve optimization problems using the DWave quantum annealer. This process is called “minor embedding” of the problem graph into the hardware graph, and this is achieved by representing one logical variable with multiple qubits. For example, more than two qubits must be assigned to represent a logical variable that interacts with ten logical variables, since the maximum degree of a Chimera graph is six. If the two qubits and are used to represent the same logical variable, and must be connected on Chimera graph. The local energy related to and is denoted as , and we can set the local energy of lower than that of by setting . If is large enough, the optimal solutions of the embedded problem will be identical to that of the original optimization problem. Note that the assignment of multiple qubits to one logical variable is allowed, while the assignment of multiple logical variables to one qubit is forbidden. As shown in the literature [Comp_Embed2], a minor embedding of a problem graph into a hardware graph is defined as follows:

Each vertex in is mapped to the vertex set of a connected subtree of .

If , then there exist such that , and .
A connected subtree is often called a “chain”.
A conventional heuristic algorithm
A conventional heuristic algorithm for finding a minor embedding of an arbitrary problem graph into an arbitrary hardware graph has been proposed by Cai et al. in the literature [heuristic_Embed]. The embedding process of this algorithm is divided into two stages. In the initial stage, logical variables are embedded one by one into the hardware graph, and all of the logical variables are embedded by allowing multiple assignments of the logical variables to one qubit. For example, suppose that the logical variables are already embedded in the hardware graph, and a logical variable that is adjacent to in the problem graph is selected to be additionally embedded. In this case, as shown in Fig. 4(a), an unused qubit to which no logical variables are assigned is selected as the root of , and the shortest paths from the root of to are calculated on the hardware graph using Dijkstra’s algorithm. Then, by assigning or to qubits in the shortest paths, the adjacency between and will be represented on the hardware graph. However, it will often be the case that a path with only unused qubits does not exist. For example, as shown in Fig. 4(b), if a logical variable is assigned to all of the qubits adjacent to , a path from the root of to with only unused qubits does not exist. In such a case, by assigning multiple logical variables [ or and in Fig. 4(b)] to one qubit, will be embedded once. After embedding all of the logical variables by allowing multiple assignments in the initial stage, the minor embedding obtained in the initial stage is refined so that only one logical variable is assigned to one qubit in the last stage.
The computational time for this algorithm is dominated by Dijkstra’s algorithm. The computational time and the number of shortest paths searched by Dijkstra’s algorithm in the initial stage are given by
(8)  
(9) 
and and in the last stage are given by
(10)  
(11) 
where represents the computational time for Dijkstra’s algorithm:
(12) 
Here, and are the number of vertices and edges in the problem graph, and and are the number of vertices and edges in the hardware graph, respectively. In this algorithm, the vertexweighted shortest paths are searched in order to distinguish used and unused qubits. The computational time in the last stage is obviously dominant. So we expect that the computational time will be drastically reduced by avoiding multiple assignments of logical variables in the initial stage, since the implementation of the last stage becomes unnecessary.
Proposed algorithm
Here we focus on the embedding of subproblems and propose a fast algorithm to find minor embeddings of subproblems. In embedding a subproblem, we can select logical variables that are embeddable without multiple assignments as a part of the subproblem, since it is not necessary to embed all of the logical variables included in the problem graph. While in a conventional algorithm, the search for a minor embedding is subject to a strong restriction, that all of the logical variables included in the problem graph must be embedded. The multiple assignments of logical variables are mainly caused by this restriction.
However, for dense problem graphs, the logical variables embeddable without multiple assignments become extinct before all the qubits are exploited. To mitigate this issue, the proposed algorithm includes a reservation system that leaves space to extend the chains. As shown in Fig. 5(a), if a qubit on the left side of a complete bipartite graph in Chimera graph is selected as the root of , qubits to extend the chain vertically are reserved by , and assignment of other logical variables to these qubits are forbidden. If a qubit on the right side is selected as the root of , qubits to extend the chain horizontally are reserved by , as shown in Fig. 5(b). The reserved qubits are released after the embedding of all the logical variables adjacent to are completed.
The refinement of the embedding in the last stage of the conventional algorithm can be eliminated in the proposed algorithm. In addition, the breadthfirst search in a subgraph of a hardware graph consisting only of unused qubits is sufficient to search the shortest paths, since multiple assignments are forbidden. The computational time for the proposed algorithm and the number of the shortest paths searched by the breadthfirst search are given by
(13)  
(14) 
The computational time for the breadthfirst search is given by
(15) 
where is the number of edges included in the subgraph of the hardware graph with unused qubits. For Chimera graph, as shown in Fig. 6, it is sufficient to consider unit cells with used qubits and adjacent unit cells without used qubits. The maximum number of edges included in the subgraph is limited to
(16) 
The embedding algorithm proposed in this section does not strongly depend on the structure of the hardware graphs, except for the reservation system, and we can easily adapt the embedding algorithm for other hardware graphs.
Experimental results
In order to confirm the scalability of our algorithm, we evaluated the dependence of the number of the shortest paths searched by the breadthfirst search and the size of the embedded subproblems. We have used the proposed algorithm to embed subproblems of a grid graph with variables and a complete graph with variables into a Chimera graph with qubits. The results for are shown in Fig. 7(a). Linear fits to the experimental results yield
(17)  
(18) 
The dependence of is less than , even for a grid graph with sparse connectivity. As the exponent is not large, we expect the proposed algorithm to be feasible even if the number of qubits is increased in a future version of the DWave quantum annealer. The results for are shown in Fig. 7(b). Linear fits to the experimental results yield
(19)  
(20) 
The size of subproblems for the complete graph is identical to the maximum size embeddable into a Chimera graph. Although the sizes of the subproblems for the grid graph are smaller than the ideal dependence , they are much larger than those for the complete graph. These results imply that subproblems larger than the complete graph embedding [Comp_Embed2, Comp_Embed3] can be embedded depending on the connectivity of the problem graphs, and with a computation time shorter than that required for Cai’s algorithm [heuristic_Embed]. Because the subproblem embedding is searched greedily and refinement of the embedding is not implemented, an optimal embedding is hardly found especially for sparse problem graphs. However, the computational time is drastically reduced.
The sizes of subproblems extracted from an ErdősRényi model with logical variables for various edge probabilities are shown in Fig. 7(c). Interactions between variables are randomly generated in this model, with edge probability , and the average sizes of subproblems for instances are plotted in the graph. Subproblems are embedded into a Chimera graph in DWave 2000Q. As decreases, the size of the embedded subproblem increases. The proposed algorithm can embed larger subproblems depending on the connectivity of the problem graphs even if the interactions between variables are randomly generated.
An example of a subproblem extracted from a grid graph with logical variables is shown in Fig. 7(d). The subproblem is embedded into a Chimera graph of the DWave 2000Q. The logical variables embedded as the subproblem are colored black. It is desirable that an extracted subproblem consists not of tree structures that are easily optimized but instead of many closed loops that can contain frustrations. The subproblem shown in Fig. 7(d) satisfies this condition.
References
Acknowledgements
The authors are deeply grateful to Shu Tanaka, Masamichi J. Miyama, Tadashi Kadowaki, Hirotaka Irie and Akira Miki for fruitful discussions. One of the authors M. O. is grateful to the financial support from JSPS KAKENHI 15H03699 and 16H04382, the JSTSTART, JSTCREST(No.JPMJCR1402), and the ImPACT program.
Author contributions statement
S. O. conceived and developed the concept, and carried out all the experiments. M. O. proposed the plan to evaluate the validity of the concept, discussed the details of the results and reviewed the manuscript. M. T. and S. T. directed the project in our study.
Additional information
Competing interests: The authors declare no competing interests.