Skip to main content
Help us improve Python packaging – donate today!

A shared API for binary quadratic model samplers.

Project Description

https://travis-ci.org/dwavesystems/dimod.svg?branch=master https://ci.appveyor.com/api/projects/status/2oc8vrxxh15ecgo1?svg=true https://coveralls.io/repos/github/dwavesystems/dimod/badge.svg?branch=master https://readthedocs.org/projects/dimod/badge/?version=latest

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.

Example Usage

This example constructs a simple QUBO and converts it to Ising format.

>>> import dimod
>>> bqm = dimod.BinaryQuadraticModel({0: -1, 1: -1}, {(0, 1): 2}, 0.0, dimod.BINARY)  # QUBO
>>> bqm_ising = bqm.change_vartype(dimod.SPIN, inplace=False)  # Ising

An example of using one of the built-in test Samplers.

>>> import dimod
>>> h = {0: 0.0, 1: 0.0}
>>> J = {(0, 1): -1.0}
>>> bqm = dimod.BinaryQuadraticModel.from_ising(h, J)
>>> response = dimod.ExactSolver().sample(bqm)
>>> response.samples_matrix
matrix([[-1, -1],
        [ 1, -1],
        [ 1,  1],
        [-1,  1]])

See the documentation for more examples.

Installation

Compatible with Python 2 and 3:

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

License

Released under the Apache License 2.0. See LICENSE file.

Contribution

See CONTRIBUTING.rst file.

Release history Release notifications

This version
History Node

0.6.8

History Node

0.6.7

History Node

0.6.6

History Node

0.6.5

History Node

0.6.4

History Node

0.6.3

History Node

0.6.2

History Node

0.6.1

History Node

0.6.0

History Node

0.6.0.dev2

History Node

0.6.0.dev1

History Node

0.5.0

History Node

0.5.0.dev1

History Node

0.4.0

History Node

0.3.1

History Node

0.3.0

History Node

0.1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
dimod-0.6.8-py2.py3-none-any.whl (56.3 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Apr 11, 2018
dimod-0.6.8.tar.gz (46.4 kB) Copy SHA256 hash SHA256 Source None Apr 11, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page