In this chapter, we propose the physical prototype of Spring-Ising Algorithm and how to apply Lagrange's equations to iterate spin states by symplectic method. Spring-Ising Algorithm is inspired by physical phenomena, spring vibrations. The detail of physical prototype is introduced as follow.
1. Spring vibration model
The Ising model is defined as follow:
$$H=-{\sum }_{1\le i<j\le N}^{ }Jij\sigma i\sigma j-{\sum }_{1\le i\le N}^{ }hi\sigma i$$
1
The discrete variable \({\sigma }_{i}\) is the \(i\)th Ising spin state such that \({\sigma }_{j}\in \left\{-1, +1\right\}\). In Pauli matrices, the variable \({\sigma }_{i}\) assigns values \(\left\{-1, +1\right\}\) to spin values \(\left\{\downarrow , \uparrow \right\}\) [17]. \({J}_{ij}\) denotes a coupling coefficient between the \(i\)th and \(j\)th spins and \({h}_{i}\) is an external magnetic coefficient for the \(i\)th spin. \(H\) is the total energy of the Ising model and it tends to the lowest energy.
Inspired by the steady-state analysis of multiple mass-spring system in analytical mechanics, the ground state research method of the Ising model in this paper is designed. In Ising model, the state of the \(i\)th spin \(\uparrow (\downarrow )\) is encoded as a discrete variable corresponding to a value of \(+1(-1)\). We regard the discrete variable as the continuous change of the mass point in the macroscopic position, which is defined as the generalized coordinate \({q}_{i}\in [-\text{1,1}]\). On this basis, the spring model is designed by considering a mass point connected at an ideal spring with no initial length and the spring force on the mass point is always pointing to one point, called the origin point. As shown in Fig. 1(a), the spring is fixed at the origin point, and the other end is the mass point representing the state of spin. Since the initial length of the spring is zero, when the mass point moves away from the origin, it is pulled by the spring. In this model, the mass point is above(below) the origin to represent the spin \(\uparrow (\downarrow )\), and the distance is represented as a degree of confidence. According to the coupling coefficient and spin state, the Ising model produces a number of forces along a line along the \({q}_{i}\) axis. Therefore, the direction of the resultant force is also on the \({q}_{i}\) axis, as shown in Fig. 1(b).
In the model, while a spin considered as a mass point is called the target spin, the other spins are called the source spins providing external force to the target spins. The magnitude and direction of \({F}_{i}\) depend on the combined effect of multiple source spins but have nothing to do with the state of the target spin. Figure 2(a) gives a specific example, when the state of source spin is \(+1\), if the coupling coefficient is positive, an upward force will be generated. The greater the coupling coefficient, the greater the force generated. In the same way, if the coupling coefficient is negative, a downward force will be generated. When the coupling coefficient is zero, the source spin provides no force. The superposition of all the forces provided by the source spin is the force of the Ising model coupling relationship for the mass point \(i\). When the state of origin spin is \(-1\), the direction of the force is opposite, as shown in Fig. 2(b).
The generalized coordinate introduced by the model is a continuous variable, which means that the magnitude of the force is also affected by the absolute value of the generalized coordinate from the source spin. So, the source spin is changed to the source spin generalized coordinate: \({\sigma }_{i}\in \{-\text{1,1}\}\to {q}_{i}\in [-\text{1,1}]\). When the absolute value of the generalized coordinates is greater, the spring potential energy contained in the spring vibration model is greater. For the Ising model, the greater source spin has a greater overall influence on the system to the target spin and vice versa. Therefore, the discrete Ising model energy in Eq. (1) is set to the continuous Ising model energy in the spring vibration model.
2. Ground state search method
After establishing the spring vibration model, the following is how to use the model to find the ground state of Ising model. This method regards the potential energy of the Ising model as the ordinary potential energy and converts the potential energy of the Ising model into the potential energy of the spring and the kinetic energy of the system. The Ising model energy gradually decreases and transforms into the potential energy of the spring. Then, due to the constraints of generalized coordinates and generalized velocity, the energy originally converted into spring potential energy, continuous Ising model energy and kinetic energy is absorbed by the inelastic wall. The energy of the whole system gradually decreases and thus converges to the spring potential energy and the energy of the Ising model near the ground state.
According to the various constraints of this system, the Lagrangian equation is constructed as follows:
$$L({q}_{i},\dot{{q}_{i}},t)={\sum }_{i}^{ }m{\dot{{q}_{i}}}^{2}-{\sum }_{i}^{ }\frac{1}{2}{k\left({q}_{i}-{q}_{0}\right)}^{2}-{\zeta H}_{Ising}\left({q}\right)$$
2
Where \(m\) is the mass coefficient, \(k\) is the elastic coefficient, and \(\zeta\) is the scaling coefficient of the Ising model energy. The three terms of the mass point in Eq. (2) are the kinetic energy term, the spring potential energy term and the continuous Ising model energy term. In the spring vibration model, the generalized coordinates are independent of \(t\). It can be seen from the formula that the movement of the mass points is affected by the potential energy of the spring and the energy of the Ising model. The movement of the mass points is manifested as a continuous vibration on the ideal springs. From another perspective, it can be considered that when the spring is doing simple harmonic motion, a set of external forces are applied from the outside. Affected by the coupling coefficient of the Ising model, the oscillations of the mass points are biased towards the lower Ising model energy.
3. Symplectic method
Since the size of the Ising model depends on the number of spins, the solution scale is quite large. Therefore, it is very difficult to solve the Lagrangian equation directly and accurately. In this paper, referring to the Hamiltonian and symplectic method [46], the numerical iterative calculation of the spring vibration model is carried out. The Hamiltonian describes the total energy of the system and can be used to describe the system's dynamic behavior. Symplectic method is numerical method used to solve Hamilton's equations and it preserves energy conservation of the system.
According to the definition, the generalized momentum \({p}_{i}\) is obtained as \(\partial L/\partial \dot{q}=m\dot{{q}_{i}}\). The Hamiltonian of the system is obtained by performing the Legendre transformation on the Lagrangian quantity:
$$H\left(q, p, t\right)=\sum _{i}\dot{{q}_{i}}{p}_{i}-L\left({q}_{i},\dot{{q}_{i}},t\right)=\sum _{i}\frac{1}{2}\dot{{q}_{i}}{p}_{i}+\sum _{i}\frac{1}{2}{k\left({q}_{i}-{q}_{0}\right)}^{2}+{\zeta H}_{Ising}\left({q}\right)$$
3
Get Hamilton's equation:
$$\dot{{q}_{i}}=\frac{\partial H}{\partial {p}_{i}}\dot{{p}_{i}}=-\frac{\partial H}{\partial {q}_{i}}=-k\left({q}_{i}-{q}_{0}\right)+\zeta \sum _{j}{w}_{ij}{q}_{j}$$
4
Use the symplectic algorithm to solve the Hamiltonian system, and set the system origin to \({q}_{0}\):
$${q}_{i}\left({t}_{n+1}\right)={q}_{i}\left({t}_{n}\right)+{\Delta }\dot{{q}_{i}}\left({t}_{n}\right)={q}_{i}\left({t}_{n}\right)+\frac{{\Delta }}{m}{p}_{i}\left({t}_{n}\right){p}_{i}\left({t}_{n+1}\right)={p}_{i}\left({t}_{n}\right)+{\Delta }\dot{{p}_{i}}\left({t}_{n}\right)={p}_{i}\left({t}_{n}\right)-{\Delta }k{q}_{i}\left({t}_{n}\right)+\zeta {\Delta }\sum _{j}{J}_{ij}{q}_{j}\left({t}_{n}\right)$$
5
Where \({t}_{n}\) is the \(n\)th iteration. It can be seen from the above formula that \({q}_{i}\left({t}_{n}\right)\) and \({p}_{i}\left({t}_{n}\right)\) depend on the value of the previous state. With the iteration of the value, the energy is continuously converted. As the energy of the Ising model decreases, the solution is gradually approaching the ground state of the Ising model. Dimensional issues are not considered in numerical calculations, so parameters can be combined. The Eq. (5) is called the iterative formula of Spring-Ising Algorithm.
4. Point convolutional neural network
In the iterative calculation of the algorithm, the most important calculation is multiplication of \({J}_{ij}\) and \({q}_{i}\left({t}_{n}\right)\). A method of iterative calculation using point convolution to replace the product of vector and matrix is proposed, so that the algorithm can be used in high-bandwidth computing chips, like GPU and AI chip. Moreover, the point convolution is optimized in the hardware design to reuse the convolution kernel and reduce data access to accelerate the computation in parallel. Figure 3 shows an alternative way of turning the iterative equation into the neural network architecture computation. \({q}_{i}\left({t}_{n}\right)\) of a single test is assigned at fixed coordinate of the feature map, so the number of generalized coordinates and feature maps are the same. The size of the point convolution kernel also depends on the coupling relationship matrix of the Ising model so that the number of convolution kernel is \(n\), and the number of convolution kernel channels is \(n\). The rest of the architecture is the addition module, which can be completed through the residual structure in the neural network and is supported in mainstream AI chips.