Skip to content

dwavesystems/dimod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7c34d7a · Mar 20, 2025
Mar 18, 2025
May 9, 2023
Jul 11, 2022
Mar 20, 2025
Mar 20, 2025
Jun 21, 2023
Mar 20, 2025
Mar 20, 2025
Jun 13, 2024
May 6, 2022
Mar 18, 2025
Sep 16, 2020
Jan 16, 2020
Jun 21, 2023
Mar 18, 2025
Jun 6, 2022
Jun 24, 2024
Aug 30, 2024
Oct 17, 2024
Jun 25, 2024

Repository files navigation

https://circleci.com/gh/dwavesystems/dimod.svg?style=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 quantum computer---and higher-order (non-quadratic) models.
  • Reference examples of samplers and composed samplers.
  • Abstract base classes for constructing new samplers and composed samplers.
>>> 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]

For explanations of the terminology, see the Ocean glossary.

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 section 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.