## Abstract

The Potts model describes Ising-model-like interacting spin systems with multivalued spin components, and ground-state search problems of the Potts model can be efficiently mapped onto various integer optimization problems thanks to the rich expression of the multivalued spins. Here, we demonstrate a solver of this model based on hybrid computation using physical and digital architectures, wherein a digital computer updates the interaction matrices in the iterative calculations of the physical Ising-model solvers. This update of interactions corresponds to learning from the Ising solutions, which allows us to save resources when embedding a problem in a physical system. We experimentally solved integer optimization problems (graph coloring and graph clustering) with this hybrid architecture in which the physical solver consisted of coupled degenerate optical parametric oscillators.

## Introduction

The connection between searches for the ground states of physical systems and optimization problems has activated research and development into new types of computation^{1}. The realization of such architectures has been led off by Ising-model solvers^{2,3,4,5,6,7,8,9}. These physical-model-solver architectures have solved certain problems much faster than conventional digital architectures such as a CPU^{10,11,12,13}. Here, embedding of problems in a physical model sometimes requires an overhead of resources, which can be large enough to be a computational bottleneck. However, the embedding overhead can be reduced by choosing a more appropriate physical model as a solver instead of the Ising model^{14,15,16,17,18}.

The Potts model is a fundamental model describing various physical and mathematical problems^{19}, such as those of percolation theory^{20}. This model is a generalization of the Ising model to multivalued spins; its Hamiltonian is given by

where \({S}_{i}\,=\,\{{{{{\mathrm{0,1,2}}}}},\ldots ,M\,-\,1\}\) is an *M*-component spin on the *i*th node of the model, where \(i\,=\,\left\{{{{{\mathrm{1,2,3}}}}},\ldots ,N\right\},\) and \(\delta \left(a,b\right)\) is the Kronecker delta function. Since multivalued spins naturally express integers, various integer optimization problems can be straightforwardly mapped onto ground-state search problems based on this model^{19}. For example, graph coloring can be described as a Potts model with a smaller Hilbert space than that of the standard Ising model^{21}. In the standard Ising-model mapping, *M* colors in each node are represented as *M* Ising spins^{21}; thus, the size of its Hilbert space is 2^{NM}, which is larger than that of the original *M*-color problem, i.e., \({M}^{N}(={2}^{{N{{\log}}}_{2}M}).\) The Ising Hamiltonian has constraint terms to reduce the size of the enlarged space to that of the original problem, while the Potts model without the constraint Hamiltonian has the same size as that of the original. Thus, the Potts model mapping allows us to avoid the embedding overhead (see Supplementary Note 1). On the other hand, there are several challenges in realizing a physical Potts solver, namely the implementations of multivalued spins and interactions described by a Kronecker delta within physical systems. Recently, it has been proposed that physical systems based on a lattice of nonequilibrium Bose-Einstein condensates^{17} and a network of three-photon down-conversion oscillators^{18} can be used to solve specific Potts problems.

In this study, we demonstrated a scheme to solve the Potts problem using a hybrid architecture of a physical Ising-model solver and digital processing (Fig. 1a). The Potts problem can be approximately solved by iterative calculations of Ising problems with updated interactions evaluated from one-way feedforward connections. Hybrid computation enjoys the advantages of physical solvers through the aid of digital computers^{22,23}. The physical solver obtains a low-energy solution of a complex Ising problem (known to be NP^{1}) quickly^{10,11,12,13}, while the digital computer can accurately handle input and output, such as interactions and energy, and also run the learning logic (see Fig. 1a). We implemented a Potts solver by using a coherent Ising machine (CIM)^{5,10,24,25,26} and a standard CPU (Fig. 1b). The CIM is a physical Ising-model solver based on coupled degenerate optical parametric oscillators (DOPOs)^{24}, in which Ising spins are encoded by utilizing the bifurcation transition in each DOPO. We experimentally solved two integer optimization problems—clustering and coloring—on the same graph (see Fig. 2).

## Results and discussion

### Theoretical framework

First, we explain how to map a Potts problem on one involving iterative calculations of Ising models. Given an integer \(L\,\equiv\, {{{{{\rm{ceil}}}}}}\left({{{{{{\rm{log }}}}}}}_{2}M\right)\), multivalued spin *S*_{i} can be written by a set of Ising spins \({\sigma }_{i}^{\left(l\right)}\,=\,\left\{-1,1\right\}\left(l\,=\,{{{{\mathrm{1,2}}}}},\ldots ,L\right)\) with a standard binary representation as \({S}_{i}\,=\,{\sum }_{l\,=\,1}^{L}\frac{1\,+\,{\sigma }_{i}^{\left(l\right)}}{2}{2}^{l\,-\,1}.\) The Hamiltonian in Eq. 1 is rewritten as \({{{{{{\rm{H}}}}}}}_{{{{{{\rm{Potts}}}}}}}\,=\,{\sum }_{{ij}}{J}_{{ij}}{\prod }_{l\,=\,1}^{L}\frac{1\,+\,{\sigma }_{i}^{\left(l\right)}{\sigma }_{j}^{\left(l\right)}}{2}\), where the delta functional Potts interaction is transformed into multibody Ising-spin interactions \({\prod }_{l\,=\,1}^{L}\frac{1\,+\,{\sigma }_{i}^{\left(l\right)}{\sigma }_{j}^{\left(l\right)}}{2}.\) This complicated interaction can be simplified by decomposing it into sets of two-body interactions \({\sigma }_{i}^{\left(l\right)}{\sigma }_{j}^{\left(l\right)}\) on *L* Ising problems with one-way feedforward connections: \({{{{{{\rm{H}}}}}}}_{{{{{{\rm{Ising}}}}}}}^{(l)}\,=\,{\sum }_{{ij}}{J}_{{ij}}^{(l)}{\sigma }_{i}^{(l)}{\sigma }_{j}^{(l)}.\) Here, *l* represents an iteration number and is called a stage. Interaction matrix \({J}_{{ij}}^{(l\,+\,1)}\) is determined recursively from iteration \({J}_{{ij}}^{(l)}\) and solution \({s}_{i}^{(l)}\) of the previous stage:

where the initial Ising interactions are the same as the original Potts interactions \({J}_{{ij}}^{(1)}\,=\,{J}_{{ij}}.\)

Figure 1a illustrates the framework of the Potts solver based on hybrid computation. We repeat operation stages including two parts, the Ising-solver part that obtains solution \({s}_{j}^{\left(l\right)}\) for input \({J}_{{ij}}^{\left(l\right)},\) and the digital part that calculates \({J}_{{ij}}^{\left(l+1\right)}\) in Eq. 2. The digital part also calculates the Potts energy defined by \({E}_{{{{{{\rm{Potts}}}}}}}^{\left(l\right)}\,=\,{\sum }_{{ij}}{J}_{{ij}}\delta ({S}_{i}^{\left(l\right)},{S}_{j}^{\left(l\right)}),\) where the Potts spin \({S}_{i}^{\left(l\right)}\,=\,\left\{{{{{\mathrm{0,1}}}}},\ldots ,{M}^{\left(l\right)}\,-\,1\right\}\), for \({M}^{(l)}\,=\,{2}^{l}\), is given by

From Eq. 2, we can derive two other expressions of Potts energy: \({E}_{{{{{{\rm{Potts}}}}}}}^{(l)}\,=\,{\sum }_{{ij}}{J}_{{ij}}^{\left(l\right)}\frac{{1\,+\,s}_{i}^{(l)}{s}_{j}^{(l)}}{2}\) and \({E}_{{{{{{\rm{Potts}}}}}}}^{(l)}\,=\,{\sum }_{{ij}}{J}_{{ij}}^{\left(l\,+\,1\right)}\). When *l* = *L* (final stage), we obtain solution \({S}_{i}^{* }(={S}_{i}^{\left(L\right)})\) and Potts energy \({E}_{{{{{{\rm{Potts}}}}}}}^{* }(={E}_{{{{{{\rm{Potts}}}}}}}^{(L)})\).

Let us discuss the convergence of the above approximation by considering the energy improvement \({\Delta E}_{{{{{{\rm{Potts}}}}}}}^{(l)}\,\equiv\, {E}_{{{{{{\rm{Potts}}}}}}}^{\left(l\right)}\,-\,{E}_{{{{{{\rm{Potts}}}}}}}^{\left(l\,-\,1\right)}.\) From the above two expressions of \({E}_{{{{{{\rm{Potts}}}}}}}^{\left(l\right)},\) we can rewrite \({\Delta E}_{{{{{{\rm{Potts}}}}}}}^{(l)}\) as \(\frac{1}{2}\left({E}_{{{{{{\rm{Ising}}}}}}}^{\left(l\right)}\,-\,{F}_{{{{{{\rm{Ising}}}}}}}^{\left(l\right)}\right),\) where \({E}_{{{{{{\rm{Ising}}}}}}}^{\left(l\right)}\,=\,{\sum }_{{ij}}{J}_{{ij}}^{\left(l\right)}{s}_{i}^{(l)}{s}_{j}^{(l)}\) is the Ising energy of a solution in stage *l*, and \({F}_{{{{{{\rm{Ising}}}}}}}^{\left(l\right)}\,=\,{\sum }_{{ij}}{J}_{{ij}}^{\left(l\right)}\) is the energy of ferromagnetic states in stage *l* (e.g., ferromagnetic means \({s}_{i}^{(l)}=-1\) for all *i*). We can conclude that \({E}_{{{{{{\rm{Potts}}}}}}}^{(l)}\) decreases in an iteration *l* if each stage yields a solution whose energy is lower than that of the ferromagnetic states: \({E}_{{{{{{\rm{Ising}}}}}}}^{\left(l\right)} \, < \, {F}_{{{{{{\rm{Ising}}}}}}}^{\left(l\right)}.\) Note that the ferromagnetic states are trivially obtained for any \({J}_{{ij}}^{\left(l\right)}\). Meanwhile, convergence condition \({\Delta E}_{{{{{{\rm{Potts}}}}}}}^{(l)}\,=\,0\) is satisfied when the obtained solution is the same as the ferromagnetic state. Equation 3 indicates the convergence of a change in spins \({S}_{i}^{\left(l\right)}\,=\,{S}_{i}^{\left(l\,-\,1\right)}\) for the ferromagnetic solutions (see Methods for details).

Low-energy solution \({S}_{i}^{* }\) is, however, not assured to be the ground state of the original Potts model. This problem is mainly attributed to the one-way feedforward connection of \({J}_{{ij}}^{(l)}\) described by Eq. 2. Namely, as *l* increases, the interaction matrix and graph are divided up into more and more submatrices and subgraphs, as illustrated in Fig. 1a. The loss of information from *J*_{ij} and the reduction of the graph degrade the solution accuracy. Such errors can be circumvented by implementing two kinds of feedback. One is recurrent Potts problem feedback with a new (learned) interaction matrix \({J}_{{ij}}^{{{{{{\rm{new}}}}}}}\) (long arrow in Fig. 1a). The other one is digital feedback. Namely, in each digital operation, \({J}_{{ij}}^{(l)}\) and \({S}_{i}^{(l)}\) are modified to improve Potts energy \({E}_{{{{{{\rm{Potts}}}}}}}^{(l)}\)(rounded arrows in Fig. 1a). The simplest example of digital feedback is filtering. For \({\Delta E}_{{{{{{\rm{Potts}}}}}}}^{(l)} \, > \, 0,\) we can filter out a bad solution without additional calculations by choosing a better solution in the previous stage. In the next section, we experimentally demonstrate that heuristic feedback algorithms clearly improve the performance of the Potts solver.

Finally, we generalize \({J}_{{ij}}^{(l)}\) defined in Eq. 2 to use the feedback algorithms. For convenience, we introduce weight matrix \({W}_{{ij}}^{(l)}\) defined by \({W}_{{ij}}^{(l\,+\,1)}\,=\,\delta ({S}_{i}^{\left(l\right)},{S}_{j}^{\left(l\right)})\), which is a more general form, i.e., \({J}_{{ij}}^{(l)}\,=\,{W}_{{ij}}^{(l)}{J}_{{ij}}\), than Eq. 2. In summary, weights for interactions \({J}_{{ij}}^{(l)}\) are “learned” from the solutions of the previous Potts model computation so as to decrease the Potts energy. This framework can be regarded as an artificial-neural-network-like algorithm using a physical Ising solver, where a decrease in the energy cost function (Potts energy) is assured if the solver can find a low-energy Ising solution (see Supplementary Note 9). Note that this property of convergence may allow us to utilize the advantages of physical solvers that can find low-energy solutions quickly.

### Graph clustering

We solved a graph clustering problem, which is a task to find the best grouping of nodes. This problem is widely used in various fields, such as community detection in social^{27} and biological networks^{28,29}. Modularity *Q* is a good measure for graph clustering problems^{30}, and a task to maximize *Q* can be directly mapped onto a search for the ground state of the Potts model in Eq. 1^{31}. Multivalued spin *S*_{i} identifies a group number to which the *i*th node belongs. The interaction matrix for this problem is defined as \({J}_{{ij}}\,\equiv\, {B}_{i}{B}_{j}\,-\,C{A}_{{ij}},\) where \({A}_{{ij}}\) is the adjacency matrix, \({B}_{i}\,=\,{\sum }_{j}{A}_{{ij}}\), and \(C\,=\,{\sum }_{i}{B}_{i}\). The Potts energy is related to \(Q\,=\,-\frac{{E}_{{{{{{\rm{Potts}}}}}}}}{{C}^{2}}.\) There is room to study on the definition of \({J}_{{ij}}\)^{32}, but it is beyond the scope of this paper. Competition between antiferromagnetic and ferromagnetic correlations (namely, a positive \({B}_{i}{B}_{j}\) and negative \({-{CA}}_{{ij}}\) in \({J}_{{ij}}\), respectively) is the intrinsic difficulty of this problem. Although the number of groups is not given, optimized *M* is spontaneously obtained through such ferromagnetic–antiferromagnetic competition as discussed below.

We solved a clustering problem on the graph shown in Fig. 2, compiled from the prefectures of Japan and has *N* = 47 nodes and \({N}_{{{{{{\rm{edge}}}}}}}\,=\,92\) edges. The physical solver used here was a CIM implemented with 512 fully connectable nodes (see Methods and Fig. 1b), in which 470 nodes were used in parallel. It has been demonstrated that, if \({J}_{{ij}}\) is a dense matrix, a CIM shows better performance than the standard CPU with simulated annealing^{10} and the D-wave system^{33}. This suggests that a CIM is appropriate for clustering problems in which \({J}_{{ij}}\) is dense owing to the term of \({B}_{i}{B}_{j}\) with \({B}_{i}\,\ne\, 0.\)

Each CIM calculation took 500 μs (100 5-μs steps), and each digital part took about 30 μs or less. However, the current setup used a slow serial communications interface, and the data transfer of \({J}_{{ij}}^{(l)}\) between the CIM and CPU took a few seconds. This bottleneck can be removed by coding the \({J}_{{ij}}\)-update logic in field-programmable gate array (FPGA) modules (see Methods).

Figure 3a–d shows the evolutions of 47 DOPOs during 100 operation steps (circulations in a cavity) in four stages (*l* = 1, 2, 3, and 4). Positive (negative) DOPO amplitudes represent up (down) Ising spins. The black lines in Fig. 3e show the change in modularity *Q* and the number of groups *M* in the same operation steps as those in Fig. 3a–d. For *l* = 1 and 2, the DOPO amplitudes show that antiferromagnetic states appear after several tens of steps (Fig. 3a, b). As a result, each group split in two, and *M* doubled in value (Fig. 3e). At *l* = 3, down-spin DOPOs were the majority (Fig. 3c), indicating that ferromagnetic correlations were dominant, and *M* converged to an optimized value of 5 (Fig. 3e). At the beginning of the steps in each stage, *Q* decreased drastically, while at the end of steps, a CIM selected a higher value of *Q* than that in the former stage. At *l* = 4, the complete ferromagnetic state prevailed finally (Fig. 3d), meaning that the stationary condition was satisfied. As mentioned in Methods, the obtained grouping with *Q* of 0.646 (see Fig. 2) is the same as the best solution obtained by reliable algorithms, such as the Louvain greedy^{34} and Infomap algorithms^{35}. Figure 3f shows that the rate of reaching the highest *Q* of 1000 trials is about 20%. We can conclude that the ferromagnetic–antiferromagnetic competition solved by the CIM provided good groupings with high modularity (see Methods and Supplementary Note 6).

We found that two digital feedback algorithms—domain separation and group reunion—improved the performance of our Potts solver. Figure 3e, f (red and blue lines) reveal that they almost doubled the rate of reaching the highest *Q*. In addition, the highest *Q* was reached at early stages, so the calculation time was shortened. The digital processing including both the domain separation and group reunion algorithms takes at most 30 μs; they were on the order of \(O({N}^{2})\) (or \(O({N}_{{{{{{\rm{edge}}}}}}})\) for sparse \({A}_{{ij}}\)).

#### Domain separation

By detecting magnetic domains (small regions in which spins are in the same), we can recalculate \({S}_{i}^{\left(l\right)}\) to decrease Potts energy. As illustrated in Fig. 3g, an Ising solver sometimes yields a solution consisting of two or more separated magnetic domains (see Supplementary Notes 3, 4, and also ref. ^{25}). Nodes in separated domains should be in different groups owing to the lack of ferromagnetic correlations (\(-{A}_{{ij}}\)). Note that the antiferromagnetic connections (\({B}_{i}{B}_{j}\)) still remain. Namely, the subgraph consisting of red nodes in Fig. 3g is separated, while the corresponding matrix (red square) is not block diagonal because of the antiferromagnetic interactions (see Supplementary Note 4). As depicted in Fig. 3g, by removing the antiferromagnetic elements from \({J}_{{ij}}^{(l)}\), this domain separation feedback yields a new \({J}_{{ij}}^{{\left(l\right)}^{{\prime} }}\). As a result, the Potts energy decreases in proportion to the sum of removed antiferromagnetic elements, i.e., \({\sum }_{{ij}}\left[{J}_{{ij}}^{{\left(l\right)}^{{\prime} }}\,-\,{J}_{{ij}}^{\left(l\right)}\right]\).

Detecting domains and numbering them require a calculation time of \(O({N}^{2})\) or \(O({N}_{{{{{{\rm{edge}}}}}}}).\) The updated \({S}_{i}^{{\left(l\right)}^{{\prime} }}\) is determined from the domain number. Now, the number of groups is unlimited, while it was limited to at most \({2}^{l}\) in the case without feedback. As shown in Fig. 3e, f (red lines), domain separation feedback allows us to reach the best solution with *M* = 5 in the early stages \(l \, < \, 3.\) Thus, the calculation time can be shortened by up to half.

#### Group reunion

The group reunion feedback algorithm is schematically shown in Fig. 3h. On the basis of the obtained grouping described by \({S}_{i}^{(l)},\) we can calculate the group–group interactions \({J}_{g{g}^{{\prime} }}\,\equiv\, {\sum }_{{ij}}{J}_{{ij}}\delta (S_{i}^{\left(l\right)},g)\delta (S_{j}^{\left(l\right)},{g}^{{\prime} }).\) As shown in Fig. 3h, this interaction matrix is defined on a new graph with \({M}^{(l)}\) nodes. The new Potts Hamiltonian \({{{{{{\rm{H}}}}}}}_{{{{{{\rm{Potts}}}}}}}\,=\,{\sum }_{g{g}^{{\prime} }}{J}_{g{g}^{{\prime} }}\delta ({S}_{g},{S}_{{g}^{{\prime} }})\) describes the task of finding the best way of decreasing the Potts energy by executing reunions of groups. Ferromagnetic group–group interaction \({J}_{g{g}^{{\prime} }} \, < \, 0\) requires reunion. Group reunion feedback can restore the information lost due to the approximation: Namely, \({J}_{g{g}^{{\prime} }}\) includes information about the original *J*_{ij}, whereas a block diagonal \({J}_{{ij}}^{(l)}\) loses it.

The Potts problem for a group reunion task can be efficiently solved by making the following approximation. We unify two groups, \({g}_{a}\) and \({g}_{b}\), for a negative and minimum \({J}_{{g}_{a}{g}_{b}}\) without considering the other negative elements, and repeat the same calculations by updating \({J}_{g{g}^{{\prime} }}\). In each step, the Potts energy is reduced by \(2{J}_{{g}_{a}{g}_{b}}\). This approximation works very well for small *M* (see Supplementary Note 5). The calculation takes \(O({N}^{2})\) \({{{{{\rm{or}}}}}}\) \(O({N}_{{{{{{\rm{edge}}}}}}})\) time. Group reunion feedback combined with domain separation feedback improves the rate of reaching the highest *Q* as shown in Fig. 3e, f.

In spite of the improvement with the domain separation and group reunion feedback schemes, experimental results indicated that the success probability of our machine is still not better than those of the Informap and Metropolis algorithms (See Methods and Supplementary Note 6). We consider that one main reason for the relatively low success probability is instability in the optical system, which resulted in the fluctuation of the operational condition in each computation trial. This includes the instability of the optical parametric oscillation caused by the thermal fluctuation for the long-distance fiber in the cavity, and the instability of the relative phase between the DOPO and the injected lights. The optical stability can be improved by implementing precise temperature control of the long-distance fiber in the cavity and by suppressing the phase noise of the pump laser for the second-harmonic generation (see Fig. 1b).

### Graph coloring

Graph coloring is the task of coloring connected nodes^{19}. We experimentally solved a four-color problem on the graph in Fig. 2a. We set *L* = 2 for *M* = 4. The interaction matrix was totally antiferromagnetic \({J}_{{ij}}\,\equiv\, {A}_{{ij}} \, > \, 0,\) requiring that adjacent nodes be different colors. The four-color theorem^{36} assures the existence of a ground state with \({E}_{{{{{{\rm{Potts}}}}}}}^{* }\,=\,0.\) The CIM operated under the same conditions as described above (see Supplementary Note 7).

Figure 4a shows the conditional success rates for 50 instances of \({J}_{{ij},{k}}^{\left(2\right)}\) \(\left(k\,=\,1,2,\ldots ,50\right)\), which were obtained as follows: Identical Ising models with \({J}_{{ij}}\) in stage one were solved 50 times, and 50 solutions \({s}_{i,k}^{(1)}\) and 50 Ising models in stage two \({J}_{{ij},{k}}^{\left(2\right)}\) were obtained, where \({J}_{{ij},{k}}^{\left(2\right)}\,=\,{W}_{{ij},k}^{(1)}{J}_{{ij}}\) and \({W}_{{ij},k}^{(1)}\,=\,\delta ({s}_{i,k}^{\left(1\right)},{s}_{j,k}^{(1)})\). Then, the conditional success rate was estimated by solving the 50 Ising models with \({J}_{{ij},{k}}^{\left(2\right)}\) 100 times. The total success rate averaged over *k* is about 50%. Figure 4a shows the energy in stage one, \({E}_{{{{{{\rm{Potts}}}}}},\,k}^{(1)}\), for each \({s}_{i,k}^{(1)}\). Successful and failed instances in stage two are clearly separated irrespective of the energy in stage one. This result can be understood from the reduction of the graph in stage two described by \({W}_{{ij},k}^{(1)}{A}_{{ij}}\) (see Supplementary Note 3). Coloring fails with 100% probability regardless of the energy in stage one if the reduced graph in stage two has geometrical frustrations, such as a triangular structure (see Supplementary Note 8).

Such frustrations can be dissolved by implementing recurrent Potts problem feedback based on a “learning by mistake” approach. We iteratively execute the Potts solver with \({J}_{{ij}}^{{{{{{\rm{new}}}}}}}\,=\,{J}_{{ij}}^{{{{{{\rm{old}}}}}}}\,+\,w{L}_{{ij}}\) and \({J}_{{ij}}^{{{{{{\rm{initial}}}}}}}\,=\,{w}_{0}{A}_{{ij}},\) where *w* and *w*_{0} are weights to control the learning. A feedback matrix is defined by \({L}_{{ij}}\,\equiv\, {W}_{{ij}}^{(2)}{A}_{{ij}}(=\left\{{{{{\mathrm{0,1}}}}}\right\})\) and related to the Potts energy as \({E}_{{{{{{\rm{Potts}}}}}}}^{* }\,=\,{\sum }_{{ij}}{L}_{{ij}}.\) Here, \({L}_{{ij}}\,=\,1\) represents adjacent nodes in the same color, while \({L}_{{ij}}\,=\,0\) represents those having different colors (or not adjacent). Thus, a finite \({L}_{{ij}}\) directly represents a mistake. In the new (learned) Potts problem with \({J}_{{ij}}^{{{{{{\rm{new}}}}}}},\) interactions on the “mistaken edges” are enlarged, and then the pair of nodes on these edges are correctly colored with high priority in stage one. As a result, frustrations caused by the reduction of the graph in stage two are eliminated by learning.

Figure 4b shows how learning affects the success rate for \(w\,=\,5,10,20,{{{{{\rm{and}}}}}}\) \(40\) with \({w}_{0}\,=\,40.\) Each success rate was obtained by performing 50 trials in a two-stage experiment. In each learning step, \({L}_{{ij}}\) is determined from the worst-case instance with the largest \({E}_{{{{{{\rm{potts}}}}}}}^{* }\) in 50 trials. As shown in Fig. 4b, success rates improved from 50% to over 80% after few learning steps, eventually reaching nearly 100%. A larger *w* provides fast but unstable improvements (see Supplementary Note 10).

Figure 4c represents the sum of \({L}_{{ij}}\), corresponding to total counts of mistakes, for four independent learning processes. In each learning process, there was no more than one mistake on the same edge; thus, there was at most four mistakes. The red-colored edges and nodes in Fig. 4c are frequently involved in these mistakes: they can be regarded as the intrinsic origins of frustrations in the graph. By detecting such nodes and edges, the learning process increased the success rate to over 80%.

The present Potts solver can be applied to general coloring problems with *M* colors^{37}. For instance, simple scheduling problems^{38} and number puzzles such as Sudoku^{39} can be described by graph colorings. It is straightforward to apply the present solver to cases with \(M\,=\,{2}^{L},\) while a small number of additional nodes (at most *N*) are required to deal with cases in which \(M\,\ne\, {2}^{L}\) (see Supplementary Note 2). For comparison, the usual Ising mapping^{21} requires *MN* nodes (up to \({N}^{2}\)). Thus, the Potts solver can save node resources, which will be a benefit for physical solvers having the limitation of node resources.

## Conclusions

We demonstrated a Potts model solver based on a hybrid architecture composed of physical Ising solvers and digital processing. The Potts problem is mapped onto iterative Ising problems with learning of weights for interactions, where convergence is assured if a physical solver can find a low-energy Ising solution. We experimentally realized it with a CIM and a standard CPU (Intel(R) Xeon(R)). We showed that graph coloring and clustering problems can be solved by using simple Ising models (no magnetic fields were used to introduce constraints and there was no need for a large number of spins). The resource overhead for embedding the problem is significantly suppressed. As a tradeoff, iterative calculations with learning (namely, additional computational time) are required. We expect that this additional time is insignificant if the physical solver is fast enough. The cost of the communication between physical and digital systems is an essential problem of hybrid computation, but it can be significantly suppressed by directly coding the learning logic in CIM’s measurement-feedback systems.

The proposed method approximates an *M*-state Potts problem with *L* (= log_{2}*M*) Ising problems, which means that the method does not guarantee that the ground state of the given Potts problem will be obtained. Although the heuristic feedback schemes that we call domain separation and group reunion significantly improved the solution accuracies, presumably the feedback will not completely compensate for the information lost in dividing a Potts problem into Ising problems for general instances. Nevertheless, we consider that the method is important as a scheme to obtain approximate, but useful solutions to integer optimization problems in a short time, by utilizing very fast computation speed of physical-system based Ising machines and also related algorithms on non-CPU digital devices^{40,41}.

## Methods

### Ferromagnetic solutions as a sign of convergence

By considering \({\Delta E}_{{{{{{\rm{Potts}}}}}}}^{(l)},\) we can find a convergence condition characterized by ferromagnetic solutions. Note that there are degenerate ferromagnetic solutions due to spin inversion symmetry, and the degeneracy \({d}_{{FM}}\) increases as \({d}_{{FM}}\,=\,{2}^{l}\) (or \({d}_{{FM}}\,=\,2{M}^{\left(l\right)}\) to put it more precisely) because of the reduction of the graph and interaction matrix. Equation 3 indicates that these ferromagnetic solutions, except for the complete-down state (\({s}_{i}^{(l)}\,=\,-1\) for all *i*), cause a (trivial) change in the multivalued spins, which can be reduced to steady spin states \({S}_{i}^{\left(l\,+\,1\right)}\,=\,{S}_{i}^{\left(l\right)}\). Accordingly, we can find another expression for the convergence condition \({J}_{{ij}}^{(l\,+\,1)}\,=\,{J}_{{ij}}^{(l)}.\)

### Experimental setup of CIM

As shown in Fig. 1b, the CIM contains a phase-sensitive amplifier (PSA), 1-km fiber ring cavity, and an FPGA module. We employ a periodically poled lithium niobate (PPLN) waveguide as the PSA, which amplifies lights with only the 0 or π phase components relative to the pump phase as a result of signal-idler degenerate optical parametric amplification^{42,43}. These two amplified components express two of the Ising spins. Because the cavity round-trip time is 5 μs and the pump pulse interval is 1 ns, over 5000 DOPO pulses are generated inside the 1-km cavity, from which 512 DOPO pulses are used as artificial Ising spins. The 512 DOPO pulses are mutually coupled by using the measurement and feedback scheme with the FPGA module^{10,26}. We can encode interaction matrix \({J}_{{ij}}\) in the FPGA module with eight-bit integers ranging from −128 to 128. For solving the clustering problem,\({{{{{\rm{max }}}}}}|{J}_{{ij}}|\sim C\,=\,2{N}_{{{{{{\rm{edge}}}}}}}\,=\,184\) exceeds the maximum range of the FPGA module. Thus, \({J}_{{ij}}\) in the CIM is rounded off as \(R({B}_{i}{B}_{j}\,-\,C{A}_{{ij}})\) with \(R\,=\,1/2.\) By performing simulated annealing^{44} calculations without round off, we confirmed that an error caused by this rounding is not critical to the ground-state search.

### Actual computational time

The Ising-solver process of the CIM is completed in 500 μs, which is the time for 100 round trips of DOPO pulses in the 1-km cavity. The obtained spin configurations are stored in the FPGA module and transferred to the CPU to update the interaction matrix of the next stage. The calculations in the digital part take at most 30 μs when both the domain separation and group reunion algorithms are used simultaneously. Since the current FPGA module uses a slow serial communications interface (RS-232C), it takes a few seconds to transfer the annealing results and the updated matrix between the FPGA module and CPU. Although this technical issue is beyond the current scope, it is important to discuss how much we can shorten the transfer time.

For example, by using 10 Gigabit Ethernet (10 Gbps), the transfer time for \({J}_{{ij}}^{(l)}\) consisting of \(8\,\times\, {512}^{2}\) bits is estimated to be 0.2 ms ideally. Note that \({J}_{{ij}}^{(l)}\) can be written as \({J}_{{ij}}^{(l)}\,=\,{W}_{{ij}}^{(l)}{J}_{{ij}}\) with \({W}_{{ij}}^{(l\,+\,1)}\,\equiv\, \delta ({S}_{i}^{(l)},{S}_{j}^{(l)})\). Except for the first stage, it is enough to transfer \({S}_{i}^{(l)}\)of \({{{{{{\rm{log }}}}}}}_{2}M\,\times\, 512\) bits in a few microseconds. Furthermore, we can directly write the \({J}_{{ij}}^{(l)}\)-update logic in an FPGA module, which does not take any time for data transfer, except for the first input and final output. System-on-chip FPGA devices may be used to implement rather complicated feedback algorithms.

### Comparison with other algorithms

We compared our experimental clustering results with other algorithms running on a standard CPU. We used reliable algorithms^{45,46}, namely the Louvain greedy^{34} and Infomap algorithms^{35}. The greedy algorithm reached the same best solution of \({{{{{\rm{Q}}}}}}\,=\,0.646\) with a small rate (about 2%), and it frequently reached the second and third best solution with \({{{{{\rm{Q}}}}}}\,\sim\, 0.643\) (over 70%). The Infomap algorithm reached the best solution with highest probability of about 60% (see Supplementary Note 6). Louvain ran in about a few milliseconds, while Infomap took about a few seconds on an Intel(R) Xeon(R) CPU E5-2697 v2 @ 2.70 GHz. However, the number of nodes was too small to evaluate the run times of these algorithms. A further benchmark study like the one in ref. ^{45} will be left to future work, because the number of nodes is strictly limited in the current setup.

## Data availability

The data that support the plots within this paper and other findings of this study are available from the corresponding authors upon reasonable request.

## Code availability

The modeling is described in the Supplementary Information and the code is available from the corresponding authors upon reasonable request.

## References

Barahona, F. On the computational complexity of Ising spin glass models.

*J. Phys. A***15**, 3241–3253 (1982).Kim, K. et al. Quantum simulation of frustrated Ising spins with trapped ions.

*Nature***465**, 590–593 (2010).Simon, J. et al. Quantum simulation of antiferromagnetic spin chains in an optical lattice.

*Nature***472**, 307–312 (2011).Johnson, M. W. et al. Quantum annealing with manufactured spins.

*Nature***473**, 194–198 (2011).Marandi, A., Wang, Z., Takata, K., Byer, R. L. & Yamamoto, Y. Network of time-multiplexed optical parametric oscillators as a coherent Ising machine.

*Nat. Photonics***8**, 937–942 (2014).Yamaoka, M. et al. 20k-spin Ising chip for combinatorial optimization problem with CMOS annealing.

*Proc. Inter. Solid-State Circ. Conf.***24**, 3 (2015).Mahboob, I., Okamoto, H. & Yamaguchi, H. An electromechanical Ising Hamiltonian.

*Sci. Adv.***2**, e1600236 (2016).Tsukamoto, S., Takatsu, M., Matsubara, S. & Tamura, H. An accelerator architecture for combinatorial optimization problems.

*FUJITSU Sci. Tech. J.***53**, 8–13 (2017).Sutton, B., Camsari, K. Y., Behin-Aein, B. & Datta, S. Intrinsic optimization using stochastic nanomagnets.

*Sci. Rep.***7**, 44370 (2017).Inagaki, T. et al. A coherent Ising machine for 2000-node optimization problems,.

*Science***354**, 603–606 (2016).Denchev, V. S. et al. What is the computational value of finite-range tunneling?

*Phys. Rev. X***6**, 031015 (2016).Ronnow, T. F. et al. Defining and detecting quantum speedup.

*Science***345**, 420–424 (2014).Boixo, S. et al. Computational multiqubit tunnelling in programmable quantum annealers.

*Nat. Commun.***7**, 10327 (2016).Parihar, A., Shukla, N., Jerry, M., Datta, S. & Raychowdhury, A. Vertex coloring of graphs via phase dynamics of coupled oscillatory networks.

*Sci. Rep.***7**, 911 (2017).Sakaguchi, H. et al. Community detection by laser network dynamics.

*J. Phys. Commun.***2**, 015005 (2018).Yin, X. et al. Efficient analog circuits for boolean satisfiability.

*IEEE Trans. Very Large Scale Integr. Syst.***26**, 155–167 (2018).Kalinin, K. P. & Berloff, N. G. Simulating Ising and n-state planar potts models and external fields with nonequilibrium condensates.

*Phys. Rev. Lett.***121**, 235302 (2018).Honari-Latifpour, M. & Miri, M. A. Optical Potts machine through networks of three-photon down-conversion oscillators.

*Nanophotonics***9**, 4199–4205 (2020).Wu, F. Y. The Potts model.

*Rev. Mod. Phys.***54**, 235 (1982).Essam, J. W. Percolation theory.

*Rep. Prog. Phys.***43**, 833 (1980).Lucas, A. Ising formulations of many NP problems.

*Front. Phys.***2**, 5 (2014).Narimani, A. et al. Combinatorial optimization by decomposition on hybrid CPU–non-CPU solver architectures.

*arXiv*https://doi.org/10.48550/arXiv.1708.03439 (2017).D-wave hybrid solver service: an overview. D-Wave Technical Report 14-1039A-A https://www.dwavesys.com/media/4bnpi53x/14-1039a-b_d-wave_hybrid_solver_service_an_overview.pdf (white paper) (2020).

Utsunomiya, S., Takata, K. & Yamamoto, Y. Mapping of Ising models onto injection-locked laser systems.

*Opt. Express***19**, 18091–18108 (2011).Inagaki, T. et al. Large-scale Ising spin network based on degenerate optical parametric oscillators.

*Nat. Photonics***10**, 415–419 (2016).McMahon, P. L. et al. A fully-programmable 100-spin coherent Ising machine with all-to-all connections.

*Science***354**, 614–617 (2016).Fortunato, S. Community detection in graphs.

*Phys. Rep.***486**, 75–174 (2010).Schwarz, A. J. et al. Community structure and modularity in networks of correlated brain activity.

*Magn. Reson. Imag.***26**, 914–920 (2008).Viana, M. P. et al. Modularity and robustness of bone networks.

*Mol. Biosyst.***5**, 255–261 (2009).Newman, M. E. J. & Girvan, M. Finding and evaluating community structure in networks.

*Phys. Rev. E***69**, 026113 (2004).Reichardt, J. & Bornholdt, S. Statistical mechanics of community detection.

*Phys. Rev. E***74**, 016110 (2006).Ronhovde, P. & Nussinov, Z. Multiresolution community detection for megascale networks by information-based replica correlations.

*Phys. Rev. E***80**, 016109 (2009).Hameley, R. et al. Experimental investigation of performance differences between Coherent Ising Machines and a quantum annealer.

*Sci. Adv.***5**, eaau0823 (2019).Blondel, V. D. et al. Fast unfolding of communities in large networks.

*J. Stat. Mech. Theory Exp.***10**, P1000 https://sites.google.com/site/findcommunities/ (2008).Rosvall, M. & Bergstrom, C. T. Maps of random walks on complex networks reveal community structure.

*PNAS***105**, 1118–1123 (2008).Appel, K. & Haken, W. Every map is four colorable.

*Bull. Am. Math. Soc.***82**, 711–712 (1976).Lewis, R. A guide to graph colouring: algorithms and applications. (Springer International Publishers, 2015).

Marx, D. Graph colouring problems and their applications in scheduling,

*Period. Polytech. Electr. Eng.***48**, 1–2 (2004).Rosenhouse, J. & Taalman, L. Taking Sudoku Seriously: The Math Behind the World’s Most Popular Pencil Puzzle. (Oxford University Press, 2012).

King, D. et al. Emulating the coherent Ising machine with a mean-field algorithm.

*arXiv*https://doi.org/10.48550/arXiv.1806.08422 (2018).Tiunov, E. S., Ulanov, A. E. & Lvovsky, A. I. Annealing by simulating the coherent Ising machine.

*Opt. Express***7**, 10288–10295 (2019).Marhic, M. E., Hsia, C. H. & Jeong, J. M. Optical amplification in a nonlinear fiber interferometer.

*Electron. Lett.***27**, 210–211 (1991).Li, R.-D., Kumar, P. & Kath, W. L. Dispersion compensation with phase-sensitive optical amplifiers.

*J. Light. Technol.***12**, 541–549 (1994).Kirkpatrick, S., Gelatt, C. D. Jr. & Vecchi, M. P. Optimization by simulated annealing.

*Science***220**, 671–680 (1983).Lancichinetti, A. & Fortunato, S. Community detection algorithms: a comparative analysis.

*Phys. Rev. E***80**, 056117 (2009).Danon, L. et al. Comparing community structure identification.

*J. Stat. Mech.***2005**, P09008 (2005).

## Acknowledgements

This research was funded by the Impulsing Paradigm Change through Disruptive Technologies (ImPACT) Program of the Council of Science, Technology and Innovation (Cabinet Office, Government of Japan). The authors thank Hiroyuki Tamura for his support during this research.

## Author information

### Authors and Affiliations

### Contributions

K.Inaba, T.Inagaki, and H.T. proposed the project. K.Inaba performed the numerical simulations and data analysis. T.Inagaki performed the experiments. K.Inaba, T.Inagaki, K.Igarashi., S.U., T.H., T.Ikuta, K.Inoue, Y.Y. and H.T. contributed to building the system of coherent Ising machine. K.E., T.U., and R.K. contributed to building the PPLN modules. K.Inaba, T.Inagaki and H.T. wrote the paper with inputs from all authors.

### Corresponding authors

## Ethics declarations

### Competing interests

The authors declare no competing non-financial interests but the following competing financial interests: K.Inaba., H.T., T.H., and T.Inagaki are inventors on patent JP6684259 and JP6796213 awarded in 2020 to NTT that covers a scheme of a Potts model solver based on a coherent Ising machine. T.U. and K.E. are inventors on patent JP5856083 awarded in 2016 to NTT that covers phase-sensitive amplifiers based on periodically poled lithium niobate waveguides. T.Inagaki, H.T., T.H., S.U., Y.Y., and K.Igarashi are inventors on patent JP6429346 awarded in 2018 to NTT, National Institute of Informatics, and Osaka University that covers a scheme for a coherent Ising machine. All other authors declare no competing interests.

## Peer review

### Peer review information

*Communications Physics* thanks the anonymous reviewers for their contribution to the peer review of this work.

## Additional information

**Publisher’s note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Supplementary information

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Inaba, K., Inagaki, T., Igarashi, K. *et al.* Potts model solver based on hybrid physical and digital architecture.
*Commun Phys* **5**, 137 (2022). https://doi.org/10.1038/s42005-022-00908-0

Received:

Accepted:

Published:

DOI: https://doi.org/10.1038/s42005-022-00908-0

## Comments

By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.