Skip to content

pqblocks-anneal-sa

Simulated Annealing heuristic solver for Ising and QUBO optimization problems. Quantum-inspired classical optimization, not cryptography.

PyPI Area Status Python Licence Source

At a glance

Area Quantum-inspired
Import import pqblocks_anneal_sa
Command line pqblocks-anneal-sa
Version 0.1.0 (Alpha)
Python >=3.11
Native dependency none
Repository PQBlocks/simulated-annealing
Licence Apache-2.0

What is pqblocks-anneal-sa?

Classical Simulated Annealing heuristic solver for Ising spin-glass and QUBO optimization problems with automatic parameter derivation.

Domain Classification: Quantum-inspired classical optimisation: not cryptography, no security claim.

Not cryptography

Quantum-inspired classical optimisation: not cryptography, no security claim.

Install

pip install pqblocks-anneal-sa
uv add pqblocks-anneal-sa
pip install git+https://github.com/PQBlocks/simulated-annealing
uv add git+https://github.com/PQBlocks/simulated-annealing

Quickstart

Executed, not just written

This is the quickstart from the package README. It was run against the package source when this page was generated.

quickstart.py
import numpy as np
from pqblocks_anneal_sa import simulated_annealing

# 1. Define 4-spin Ising problem (couplings J and linear biases h)
J = np.array([
    [0.0, 1.0, -1.0, 0.0],
    [1.0, 0.0, 1.0, -1.0],
    [-1.0, 1.0, 0.0, 1.0],
    [0.0, -1.0, 1.0, 0.0],
])
h = np.array([0.5, -0.3, 0.2, -0.1])

# 2. Solve with auto-derived parameters
result = simulated_annealing(J, h, num_sweeps=100, num_reads=10, seed=42)

# 3. Retrieve best solution
best_idx = np.argmin(result["energies"])
print(f"Best energy: {result['energies'][best_idx]:.6f}")
print(f"Sample: {result['samples'][best_idx].tolist()}")

Examples

Runnable scripts in the repository:

Documentation and evidence

Every PQBlocks package ships the same evidence set, so each claim can be checked against tests, sources and measurements.

  • Overview


    What it does, install, usage and API.

  • For AI agents


    Correct imports, pitfalls and rules for coding assistants.

  • Security notes


    What it protects, hostile input, constant-time and audit status.

  • Testing


    Test suites, coverage, vectors and what is not covered.

  • Benchmarks


    Measured performance, including where it loses.

  • Evidence


    Primary sources and the method-to-code map.

  • Verification report


    Self-verification results, defects found and limits.

  • Use cases


    Worked scenarios and when to pick something else.

  • Changelog


    Every release and what changed.

  • pqblocks-anneal-schedule: Quantum-inspired instance-adaptive simulated annealing with statistics-driven schedule generation for Ising and QUBO…
  • pqblocks-anneal-sqa: Simulated Quantum Annealing (Path-Integral Monte Carlo via Suzuki-Trotter decomposition) heuristic solver for Ising…
  • pqblocks-bifurcation: Simulated Bifurcation (ballistic and discrete) heuristic solver for Ising and QUBO problems. Quantum-inspired…
  • pqblocks-digital-anneal: Digital Annealer-style parallel-trial heuristic solver for Ising and QUBO optimization problems. Quantum-inspired…
  • pqblocks-population-anneal: Population Annealing Monte Carlo heuristic solver for Ising models and QUBO combinatorial optimization.…
  • pqblocks-qiea: Quantum-Inspired Evolutionary Algorithm (QIEA) with Q-bit representations and quantum rotation gates for Ising and…
  • pqblocks-qubo: Unified mathematical representation and converter library for Quadratic Unconstrained Binary Optimization (QUBO) and…
  • pqblocks-qubo-bench: Benchmarking harness and standard instance loaders for quantum-inspired optimization algorithms against classical…