A spin glass can look deceptively simple on paper. Each spin takes a value of plus or minus one and interacts with a small number of neighbors. Yet conflicting preferences between neighboring spins can create a complicated energy landscape. Finding a low-energy state is a useful test of optimization methods that operate on sparse interactions.
Count the interactions before solving
Consider a cubic lattice of side L with open boundaries and nearest-neighbor bonds. There are L3 spins. In each of the three coordinate directions there are (L − 1)L2 bonds. A Hamiltonian can be written as H(s) = − ∑ij∈ EJijsisj where the couplings J are fixed. The binary transformation si = 2xi − 1 produces a QUBO with the same interaction graph, together with linear terms and a constant offset.
For a periodic lattice with L ≥ 3, the number of distinct nearest-neighbor bonds is 3L3. The boundary convention matters both to the model and to comparisons of energy per spin.
On a square plaquette, three ferromagnetic bonds and one antiferromagnetic bond cannot all be satisfied: the product of their preferred spin-pair signs is negative, whereas the product of actual spin pairs around the cycle is positive. This is a simple instance of frustration.
Illustration: standalone Python calculation.
L=100
n=L**3
m=3*(L-1)*L**2
assert (n,m)==(1_000_000,2_970_000)
print(n,m) The graph can be generated one plane at a time, with a fixed rule for the node index and a deterministic generator for the coupling values. A sparse representation avoids the memory cost of an unnecessary dense matrix.
Check energy independently
For a returned spin vector, evaluate each bond exactly once using the original coupling values. If a solver works in binary coordinates, convert the assignment back to spins first. Include the constant offset when comparing its reported objective with the Hamiltonian. Integer-valued couplings make this check particularly simple.
The energy of any spin configuration is an upper bound on the minimum energy. A literature estimate of the thermodynamic-limit ground-state energy density is not necessarily a bound on a finite instance. Label comparisons to such estimates as differences from a reference value, rather than certified optimality gaps. For small lattices, exact methods or mathematical lower bounds can provide a firmer reference.
Evaluate the cost of the complete workflow
For larger lattices, record generation and transfer time separately from optimization time. Repeat the search at several budgets using the same instance, with a clearly stated convention for seeds and reused state. Compare energy per spin, the absolute objective and the distribution of final results. Where possible, include the sequence of intermediate feasible energies.
The interesting question is how quickly a method can improve a solution as the lattice grows and how the quality changes with additional computation. The answer depends on the interaction distribution, the boundary conditions and the reference used. A reproducible lattice family makes those dependencies visible.
Use the 4colors Optimizer for QUBO to investigate sparse Ising and binary quadratic models.