dimod
A shared API for binary quadratic model samplers.
What it is and what it does
dimod is a Python library that defines a shared API for samplers working with binary quadratic models (BQMs)—a class of optimization problems that includes Ising models and QUBO (Quadratic Unconstrained Binary Optimization) formulations. It provides data structures to represent these models, reference implementations of both simple and composed samplers, and abstract base classes for building custom solvers. The library also supports higher-order (non-quadratic) models beyond the standard BQM.
You use dimod to construct an optimization problem as a BQM, then pass it to a sampler—either dimod's built-in ExactSolver for small problems or a third-party sampler (such as D-Wave's quantum hardware) for larger ones. The library abstracts away the details of different solver implementations, letting you swap samplers without rewriting your problem definition. It is the foundation layer for the D-Wave Ocean SDK ecosystem.
Use it for:
- Define and solve small optimization problems using dimod's exact brute-force solver for verification or prototyping.
- Build a custom sampler by inheriting from dimod's abstract base classes and integrating it into the Ocean ecosystem.
- Prepare QUBO or Ising models for submission to quantum annealers or other specialized solvers via a uniform interface.
- Compose multiple samplers (e.g., classical preprocessing followed by quantum sampling) using dimod's sampler abstraction.
- Experiment with higher-order optimization models beyond standard quadratic formulations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
dimod provides classes and interfaces for defining and solving binary quadratic models (BQMs), including Ising and QUBO formulations, along with reference samplers and abstract base classes for building custom solvers.
Yes. dimod is actively maintained, has no known vulnerabilities, and is essential if you work with binary quadratic models or the D-Wave Ocean SDK. The Apache 2.0 license is permissive. Medium install friction is manageable thanks to pre-built wheels for modern Python versions (3.10–3.14). Install it if you need a standard interface for BQM solvers or plan to use quantum annealing tools.
Install
dimod on PyPI
pip
pip install dimoduv
uv add dimodpoetry
poetry add dimodInstalling dimod
Before you install
Medium install friction due to compiled C++ and Cython components, but pre-built wheels are available for Python 3.10–3.14 across macOS, Windows, and Linux. Maintenance is active with recent commits and no known vulnerabilities.
License in practice
Licensed under Apache 2.0 (permissive), allowing use in commercial and private projects with minimal restrictions; you must include a copy of the license and state significant changes.
Quickstart
pip install dimod
import dimod
bqm = dimod.BinaryQuadraticModel({0: -1, 1: 1}, {(0, 1): 2}, 0.0, dimod.BINARY)
sampleset = dimod.ExactSolver().sample(bqm)
print(sampleset)
Requires Python 3.10 or later; C++ and Cython compilation needed during wheel build on unsupported platforms.
Verify before relying
- Performance characteristics and scalability limits for large BQMs are not detailed in the fact sheet.
- Integration depth with D-Wave quantum hardware and other third-party samplers beyond reference examples.
- Whether higher-order model support covers all non-quadratic formulations or a specific subset.
Package facts
| License | Apache 2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 67 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 273,858/month — #8,196 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: dimod-0.12.22-cp310-cp310-macosx_10_9_x86_64.whl; dimod-0.12.22-cp310-cp310-macosx_11_0_arm64.whl; dimod-0.12.22-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; dimod-0.12.22-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; dimod-0.12.22-cp310-cp310-win_amd64.whl; dimod-0.12.22-cp311-cp311-macosx_10_9_x86_64.whl; dimod-0.12.22-cp311-cp311-macosx_11_0_arm64.whl; dimod-0.12.22-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; dimod-0.12.22-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; dimod-0.12.22-cp311-cp311-win_amd64.whl; dimod-0.12.22-cp312-cp312-macosx_10_13_x86_64.whl; dimod-0.12.22-cp312-cp312-macosx_11_0_arm64.whl; dimod-0.12.22-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; dimod-0.12.22-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; dimod-0.12.22-cp312-cp312-win_amd64.whl; dimod-0.12.22-cp313-cp313-macosx_10_13_x86_64.whl; dimod-0.12.22-cp313-cp313-macosx_11_0_arm64.whl; dimod-0.12.22-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; dimod-0.12.22-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; dimod-0.12.22-cp313-cp313-win_amd64.whl
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
dwave-samplersProvides a collection of classical and hybrid…
permissive · top 15,000 on PyPI
dwave-graphsProvides graph representations and algorithms…
permissive · top 15,000 on PyPI
qpsolversProvides a unified Python interface to solve…
copyleft · top 5,000 on PyPI
osqpOSQP is a Python wrapper for the Operator…
permissive · top 5,000 on PyPI
daqpDAQP is a dual active-set solver for convex…
permissive · top 15,000 on PyPI
dwave-networkxExtends NetworkX with tools for D-Wave quantum…
permissive · top 15,000 on PyPI
quadprogSolves strictly convex quadratic programming…
copyleft · top 15,000 on PyPI
clarabelClarabel is an interior-point conic…
permissive · top 5,000 on PyPI
MosekMOSEK solves large-scale convex and…
unclear · top 15,000 on PyPI