This release is a pre-release and may not be stable for production use.
xqsa -- Solver adapters for XQMX models
Pluggable solvers for quadratic optimisation models produced by the XQuad toolchain. One interface, five backends:
| Solver | Class | Where it solves | Install |
|---|---|---|---|
| DWave CPU simulated annealing | SolverDWaveCPU |
Locally, on the CPU | pip install xqsa |
| D-Wave Advantage QPU | SolverDWaveQPU |
D-Wave Leap cloud | pip install xqsa[dwave] |
| CUDA GPU simulated annealing | SolverCudaGPU |
Locally, NVIDIA GPU | pip install xqsa[cuda] |
| Metal GPU SA / Gibbs | SolverMetalGPU |
Locally, Apple GPU (macOS) | pip install xqsa[metal] |
| Quip network (on-chain mempool) | SolverQuip |
Quip network | pip install xqsa[quip] |
Install
pip install xqsa # CPU simulated annealing only
pip install xqsa[dwave] # add D-Wave QPU support
pip install xqsa[cuda] # add CUDA GPU support
pip install xqsa[metal] # add Metal GPU support
pip install xqsa[quip] # add Quip network support
Extras are composable: pip install "xqsa[cuda,dwave]".
A complete example
build_solver picks a backend by name, so a caller can stay
backend-agnostic across all five:
from xqsa import SOLVERS, build_solver
from xqvm_py import XQMX
model = XQMX.binary_model(size=4)
model.set_linear(0, -1)
model.set_quadratic(0, 1, 2)
print(sorted(SOLVERS))
# ['cuda-gpu', 'dwave-cpu', 'dwave-qpu', 'metal-gpu', 'quip']
solver = build_solver("dwave-cpu", seed=42)
result = solver.solve(model)
print(result.sample)
print(result.energy)
# XQMX(mode=SAMPLE, domain=BINARY, size=4, linear_terms=1, quadratic_terms=0)
# -1
Every backend returns the same SolverResult(sample, energy, timing, metadata): sample is the best assignment found, energy is the
Hamiltonian recomputed independently in exact integer arithmetic (never
taken on faith from the backend), and metadata's shape is per-backend.
build_solver("dwave-cpu", ...) is equivalent to constructing
SolverDWaveCPU(...) directly; reach for the class constructor instead of
build_solver when the backend is fixed at write time rather than chosen
by name at run time.
Reference
Driver prerequisites, per-backend parameters, embedding on a D-Wave QPU,
the Quip network job lifecycle, and what the reported energy means on
fixed-precision hardware are covered in
Solving Overview
and its four chapters. The normative reference is
spec/xqsa/SPEC.md;
this package follows it, and any divergence here is a bug.
Also see
xqvm_py-- pure-Python reference VM.xqffi-- pyo3 FFI bindings to the Rust runtime.xqcp-- constraint-programming DSL that compiles to models this package can sample.xquad-- umbrella meta-package.- Running Programs -- end-to-end tour.
License
AGPL-3.0-or-later.
Release files for xqsa 0.4.1b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xqsa-0.4.1b1.tar.gz | 140.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xqsa-0.4.1b1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 223.6 kB
Release files / xqsa-0.4.1b1.tar.gz
| Download URL | xqsa-0.4.1b1.tar.gz |
|---|---|
| Size | 140.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f684d9a929271b80e69ac0905babecbcf47a4fd8c6deb725014199a2726411a
|
|
BLAKE2b-256 checksum How to use checksums |
009fe7ccf96a5346e843e3d42be9e44ddf62f6caa6ab4b00ec41dd4960cf9427
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / xqsa-0.4.1b1-py3-none-any.whl
| Download URL | xqsa-0.4.1b1-py3-none-any.whl |
|---|---|
| Size | 83.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bdcb8782fadc3ff22ec47927839e699ceb14eb9b6c743c7f3bc985df5e251655
|
|
BLAKE2b-256 checksum How to use checksums |
7c4471a279e104c215ef81f8d78132ddc0383eacf9b870a9850a09037710b291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|