--- id: dimod version: "0.12.22" license: Apache 2.0 license_treatment: permissive maintenance: active --- # dimod — A shared API for binary quadratic model samplers. License: permissive · Maintenance: active · Downloads: 273.9K/mo ## 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 above — 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 pip install dimod uv add dimod 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_current - Install friction: medium - Maintenance: active - Downloads: 273.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags binary quadratic model solver, QUBO and Ising model API, quantum sampler interface, BQM optimization framework, quadratic model classes, sampler abstraction layer, higher-order model support, optimization, quantum-computing, sampler-api [View on SkillFed](https://skillfed.io/packages/dimod) · [View on PyPI](https://pypi.org/project/dimod/)