Skip to main content

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 and for minor-embedding. Its reference examples include several 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.

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.6.9.tar.gz (49.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dimod-0.6.9-py2.py3-none-any.whl (59.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dimod-0.6.9.tar.gz.

File metadata

  • Download URL: dimod-0.6.9.tar.gz
  • Upload date:
  • Size: 49.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dimod-0.6.9.tar.gz
Algorithm Hash digest
SHA256 2d6914fde28a850fbc478fbda22673790a72d8492212bbca6bc942a22a6d4add
MD5 2ad49d18217ddd7f8002203e284a8ba8
BLAKE2b-256 8b1ce687890427450fd1db37ac357da1dd114dd1f0c8640945158228ea570b62

See more details on using hashes here.

File details

Details for the file dimod-0.6.9-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for dimod-0.6.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7f51a8f3dc2edebc5b177e5805dac4cc2b990d4b31b53bac441275018bcc3274
MD5 7140138326a52781bf8e458c0508026e
BLAKE2b-256 155c7c3b8071084b8331061290cc0f84c1e550e3e2bea8a2b0137a16a30792fe

See more details on using hashes here.

Supported by

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