skillfed

dimod

A shared API for binary quadratic model samplers.

dimod v0.12.22 273.9K downloads/30d#8,196 on PyPI142
Permissive license Apache 2.0 Active released

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 dimod

uv

uv add dimod

poetry

poetry add dimod

Installing 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

License :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: C++Programming Language :: CythonProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPython

Tags

binary quadratic model solverQUBO and Ising model APIquantum sampler interfaceBQM optimization frameworkquadratic model classessampler abstraction layerhigher-order model support
optimizationquantum-computingsampler-api

More Mathematics packages