Skip to main content

A shared API for binary quadratic model samplers.

Project description

https://img.shields.io/pypi/v/dimod.svg https://codecov.io/gh/dwavesystems/dimod/branch/main/graph/badge.svg https://readthedocs.com/projects/d-wave-systems-dimod/badge/?version=latest https://circleci.com/gh/dwavesystems/dimod.svg?style=svg

dimod

dimod is a shared API for samplers. It provides:

  • a binary quadratic model (BQM) class that contains Ising and quadratic unconstrained binary optimization (QUBO) models used by samplers such as the D-Wave system.

  • a discrete quadratic model (DQM) class and higher-order (non-quadratic) models.

  • reference examples of samplers and composed samplers.

  • abstract base classes for constructing new samplers and composed samplers.

(For explanations of the terminology, see the Ocean glossary.)

Example Usage

>>> import dimod
...
>>> # Construct a problem
>>> bqm = dimod.BinaryQuadraticModel({0: -1, 1: 1}, {(0, 1): 2}, 0.0, dimod.BINARY)
...
>>> # Use dimod's brute force solver to solve the problem
>>> sampleset = dimod.ExactSolver().sample(bqm)
>>> print(sampleset)
   0  1 energy num_oc.
1  1  0   -1.0       1
0  0  0    0.0       1
3  0  1    1.0       1
2  1  1    2.0       1
['BINARY', 4 rows, 4 samples, 2 variables]

See the documentation for more examples.

Installation

Compatible with Python 3.5+:

pip install dimod

To install with optional components:

pip install dimod[all]

To install from source:

pip install -r requirements.txt
python setup.py install

When developing on dimod, it is often convenient to build the extensions in place:

pip install -r requirements.txt
python setup.py build_ext --inplace

Note that installation from source requires that your system have the Boost C++ libraries installed.

License

Released under the Apache License 2.0. See LICENSE file.

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

dimod-0.9.13.tar.gz (1.4 MB view hashes)

Uploaded Source

Built Distributions

dimod-0.9.13-cp39-cp39-win_amd64.whl (2.4 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

dimod-0.9.13-cp39-cp39-win32.whl (2.2 MB view hashes)

Uploaded CPython 3.9 Windows x86

dimod-0.9.13-cp39-cp39-manylinux1_x86_64.whl (6.9 MB view hashes)

Uploaded CPython 3.9

dimod-0.9.13-cp39-cp39-manylinux1_i686.whl (6.6 MB view hashes)

Uploaded CPython 3.9

dimod-0.9.13-cp39-cp39-macosx_10_9_x86_64.whl (2.6 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

dimod-0.9.13-cp38-cp38-win_amd64.whl (2.4 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

dimod-0.9.13-cp38-cp38-win32.whl (2.2 MB view hashes)

Uploaded CPython 3.8 Windows x86

dimod-0.9.13-cp38-cp38-manylinux1_x86_64.whl (7.1 MB view hashes)

Uploaded CPython 3.8

dimod-0.9.13-cp38-cp38-manylinux1_i686.whl (6.8 MB view hashes)

Uploaded CPython 3.8

dimod-0.9.13-cp38-cp38-macosx_10_9_x86_64.whl (2.6 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

dimod-0.9.13-cp37-cp37m-win_amd64.whl (2.3 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

dimod-0.9.13-cp37-cp37m-win32.whl (2.2 MB view hashes)

Uploaded CPython 3.7m Windows x86

dimod-0.9.13-cp37-cp37m-manylinux1_x86_64.whl (7.0 MB view hashes)

Uploaded CPython 3.7m

dimod-0.9.13-cp37-cp37m-manylinux1_i686.whl (6.7 MB view hashes)

Uploaded CPython 3.7m

dimod-0.9.13-cp37-cp37m-macosx_10_9_x86_64.whl (2.6 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

dimod-0.9.13-cp36-cp36m-win_amd64.whl (2.3 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

dimod-0.9.13-cp36-cp36m-win32.whl (2.2 MB view hashes)

Uploaded CPython 3.6m Windows x86

dimod-0.9.13-cp36-cp36m-manylinux1_x86_64.whl (7.1 MB view hashes)

Uploaded CPython 3.6m

dimod-0.9.13-cp36-cp36m-manylinux1_i686.whl (6.8 MB view hashes)

Uploaded CPython 3.6m

dimod-0.9.13-cp36-cp36m-macosx_10_9_x86_64.whl (2.6 MB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

dimod-0.9.13-cp35-cp35m-win_amd64.whl (2.3 MB view hashes)

Uploaded CPython 3.5m Windows x86-64

dimod-0.9.13-cp35-cp35m-win32.whl (2.2 MB view hashes)

Uploaded CPython 3.5m Windows x86

dimod-0.9.13-cp35-cp35m-manylinux1_x86_64.whl (7.0 MB view hashes)

Uploaded CPython 3.5m

dimod-0.9.13-cp35-cp35m-manylinux1_i686.whl (6.7 MB view hashes)

Uploaded CPython 3.5m

dimod-0.9.13-cp35-cp35m-macosx_10_9_x86_64.whl (2.6 MB view hashes)

Uploaded CPython 3.5m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page