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 |
|---|---|---|---|
| CPU simulated annealing | SolverCPU |
Locally, on the CPU | pip install xqsa |
| D-Wave Advantage QPU | SolverDWave |
D-Wave Leap cloud | pip install xqsa[dwave] |
| CUDA GPU simulated annealing | SolverGPU(engine="cuda") |
Locally, NVIDIA GPU | pip install xqsa[cuda] |
| Metal GPU SA / Gibbs | SolverGPU(engine="metal") |
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 xqffi.vm import XqmxModel
model = XqmxModel.binary(4)
model.set_linear(0, -1)
model.set_quad(0, 1, 2)
print(sorted(SOLVERS))
# ['cpu', 'cuda', 'dwave', 'metal', 'quip']
solver = build_solver("cpu", seed=42)
result = solver.solve(model)
print(result.sample.values)
print(result.energy)
# [1, 0, 0, 0]
# -1
Every backend's solve() 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 is {"seed", "reads", "params"} for every backend except SolverQuip.
build_solver("cpu", ...) is equivalent to constructing
SolverCPU(...) 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.
SolverQuip also splits a job into steps: create_order(model) returns
a draft JobOrder whose options (payout rule, allowlist, quality
floors) are checked before anything is signed, quote() prices it and
submit() sends it. A submitted order leaves a JobOrderReceipt, which
any session rebuilds from the order id with get_receipt(). Import them
from xqsa.quip.
Reference
Driver prerequisites, per-backend parameters, embedding on a D-Wave QPU,
the Quip network job lifecycle and its job orders, and what the reported
energy means on
fixed-precision hardware are covered in
Solving Overview
and its chapters. The normative reference is
spec/xqsa/SPEC.md;
this package follows it, and any divergence here is a bug.
Also see
xqffi-- pyo3 FFI bindings to the Rust runtime, including theXqmxModelandXqmxSampletypes the solvers take and return.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.
Metadata
Release files for xqsa 0.5.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 |
|---|---|---|---|---|
| xqsa-0.5.0.tar.gz | 288.5 kB | Without provenance | Details for xqsa-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xqsa-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for xqsa-0.5.0-py3-none-any.whl |
Total release size: 462.6 kB
Release files / xqsa-0.5.0.tar.gz
| Download URL | xqsa-0.5.0.tar.gz |
|---|---|
| Size | 288.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86c73f2f566a72ba702d3e3204eeb09c78ab8ec4150c3e2210315355b48fb04f
|
|
BLAKE2b-256 checksum How to use checksums |
84d26a6ad5b1bf8d66726b8936d6a47f13eeacec77abeb14730e45d51d4bd65d
|
| 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.5.0-py3-none-any.whl
| Download URL | xqsa-0.5.0-py3-none-any.whl |
|---|---|
| Size | 174.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64e999aa1ff1730dcc32a8cada85c8789de3f891d832309dbc5d8256ea37bf8c
|
|
BLAKE2b-256 checksum How to use checksums |
d507019dd9d469cce94a5827256ccb030556a1cb7eb0ce9a943873f63565e2eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for xqsa 0.5.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.