HUB
Sign inSign up
quantumannealer-lab logo

credkellar/quantumannealer-lab

By credkellar

β€’Updated 17 days ago

QuantumAnnealer-Lab: quantum annealing sim - Ising, QUBO, MaxCut, TSP, TTS ledger. A classical sim!!

Image
Machine learning & AI
Developer tools
Data science
1

198

credkellar/quantumannealer-lab repository overview

⁠QuantumAnnealer-Lab πŸŒ‘οΈβš›οΈ

Quantum Annealing Optimization Lab β€” by Darion Kellar

Educational quantum annealing lab in ONE pure-Python file β€” a classical simulation that teaches annealing honestly. It builds the Ising model E = βˆ’Ξ£(J s s) βˆ’ Ξ£(h s) with an exact QUBO ↔ Ising conversion, runs simulated annealing (Metropolis single-spin flips, geometric schedule) plus a cluster-flip move set inspired by tunnelling, and grades everything against brute force: a 12-spin glass (ground βˆ’18.0), MaxCut (optimal cut 20 of 26), a 7-city TSP (25.1429), and bin packing at its lower bound. The barrier model contrasts the thermal law exp(βˆ’H/T) with the tunnelling law exp(βˆ’W·√H) and their crossover T* = √H/W; a freeze-out ledger prices time-to-solution from a measured success probability (short schedule p = 0.75 β†’ TTS β‰ˆ 399 steps).

Pure Python standard library. Zero dependencies. Zero network. Honest scope: NO quantum hardware is run, submitted to, or simulated β€” the cluster flips are a classical heuristic inspired by tunnelling, no quantum advantage is claimed, and the D-Wave-class hardware table is LABELLED published-class reference values, never measured here. Every real-hardware / live-service / advantage claim is a permanent HOLD gate (14 total).

⁠🐳 Quick start

docker pull credkellar/quantumannealer-lab:latest
docker run --rm credkellar/quantumannealer-lab:latest

The default command runs the full demo plus the built-in self-checks (CHECKS 47/47).

Run a specific command instead:

docker run --rm credkellar/quantumannealer-lab:latest python3 main.py checks   # CHECKS 47/47
docker run --rm credkellar/quantumannealer-lab:latest python3 main.py ising    # QUBO -> Ising conversion
docker run --rm credkellar/quantumannealer-lab:latest python3 main.py anneal   # SA vs cluster vs brute force
docker run --rm credkellar/quantumannealer-lab:latest python3 main.py maxcut   # MaxCut, brute-force graded
docker run --rm credkellar/quantumannealer-lab:latest python3 main.py tsp      # toy TSP, brute-force graded
docker run --rm credkellar/quantumannealer-lab:latest python3 main.py barrier  # thermal vs tunnelling laws
docker run --rm credkellar/quantumannealer-lab:latest python3 main.py tts      # freeze-out ledger + TTS
docker run --rm credkellar/quantumannealer-lab:latest python3 main.py holds    # 14 HOLD gates

β πŸ”¬ What's inside

  • The honest core β€” no quantum hardware, no submissions, no advantage claim. Cluster flips are a classical heuristic INSPIRED BY tunnelling, labelled as such everywhere including their own HOLD gate.
  • Ising / QUBO core β€” E = βˆ’Ξ£(J_ij s_i s_j) βˆ’ Ξ£(h_i s_i); QUBO ↔ Ising conversion with J = βˆ’Q/4 and the offset tracked: energies match on all 32 states of the demo QUBO and the round-trip is exact to 1e-9.
  • Annealing engine β€” Metropolis flips with the exact delta 2Β·s_iΒ·f_i, geometric schedules, seeded restarts; both move sets reach the demo spin glass's exact ground energy βˆ’18.0 (brute-force verified).
  • Problem book, graded β€” MaxCut on an 8-node graph (optimal 20 of total weight 26, both annealers match); toy TSP, 7 cities (annealer 25.1429 = brute-force optimum; QUBO form would need 49 spins, stated openly); bin packing (lower bound 5 bins, FFD and annealer both optimal).
  • Barrier model β€” constructed barrier H = 4, W = 3: tunnelling exponent 6.0, crossover T* = 0.6667. At T = 0.5 tunnelling (2.479e-03) beats thermal (3.355e-04); at T = 2.0 thermal wins. Thermal pays for height; tunnelling pays for width Γ— √height.
  • Freeze-out + TTS β€” a 120-step schedule hits the ground state in 15/20 seeded restarts (p = 0.75) β†’ TTS(99%) β‰ˆ 399 steps; the full schedule goes 20/20. Priced from the measured p, never the luckiest run.
  • Labelled hardware table β€” D-Wave 2000Q-class (~2,048, Chimera), Advantage-class (~5,760, Pegasus), Advantage2-class (~4,400, Zephyr): published-class values flagged LABELLED, next to the lab's own row β€” a 12-spin CPU simulation.
  • TinyML kNN classifier β€” easy / hard / frustrated from exact minimax landscape barriers (Dijkstra over the state graph): ferromagnet ring-8 easy, ring-12 hard, demo spin glass frustrated; training rows generated by the barrier model itself.
  • Advisory seats β€” Gemini Argon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).

β βœ… Verified

  • pytest: 35 passed
  • Built-in checks: CHECKS 47/47
  • Deterministic: double-run byte-identical
  • Base image: python:3.12-slim

⁠🏷️ Categories

Science Β· Developer tools Β· Machine learning & AI

  • License: MIT Β© 2026 Darion Kellar
  • Image: credkellar/quantumannealer-lab:latest
Tag summary
Recent tags
Content type
Image
Digest
sha256:2c99fb4d1…
Size
41.5 MB
Last updated
17 days ago
docker pull credkellar/quantumannealer-lab:latest