A Quantum-Inspired Algorithm for Solving Sudoku Puzzles and the MaxCut Problem

M. Zhao, Li FeiarXiv 2025 · DOI

Abstract: We propose and evaluate a quantum-inspired algorithm for solving Quadratic Unconstrained Binary Optimization (QUBO) problems, which are mathematically equivalent to finding ground states of Ising spin-glass Hamiltonians. The algorithm employs Matrix Product States (MPS) to compactly represent large superpositions of spin configurations and utilizes a discrete driving schedule to guide the MPS toward the ground state. At each step, a driver Hamiltonian -- incorporating a transverse magnetic field -- is combined with the problem Hamiltonian to enable spin flips and facilitate quantum tunneling. The MPS is updated using the standard Density Matrix Renormalization Group (DMRG) method, which iteratively minimizes the system's energy via multiple sweeps across the spin chain. Despite its heuristic nature, the algorithm reliably identifies global minima, not merely near-optimal solutions, across diverse QUBO instances. We first demonstrate its effectiveness on intermediate-level Sudoku puzzles from publicly available sources, involving over $200$ Ising spins with long-range couplings dictated by constraint satisfaction. We then apply the algorithm to MaxCut problems from the Biq Mac library, successfully solving instances with up to $251$ nodes and $3,265$ edges. We discuss the advantages of this quantum-inspired approach, including its scalability, generalizability, and suitability for industrial-scale QUBO applications.

Introduction

Many industrial challenges—from logistics to drug discovery—can be framed as Quadratic Unconstrained Binary Optimization (QUBO) problems. These are NP-hard, meaning as the problem size grows, the time required to find the perfect solution explodes. While Quantum Annealing (QA) and the Quantum Approximate Optimization Algorithm (QAOA) are designed for these tasks, they face a "hardware wall" due to limited connectivity and environmental noise. This paper presents a classical approach that borrows the mathematical framework of quantum mechanics to solve these complex optimization problems efficiently on standard hardware.

Methodology

The algorithm combines two powerful techniques from condensed matter physics: Matrix Product States (MPS) and the Density Matrix Renormalization Group (DMRG). MPS allows for the compact representation of a "superposition" of a massive number of possible solutions without requiring exponential memory. DMRG is then used to iteratively find the lowest-energy state, or "ground state," of the system.

A novel Discrete Driving Schedule is employed to guide the search. Unlike traditional quantum annealing, which uses a continuous process, this algorithm uses a "hop, sweep, repeat" approach. It typically takes about 10 discrete steps, gradually decreasing a "driver" Hamiltonian (which enables quantum-like tunneling through energy barriers) while increasing the "problem" Hamiltonian (which encodes the specific constraints of the task). At each step, DMRG "sweeps" through the variables to refine the configuration.

Experimental Setup and Problem Mapping

The algorithm was stress-tested on two distinct types of problems:

  • Sudoku Puzzles: Sourced from The New York Times, these were converted into Ising spin models with up to 250 spins and over 1,200 long-range couplings. Sudoku serves as a "worst-case" benchmark because it is entirely constraint-driven; a single incorrect digit invalidates the entire solution.
  • MaxCut Problems: Instances from the Biq Mac Library were used, featuring up to 251 nodes and 3,433 edges.
Local magnetic field values $h_m^z$ for each spin index $m$ across different problem instances, illustrating the heterogeneous nature of the mapped QUBO constraints.

Key Results and Insights

The algorithm reliably identified global optima, not just near-optimal solutions, across both Sudoku and MaxCut instances. Key observations include:

  • Connectivity Handling: It successfully solved MaxCut problems with over 3,200 edges, exceeding the connectivity capabilities of current quantum annealers like D-Wave’s Pegasus graph.
  • Efficiency and Scalability: All calculations were performed on a standard laptop (Apple M3 chip) within minutes to an hour. The computational cost scales as $O(N_s D^3 M)$, where $N_s$ is the number of variables and $D$ is the bond dimension, suggesting strong potential for larger-scale applications.
  • Diagnostic Transparency: Unlike physical quantum computers, the MPS approach allows researchers to visualize the solution process and identify the inflection points where spins settle into their final states.

Conclusion

While the algorithm is heuristic and requires tuning of parameters like the bond dimension ($D$), its performance on medium-scale NP-hard problems is highly promising. Future work will focus on scaling to the "Gset" benchmark (up to 20,000 vertices) using high-performance computing clusters and refining "shaking" strategies to help the solver escape local minima more autonomously.

Summary updated

BibTeX
@misc{zhao2025quantum,
  author = {M. Zhao and Li Fei},
  title = {{A Quantum-Inspired Algorithm for Solving Sudoku Puzzles and the MaxCut Problem}},
  year = {2025},
  eprint = {2510.19835},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.19835},
  howpublished = {arXiv},
}
Figure