WorksPhysics and Astronomy
Solving combinatorial optimization problems through stochastic Landau-Lifshitz-Gilbert dynamical systems
Abstract
We present a method to approximately solve general instances of combinatorial optimization problems using the physical dynamics of 3d rotors obeying Landau-Lifshitz-Gilbert dynamics. Conventional techniques to solve discrete optimization problems that use simple continuous relaxation of the objective function followed by gradient descent minimization are inherently unable to avoid local optima, thus producing poor-quality solutions. Our method considers the physical dynamics of macrospins capable of escaping from local minima, thus facilitating the discovery of high-quality, nearly optimal solutions, as supported by extensive numerical simulations on a prototypical quadratic unconstrained binary optimization (QUBO) problem. Our method produces solutions that compare favorably with those obtained using state-of-the-art minimization algorithms (such as simulated annealing) while offering the advantage of being physically realizable by means of arrays of stochastic magnetic tunnel junction devices.
Introduction. A compelling idea linking physics and discrete mathematics is to leverage the intrinsic dynamics of real-world physical systems to solve mathematical optimization problem. The idea relies on correspondence between the variables of the mathematical problem and the degrees of freedom of an analogue physical system, where the role of the objective function to be optimized is played by the energy function of the interacting physical system [1, 2, 3, 4]. Once this correspondence has been successfully established, all one has to do is to cool the system down to zero temperature and wait for it to settle in its ground state, i.e., the state with minimal energy, which, in turn, represents the solution to the original optimization problem [5]. In many cases of practical interest, this is easier said than done in that during the cooling process the physical system can get stuck in long-lived metastable states, possibly without ever reaching the ground state on human-life timescales. In such situations, the choice of the analogue physical system becomes the crucial point of the entire methodology. Physical systems that are less prone to getting trapped in the local minima of the energy function will solve the optimization problem better than those that get easily stuck.
Many interesting optimization problems are discrete in nature, meaning that the variables involved are represented by integers, typically taking up only two values, say 0 and 1. A large body of work has thus exploited the idea of using Ising-type physical systems to effectively map integer variables onto binary spins and then use Monte Carlo methods or alike to simulate the physical dynamics of these analogue Ising machines to find their ground state. These techniques have been studied extensively in the literature (see, for example, references [1, 2, 3, 6]).
In this article, we present a new energy-minimization framework to solve combinatorial optimization problems based on the physical dynamics of real macrospins described by the Landau-Lifshitz-Gilbert (LLG) equations. The idea is to use 3-dimensional rotors as the analogue physical dynamical system, rather than up-down Ising spins. The rationale behind our approach is the physical gambit that trajectories away from the -axis, in particular, those occurring halfway between the north and south poles of the unit sphere will help the system to escape from local solutions, thus facilitating the discovery of the true ground-state.
We explain our method in two steps: first, we introduce the stochastic LLG dynamical system and discuss its numerical implementation; second, we explain how to apply it to a specific QUBO problem, called the Sherrington–Kirkpatrick model in statistical physics [7, 8], which can be exactly solved in the thermodynamic limit [9], and show that our method extrapolates to this exact value while performing systematically better than discrete methods based on Glauber dynamics of Ising spins [10].
Stochastic-LLG Dynamics
We consider a system consisting of single-domain ferromagnets, and apply the macrospin approximation to each domain. The magnetization of the spins in the domain are averaged to a single giant magnetic moment , with magnitude and direction , as illustrated in Figure 1. The micromagnetic energy of our macrospins system has three terms: the energy from the exchange interaction between each moments , the energy from the magnetic anisotropy determined by the crystallographic structure of the domain, , and the Zeeman energy from an external magnetic field applied to the system, . Summarizing:

Figure 1. Schematic description of our method. First, we encode the solution of the optimization problem into the ground state of the spin system’s Hamiltonian. The parameters model the interactions between pair of macrospins. Here we only show couplings between neighbouring spins for illustration purposes. In general, the connections are not restricted to the nearest neighbours. Anisotropy is set along the axis of each spin via a magnetic anisotropy field favoring the north-south direction. After initializing the macrospins in random directions on the unit sphere, the system is cooled from high to low temperature. At high temperatures, each macrospin experiences large thermal fluctuations with trajectories densely covering the unit sphere. As the system cools to lower temperatures, the fluctuations are reduced and the spins trajectories tend to confine into small regions around the poles of the unit sphere. The dynamical trajectories of a single macrospin during the annealing process is depicted in green on the left-hand side of the illustration. Eventually, the system reaches the end of the annealing schedule and spins stabilize around the north and south poles. The spins’ final states are binarized based on their up or down direction to get a direct readout of the solution to the original problem.
The expression for each term is given by:
where is the vacuum permeability, characterizes the magnetic anisotropy of moment , and is the unit vector characterizing the preferred crystallographic direction of moment (which later we take to be along the -axis, see Figure 2). The summation over is over pairs of connected spins. Vector is an external local magnetic field acting on the magnetic moment. has units of field and it characterizes the general scale of the exchange coupling strength. Coupling terms are dimensionless and characterize the exchange interaction between magnetic moments.

Figure 2. Illustration of Ising spin and macrospin. Ising spins can only take two values, . Macrospins, on the other hand, have extra degrees of freedom when rotating on the unit sphere.
Each magnetic moment evolves according to the Landau-Lifshitz-Gilbert (LLG) equation [11]:
where , with the gyromagnetic ratio of the moment, and is the damping constant. Vector is the effective field experienced by the magnetic moment, given by
To incorporate thermal fluctuations into the dynamics we add a thermal field to by the substitution
The thermal fields are delta-correlated zero mean random variables in time, with a correlation given by [12, 13]:
where , is the Boltzmann constant, and is the temperature. Integrating Eq. (9) over a small time interval , we obtain the standard deviation of as
In practice, for each component of , we draw a value from a Gaussian distribution with mean and standard deviation given by in Eq. (10). Finally, to integrate the stochastic differential equation we apply Heun’s integration scheme [14].
In our simulation, we assume that each macrospin has the same crystallographic structure. All parameters related to the material properties are the same across all domains, therefore the index of the following quantities are omitted: , , , , and the crystallographic direction for each spin is set along the -axis, . We also assume each magnetic moment has the same magnitude, for all macrospins. This simplification models an array of perfectly identical macrospins. The simulation can be further simplified to only consider the evolution of the unit magnetic moment . Given the assumptions above, we can think of our model as a system of identical dynamical bits. At the end of the simulation, a projection on the -axis, given by , maps the macrospin onto a binary Ising-like spin , as illustrated in Figure 2.
The values of the parameters used in our simulation are listed in Table I. The values we chose here are within those of the fluctuating, the so-called free layer, of magnetic tunnel junction nanopillars [15].
With these parameters, we implement an annealing schedule to mimic the physical cooling of the system from ambient temperature down to the low-temperature regime. Ideally, the annealing schedule should be performed slowly from to K. In practice, we choose an annealing schedule with intermediate temperatures drawn from a distribution , with , in order to have more values in the low temperature regime.
| Damping Constant | 0.01 | |
| Magnetic Moment | ||
| Ambient Temperature | 300 K | |
| Exchange Field | ||
| Anisotropy Field | ||
| Simulation Time Step | 0.01 ns | |
| Iterations at Each Temperature |
Table 1. Values of the parameters chosen for simulation.
Having explained how to simulate the general stochastic-LLG dynamical system, we move next to discuss its application to the SK model.
Results
Here we show the simulation results for the SK model using the LLG dynamics described above. We also run a Glauber dynamics for comparison [10]. The Hamiltonian of the SK model for a -spin system is given by:
where are Ising spins, is the exchange interaction between the and spins. Couplings are independent and identically distributed random variables drawn from a Gaussian distribution with zero mean and variance . The summation only counts a pair of once. The ground state energy has been calculated analytically in the limit of infinite system size [9] and is given by
We can map the Hamiltonian onto our LLG model by directly mapping the terms in Eq. (11) to the terms in Eq. (2). The term in Eq. (4) is set to zero since there is no external field applied in the SK model. With the anisotropy term favoring each spin to align along the -axis, , the ground state of the SK model is mapped onto the ground state of the LLG system once we binarize the macrospins using their -projections as illustrated in Figure 2. Thus, the analogue LLG Hamiltonian reads
We solve the SK model for several system sizes, ranging from to 2000, using both Glauber and LLG dynamics and record the value of the final energy obtained with both methods. As shown in Figure 3, our LLG method performs better, i.e., lower energies are consistently found for any value of .

Figure 3. Histograms of the final energies obtained from LLG dynamics (orange bars) and Glauber dynamics (blue bars) for , , and . The colored vertical dashed lines represent the average values of the corresponding distributions. To make the histograms we used 300 samples for , 103 for , and 112 for .
In Figure 4 we plot the average ground state energy per spin, , obtained from Glauber and LLG as a function of [16]. We observe that the LLG dynamics results extrapolate to as , which is very close to the exact optimal value Eq. (12), while the Glauber dynamics results intercept the axis at a higher sub-optimal asymptotic value .

Figure 4. Average ground state energy per spin as a function of [16] for Glauber (blue line) and LLG (orange line) dynamics. The horizontal dashed line represents the asymptotic exact ground state energy given by Eq. (12). Data points from the LLG dynamics plausibly extrapolate to the true optimal value. Error bars indicate the standard error of the mean energy per spin.
Recently it is has been shown, assuming a widely believed conjecture about the SK model, that there is a polynomial time algorithm for finding (with high probability) a string whose energy is between the lowest energy and of the lowest energy of the problem [17]. Our results suggest we can achieve similar performance.
As a point of reference, if the algorithm would get stuck at the critical point of the SK model (at ) the typical energy per spin would be . However, even greedy spin flip dynamics, in which one only accepts flips if they lower the energy, results in a energy of around and this algorithm terminates in a time of . In contrast, spectral relaxation in which one binarizes the lowest energy eigenvector of only achieves an energy of while being computationally more costly [18]. Finally, quantum methods have been proposed to solve the SK problem [20] [19]. In particular, rigorous analysis of the Quantum Approximate Optimization Algorithm (QAOA) in Ref. [20] shows that at (with being the number of layers in the quantum circuit) one can outperform the spectral relaxation result. Although the limit of is not established, the results in [20] indicate convergence to the Parisi value like where . However, the cost of evaluating the circuit parameters is of such that one incurs an exponential cost in in order to get close to the ground state. While this cost might be brought down, it would currently be prohibitively expensive to reach the LLG results as would have to be about . Interestingly, the LLG dynamics is simply the semi-classical approximation of the real quantum dynamics of these spins, suggesting that we still have much to learn about these quantum algorithms.
As in the case of quantum annealing, our method is important because it offers the possibility of being realized experimentally in the lab by means of arrays of magnetic tunnel junction devices, whose physical dynamics is governed precisely by the LLG equations. These devices operate at nanosecond timescales and consume little power. Interesting future research directions would be to understand the statistical limits of the robustness of our method across different choices of the system’s parameters, as well as the inclusion of 3-spin interactions to solve 3-SAT problems, which are of central importance in the vast context that stretches from artificial intelligence, to cryptography, and operations research.
Acknowledgements. We thank Jonathan Z. Sun and Daniel L. Stein for helpful discussions. This work was supported in part through the NYU IT High Performance Computing resources, services, and staff expertise. This research was supported by the Office of Naval Research (ONR) under Award No. N00014-23-1-2771. The Flatiron Institute is a division of the Simons Foundation. We acknowledge support from Air Force Office of Scientific Research(AFOSR): Grant FA9550-21-1-0236.
References
- [1]M. Mezard and A. Montanari, Information, Physics, and Computation (Oxford University Press, Inc., USA, 2009).DOI
- [2]F. Krzakala, F. Ricci-Tersenghi, L. Zdeborova, R. Zecchina, E. W. Tramel, and L. F. Cugliandolo, Statistical Physics, Optimization, Inference, and Message-Passing Algorithms: Lecture Notes of the Les Houches School of Physics: Special Issue, October 2013 (Oxford University Press, 2015).DOI
- [3]C. Moore and S. Mertens, The Nature of Computation (Oxford University Press, 2011).DOI
- [4]Y. Fu and P. W. Anderson, Application of statistical mechanics to np-complete problems in combinatorial optimization, Journal of Physics A: Mathematical and General 19, 1605 (1986).DOI
- [5]S. Kirkpatrick, C. D. Gelatt, and M. P. Vecchi, Optimization by simulated annealing, Science 220, 671 (1983).
- [6]N. Mohseni, P. L. McMahon, and T. Byrnes, Ising machines as hardware solvers of combinatorial optimization problems, Nature Rev. Phys. 4, 363 (2022).arxiv.org/abs/2204.00276
- [7]D. Sherrington and S. Kirkpatrick, Solvable model of a spin-glass, Phys. Rev. Lett. 35, 1792 (1975).
- [8]S. Arora, E. Berger, E. Hazan, G. Kindler, and M. Safra, On non-approximability for quadratic programs, in Proceedings - 46th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2005, Proceedings - Annual IEEE Symposium on Foundations of Computer Science, FOCS (2005) pp. 206–215, 46th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2005 ; Conference date: 23-10-2005 Through 25-10-2005.
- [9]G. Parisi, The order parameter for spin glasses: a function on the interval 0-1, Journal of Physics A: Mathematical and General 13, 1101 (1980).
- [10]R. J. Glauber, Time-Dependent Statistics of the Ising Model, Journal of Mathematical Physics 4, 294 (1963).DOI
- [11]E. M. Lifshitz and L. P. Pitaevskii, Statistical physics part 2, (1980).
- [12]W. F. Brown, Thermal Fluctuations of a Single-Domain Particle, Physical Review 130, 1677 (1963).
- [13]J. L. García-Palacios and F. J. Lázaro, Langevin-dynamics study of the dynamical properties of small magnetic particles, Phys. Rev. B 58, 14937 (1998).
- [14]S. Ament, N. Rangarajan, A. Parthasarathy, and S. Rakheja, Solving the stochastic Landau-Lifshitz-Gilbert-Slonczewski equation for monodomain nano-magnets : A survey and analysis of numerical techniques, arXiv: Computational Engineering, Finance, and Science (2016).
- [15]A. D. Kent and D. C. Worledge, A new spin on magnetic memories, Nature Nanotechnology 10, 187 (2015).DOI
- [16]G. Parisi, F. Ritort, and F. Slanina, Several results on the finite-size corrections in the sherrington-kirkpatrick spin-glass model, Journal of Physics A: Mathematical and General 26, 3775 (1993).
- [17]A. Montanari, Optimization of the sherrington-kirkpatrick hamiltonian, in 2019 IEEE 60th Annual Symposium on Foundations of Computer Science (FOCS 2019) pp. 1417–1433.arxiv.org/abs/1812.10897
- [18]M. Aizenman, J. L. Lebowitz, and D. Ruelle, Some rigorous results on the sherrington-kirkpatrick spin glass model, Communications in Mathematical Physics 112, 3 (1987). H. Putterman, C. Quintana, P. Roushan, N. C. Rubin, D. Sank, A. Skolik, V. Smelyanskiy, D. Strain, M. Streif, M. Szalay, A. Vainsencher, T. White, Z. J. Yao, P. Yeh, A. Zalcman, L. Zhou, H. Neven, D. Bacon, E. Lucero, E. Farhi, and R. Babbush, Quantum approximate optimization of non-planar graph problems on a planar superconducting processor, Nature Physics 17, 332 (2021).
- [20]E. Farhi, J. Goldstone, S. Gutmann, and L. Zhou, The Quantum Approximate Optimization Algorithm and the Sherrington-Kirkpatrick Model at Infinite Size, Quantum 6, 759 (2022).DOI