A shared API for binary quadratic model samplers.
Project description
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.
Learn more about dimod on Read the Docs.
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
This example uses one of dimod’s test samplers, ExactSolver, a solver that calculates the energies of all possible samples.
>>> 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) >>> for sample, energy in response.data(['sample', 'energy']): print(sample, energy) {0: -1, 1: -1} -1.0 {0: 1, 1: 1} -1.0 {0: 1, 1: -1} 1.0 {0: -1, 1: 1} 1.0
See the documentation for more examples.
Installation
Compatible with 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
Note that for an installation from source some functionality requires that your system have Boost C++ libraries installed.
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
Built Distributions
Hashes for dimod-0.9.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 250d84ab767394664c3f1bab2593f73825457bdc408d26ce76e81a783c7c90b2 |
|
MD5 | 0ebb8a59770de9d714ae4f354980260d |
|
BLAKE2b-256 | 9c96fae7b33731697577e31c5b53d8924686b887f0f085c901c086ea6f136bbe |
Hashes for dimod-0.9.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd42d015f5b8be38a7c0bc7d47d2dbc5de531ab571052d62e4c69786199a0ee6 |
|
MD5 | 596e29a99e237c242a26103fdc2430e4 |
|
BLAKE2b-256 | 80a9daa2477130ea940eafdcc4e6a950db5c41660342c839cef70664379c0878 |
Hashes for dimod-0.9.0-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29701091e77cfbff0e61158f4816cb67ad15098b70c44f2bf5bf3833f098dd63 |
|
MD5 | 89428e2bde03d07e7b6640942c13b2d3 |
|
BLAKE2b-256 | 0ffe37a3f10460a19c70d866ef2b5582f6cdbde4dabdce72fc1fa1e6affe46eb |
Hashes for dimod-0.9.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1381bd7af41093044761c75719251c40b008b9ca7d4f0dfb738b2faf886062be |
|
MD5 | bcc5a9f412ac2c952b771bb325bc9858 |
|
BLAKE2b-256 | 9968fffb418cb9d08f8b4d020630b84d150357c254e3525ebfc28aeaca937a83 |
Hashes for dimod-0.9.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e89c49d365d73f0354263cb71362e60ae108e86d37fe04ef28292cab78de00b7 |
|
MD5 | d3f7314fb8aca1ddfd84b391f4055955 |
|
BLAKE2b-256 | 8b99c8032ea24805f6955a9ad2ec12bf5edc7ba03a6d1ecfbae4071be1b80f76 |
Hashes for dimod-0.9.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb3dba1232c42b7fb6a572765470ba725bfb4b3176ce6e32e57ab681df8c84c2 |
|
MD5 | 2bb49c9c2609e4e42d2abd6a4c9bc0af |
|
BLAKE2b-256 | edcfde3fd211b70c68d822699e296365260e6da962d556ed7401b8e6576acace |
Hashes for dimod-0.9.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23bfc8117b6577dc5e5aa9fd65b33105836d5deeed13303a6225bf38dc9cbb6a |
|
MD5 | b529b299f890e24e466e60c796f53343 |
|
BLAKE2b-256 | c51f20f517442afffbf72c48556ca8cb2ad56616e2388ff343847a06a7abd816 |
Hashes for dimod-0.9.0-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a86ab09421d4b2eb7809bff108ef35db450240f3fec113bb62271520f9110fae |
|
MD5 | 19dcc3f0376a71bd36526fa94c616bb7 |
|
BLAKE2b-256 | 2686f55a900b4532f634b673617d77715b71c7701d738657ccba7183a0efaeb1 |
Hashes for dimod-0.9.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 273720455ca7bbad4b4e8190bacc23a07e7832a75ae930e852ae6ee3737aa44c |
|
MD5 | 7d321d3ba9c641f01fd9a0cd73cc845f |
|
BLAKE2b-256 | 5523c84b1f4ff31b44d1eae91a72fd5969acfdec46f8d9b634e2408fce497102 |
Hashes for dimod-0.9.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2587945b9b6ce345d7091acdb53512917ba2513f348c0990b202f43c9e317ba |
|
MD5 | 3cfaa5076d39d575e869dd41850c16a8 |
|
BLAKE2b-256 | 8e2a6702cc6ac74209d0e428f96952a7cd8e6d33ad4d6e76d653c5f235de48fb |
Hashes for dimod-0.9.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc76cd2848ecfb9c85fd8d2df85dbb152c45459b57f78373ff5bc428b929fc28 |
|
MD5 | 81f928e231474c61bc97384ac77e954d |
|
BLAKE2b-256 | 9bb14d02e35b0656314d6e0672f42a26b820dbda76bbfec08e090050feb720c3 |
Hashes for dimod-0.9.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2a67434fc5354d2b0fd8a1af560c7eebca75805522d34849e5aaa898ae9e9ed |
|
MD5 | 9491d3de26dff92778536a35bf37acaa |
|
BLAKE2b-256 | 89c05d0cd1200f8e976715aea10a96419982c2e613d8b33466489429401afa5f |
Hashes for dimod-0.9.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 787d2f3fc9c77a5a61b22f2ad7e5f55434f6f38dc1a6b0c91016c1d0746c94e0 |
|
MD5 | 810c632bd0498b24fd65c724c617eca3 |
|
BLAKE2b-256 | 008948b2e164a23b8e2fca1bd5f2a14082cb4eb0ab32fb2f6604aedffe556505 |
Hashes for dimod-0.9.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0defdb8941d0046b1fbbccd57ab51c0e7b9c8093151ecaa8bdbc2d074391e926 |
|
MD5 | 80d2870e3b33f6d1a8849418ca30bc64 |
|
BLAKE2b-256 | 0082dfb0b6c5c6355ab52b11a0a57bd69ac91d5e4ffc0dbc1006e036d022ef7a |
Hashes for dimod-0.9.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24310157387c98d1e4c0e798696d4e21dea03bb1940f00f18e1c3972e6194fc3 |
|
MD5 | ac49f6ca9dfd385e51daf9abd68b736b |
|
BLAKE2b-256 | e06fbe723685fb38acea0bfdec45702eeae47c84c59880d5d1ff5787480ba3bc |
Hashes for dimod-0.9.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c971cc6f93a36d971e9283a21a13af9e23a4d199ff4251e059640df80a70d36 |
|
MD5 | 3cce52c4c0813c38617e6730281f607f |
|
BLAKE2b-256 | ee6902ad657e3dbd4544124023ad68bfb04c0899db517d91dd020ce272a938ed |
Hashes for dimod-0.9.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5abedb68cfa4b316a184df30525610383031dd524b185c7ce953ccf8435d7a72 |
|
MD5 | 43f2e6437759477042b00dd04abd59a7 |
|
BLAKE2b-256 | a944e3f75e87920ea109d313e98dcbe508ef28f0c729cff212e247e69fd0cb8f |
Hashes for dimod-0.9.0-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d5c59303d36b467a659290bc5319671e4f465136ec11f112629ad99cee1e3dc |
|
MD5 | ba9a85097e828c9a425193d20427b68e |
|
BLAKE2b-256 | 1702249cf777031fd81ca5d1245d9d10744ed8ba7b4150aa8dd313de0b7293a7 |
Hashes for dimod-0.9.0-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f679fe081e2622ba09a2f3a867eee41b9efd221540d03d377a6613508f26c86b |
|
MD5 | 6be350bebd508bd3467ca851eaaf03fb |
|
BLAKE2b-256 | bbed0dfe9fe81e96926e871a8a2a910e1418ce249f763fa96032ee644feccb2c |