Solver adapters for XQMX models (dwave-neal today; pluggable backend interface).
Project description
xqsa — Solver adapters for XQMX models
Pluggable solver backends for quadratic optimisation models produced by the XQuad toolchain. Today's implementation wraps DWave's simulated annealer (dwave-neal); future backends (D-Wave QPU, other annealers, gradient-based solvers) plug into the same Backend protocol.
Install
pip install xqsa
Quick start
from xqsa import NealBackend
from xqvm_py import XQMX, XQMXDomain
model = XQMX.binary_model(size=4)
model.set_linear(0, -1)
model.set_quadratic(0, 1, 2)
backend = NealBackend()
result = backend.solve(model)
# result.sample: XQMX — the best assignment found
# result.energy: float — model energy of that sample
# result.timing: float — wall-clock seconds spent solving
# result.metadata: dict — backend-specific extras (e.g. run counts)
Backend protocol
Any class conforming to xqsa.Backend can drop in:
class Backend(ABC):
@abstractmethod
def solve(self, model: XQMX, **kwargs: Any) -> SolverResult: ...
SolverResult is a frozen dataclass of (sample: XQMX, energy: float, timing: float, metadata: dict). Backends return the best solution found for the model.
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.docs/python-api-walkthrough.md— end-to-end tour.
License
AGPL-3.0-or-later.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xqsa-0.2.0.tar.gz.
File metadata
- Download URL: xqsa-0.2.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91b8b4b44e897f2e4bcbf1f54a02726d291f5a0d714e25b2ded659633f6018ca
|
|
| MD5 |
4abc672c05f7d8051c95677bbb046478
|
|
| BLAKE2b-256 |
9411f9fec7d44c8fa5b4b3c2d710915775d89da2c4ea1b01dd1f971431ea4058
|
File details
Details for the file xqsa-0.2.0-py3-none-any.whl.
File metadata
- Download URL: xqsa-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd657819f05e324ea0e0d2c4cd800119d7f08f1b07da5fa2fd909ec64df66051
|
|
| MD5 |
4401d9048b000455ca207204c7b274da
|
|
| BLAKE2b-256 |
c15b07688c9505ead63fb9044dd4aea976705fc4925d56e660bc9d4bb1fb3a8b
|