Skip to content

amahmudwave/dimod

 
 

Repository files navigation

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 binary quadratic 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. It also provides utilities for constructing new samplers and composed samplers and for minor-embedding. Its reference examples include several samplers and composed samplers.

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.

Packages

No packages published

Languages

  • Python 90.5%
  • C++ 9.4%
  • Makefile 0.1%