Skip to main content

A shared API for binary quadratic model samplers.

Project description

https://img.shields.io/pypi/v/dimod.svg https://img.shields.io/pypi/pyversions/dimod.svg https://circleci.com/gh/dwavesystems/dimod.svg?style=svg https://codecov.io/gh/dwavesystems/dimod/branch/main/graph/badge.svg

dimod

dimod is a shared API for samplers. It provides:

  • classes for quadratic models—such as the binary quadratic model (BQM) class that contains Ising and QUBO models used by samplers such as the D-Wave system—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

Installation from PyPI:

pip install dimod

License

Released under the Apache License 2.0. See LICENSE file.

Contributing

Ocean’s contributing guide has guidelines for contributing to Ocean packages.

dimod includes some formatting customization in the .clang-format and setup.cfg files.

Release Notes

dimod makes use of reno to manage its release notes.

When making a contribution to dimod that will affect users, create a new release note file by running

reno new your-short-descriptor-here

You can then edit the file created under releasenotes/notes/. Remove any sections not relevant to your changes. Commit the file along with your changes.

See reno’s user guide for 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.12.14.tar.gz (2.9 MB view hashes)

Uploaded Source

Built Distributions

dimod-0.12.14-cp312-cp312-win_amd64.whl (5.1 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

dimod-0.12.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.3 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

dimod-0.12.14-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (19.0 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

dimod-0.12.14-cp312-cp312-macosx_11_0_arm64.whl (5.1 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

dimod-0.12.14-cp312-cp312-macosx_10_9_x86_64.whl (5.4 MB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

dimod-0.12.14-cp311-cp311-win_amd64.whl (5.1 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

dimod-0.12.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.5 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

dimod-0.12.14-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (19.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

dimod-0.12.14-cp311-cp311-macosx_11_0_arm64.whl (5.1 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

dimod-0.12.14-cp311-cp311-macosx_10_9_x86_64.whl (5.4 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

dimod-0.12.14-cp310-cp310-win_amd64.whl (5.1 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

dimod-0.12.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.7 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dimod-0.12.14-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (18.6 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

dimod-0.12.14-cp310-cp310-macosx_11_0_arm64.whl (5.1 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

dimod-0.12.14-cp310-cp310-macosx_10_9_x86_64.whl (5.4 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dimod-0.12.14-cp39-cp39-win_amd64.whl (5.1 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

dimod-0.12.14-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.7 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

dimod-0.12.14-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (18.6 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

dimod-0.12.14-cp39-cp39-macosx_11_0_arm64.whl (5.1 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

dimod-0.12.14-cp39-cp39-macosx_10_9_x86_64.whl (5.4 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

dimod-0.12.14-cp38-cp38-win_amd64.whl (5.1 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

dimod-0.12.14-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.0 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

dimod-0.12.14-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (18.8 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

dimod-0.12.14-cp38-cp38-macosx_11_0_arm64.whl (5.1 MB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

dimod-0.12.14-cp38-cp38-macosx_10_9_x86_64.whl (5.3 MB view hashes)

Uploaded CPython 3.8 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