pqblocks-digital-anneal
Digital Annealer-style parallel-trial heuristic solver for Ising and QUBO optimization problems with dynamic plateau-escape mechanisms.
Overview
pqblocks-digital-anneal is a classical quantum-inspired optimization algorithm modeled on the Fujitsu Digital Annealer architecture.
It implements a parallel-trial Monte Carlo method with dynamic energy offset plateau-escape mechanisms to solve fully-connected Quadratic Unconstrained Binary Optimization (QUBO) and Ising problems. By evaluating candidate spin-flip transitions in parallel and dynamically applying energy offsets ($E_{\text{off}}$) when rejected transitions accumulate, the algorithm avoids getting trapped in flat energy plateaus and shallow local minima.
Key Highlights
- Parallel-Trial Monte Carlo: Evaluates multiple spin-flip candidates simultaneously across fully connected graphs.
- Dynamic Plateau Escape: Progressively boosts acceptance probabilities via an offset parameter $E_{\text{off}}$ when candidate transitions stagnate on energy plateaus.
- Incremental Energy Updates: Tracks local fields $h_i^{\text{eff}} = h_i + \sum_j J_{ij} s_j$ to update $\Delta E$ in $O(N)$ operations per accepted flip instead of $O(N^2)$ recomputation.
- Numba JIT Acceleration: Critical inner loops compiled to native machine instructions for high throughput.
Installation
pip install pqblocks-digital-anneal
Dependencies
Requires Python 3.11+, numpy, and numba.
Quickstart
import numpy as np
from pqblocks_digital_anneal import DigitalAnnealerSampler
# 1. Define 4-spin Ising problem
N = 4
J = np.zeros((N, N))
J[0, 1] = J[1, 0] = 1.0
J[1, 2] = J[2, 1] = -1.0
J[2, 3] = J[3, 2] = 1.0
h = np.array([1.0, -1.0, 0.0, 0.0])
# 2. Sample with Digital Annealer
sampler = DigitalAnnealerSampler(seed=42)
results = sampler.sample(J, h, num_sweeps=1000, num_reads=1)
# 3. Retrieve optimal solution
best = min(results, key=lambda x: x["energy"])
print(f"Best energy: {best['energy']:.6f}")
print("Spin State:", best["sample"].tolist())
Architecture & Algorithm
- Local Field Maintenance: Maintains effective local fields $h_i^{\text{eff}}$ such that the candidate spin-flip energy jump $\Delta E_i = 2 s_i h_i^{\text{eff}}$.
- Acceptance Probability with Offset: Transitions are accepted with probability $P(\Delta E_i) = \min(1, \exp(-\beta (\Delta E_i - E_{\text{off}})))$.
- Offset Dynamics: If no candidate flips are accepted in a trial step, $E_{\text{off}}$ increases incrementally by $\Delta E_{\text{off}}$, enabling escape from flat plateaus; upon accepting a transition, $E_{\text{off}}$ resets to zero.
Fair Benchmarking Disclaimer
When benchmarking the Digital Annealer against classical simulated annealing (D-Wave Neal) and exact solvers (Google OR-Tools CP-SAT):
- Landscape Dependence: Digital Annealer parallel trials excel on fully-connected spin glasses where random parallel trials navigate unstructured landscapes efficiently.
- Losing Cases Disclosed: On highly degenerate landscapes with deep narrow minima and small gradient differences (such as
golden_04), exact branch-and-cut solvers (CP-SAT) find verified global optima faster than stochastic parallel trials.
Verification & Testing
Tested across Python 3.11, 3.12, 3.13, and 3.14.
pytest
License
Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
Metadata
Release files for pqblocks-digital-anneal 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pqblocks_digital_anneal-0.1.0.tar.gz | 18.3 kB | Without provenance | Details for pqblocks_digital_anneal-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pqblocks_digital_anneal-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pqblocks_digital_anneal-0.1.0-py3-none-any.whl |
Total release size: 32.9 kB
Release files / pqblocks_digital_anneal-0.1.0.tar.gz
| Download URL | pqblocks_digital_anneal-0.1.0.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40b5a4359eb24319e9dc529950c3d09deec3edc1105fec9ab45b8eb2faa58c2d
|
|
BLAKE2b-256 checksum How to use checksums |
0a94fd76e55f3b9ccca407a142e6d400794e570c2eff3eb4a5f5bd603a8a2dfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / pqblocks_digital_anneal-0.1.0-py3-none-any.whl
| Download URL | pqblocks_digital_anneal-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efcbe162bad6a14c54c08b0806e3b24d2a3966c76e5ad6cca9e0b787515081e1
|
|
BLAKE2b-256 checksum How to use checksums |
ec2dbf6967392927690e1304090cce09d3707aad7b4f1a4b20d31792707a50ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for pqblocks-digital-anneal 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.