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, ExactSampler, 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 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
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.8.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3800ba94641adaed71b0d455e6c11da4f2d9a1d597b11760d916860db68bab3f |
|
MD5 | ed6074e075705baa6d6eeb892c4e04fa |
|
BLAKE2b-256 | 85de619b7478507a1f80f459d8d4866265f9893651854fe54686a048a89dfb65 |
Hashes for dimod-0.8.5-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb88ced1bda21f43c45b7f8a07e831c1c55dc3f32d20f5ce80ddd984aa0c2edc |
|
MD5 | 27db93793dcec78c38247e6fba7fd65e |
|
BLAKE2b-256 | 25cf2fe892157eda5d76e04ff29a4ee75794edaecd3d2d490f4e2961642d0241 |
Hashes for dimod-0.8.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e13fa0f9e75dee180483e0eccced717f2849df4a05e3905011a15fa393f5390 |
|
MD5 | 7cc03b456004df1e9c3fdf32dd0fbbd3 |
|
BLAKE2b-256 | aca840dc1511d383413066065d29dec062803c9d84daa9160aa31a50b547b9ea |
Hashes for dimod-0.8.5-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad62f6f1917107b08dc65c870e266edd002ac3a9c81e400a47d70f7920a4b0ec |
|
MD5 | 0db80d041f2d61773ebb32e63dae7ad5 |
|
BLAKE2b-256 | fea9a477c8bf367c7e504286524ede91c6be29330b9f43dcb859b23ea8398537 |
Hashes for dimod-0.8.5-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a794790d325368ca5cc0dd05d2a8cdfe77fe0da2e603d7689cb25b18077c8a8a |
|
MD5 | 42788d9cfbb71bf93f73e563b6b866c9 |
|
BLAKE2b-256 | 87d2b8f9315433028d0beba67a0e4e7351becd4b785defcaa0e7420cd088730d |
Hashes for dimod-0.8.5-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4572b307b90d7c85f8575d43499ef8372a77f22e6d062327fd7560284d7fd527 |
|
MD5 | bc7ae27f703f4ab95200363ae50f58b4 |
|
BLAKE2b-256 | f8a13cf58dd89ecf63f8ad2138d9144c4fd0fbfa3489cb530090949d592dabeb |
Hashes for dimod-0.8.5-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33db55b833e1a7752fe12f90dd63e44262761cc21135afdc898e3c0b92dd703b |
|
MD5 | 683aca74195dd688e555c7d0b9e83ca5 |
|
BLAKE2b-256 | 5c649c6bcdadd271ea3b0252add2fc229fcd9814769ea031e518c2d2cd1e3e5e |
Hashes for dimod-0.8.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d3b2e522ec5141f79bd1b38bc00d4cb72fcc4a5e1ea88b9eefd832c9a2dcec0 |
|
MD5 | 9c9be7cacd1d51f74b7ca33e430130ab |
|
BLAKE2b-256 | d1a4993e5084f608c42fa559b0d8facd36696747a25e532d17354904741742c2 |
Hashes for dimod-0.8.5-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ca5b8a83c4ce06f22d32ff6fd463a9f2a7b1428ba26ec2ef20b281f815a6e69 |
|
MD5 | b9b5ea3682586f5864e7f0e5b91a546d |
|
BLAKE2b-256 | f83ae5750cd0eb37527fc4b67492fba0ab07f17619ecb14f1238ae6b638a496b |
Hashes for dimod-0.8.5-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbf71e11d8058878fb8471296aac2d48e60c2ac93b895dea8c9ca5cc8949b76e |
|
MD5 | 918e41b8ddd22b0ad1aa320c138b6c26 |
|
BLAKE2b-256 | da09a5283dbf5376978582c17bb60d0758ab82c33db8a3e904e4d4410982489e |
Hashes for dimod-0.8.5-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fc0e09f9b4acff220f42d3331311163e5ae4118972082665e6f4e6060fec0ec |
|
MD5 | f9457dfe0b116da7a7db03ea6f81eb8d |
|
BLAKE2b-256 | daeb566e07228fc60c540789e3a77d7e6898bdf31617e8bb00b63e5c3d9d62c4 |
Hashes for dimod-0.8.5-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4f3a334940082335920e242cd5ea71025d7db61d34c5ba5b62858a5e2716a0a |
|
MD5 | 2d5c4fbd0b6427d77d8dfbf68514d4ff |
|
BLAKE2b-256 | 61bc84996df1a0d71756096a4356e097a1bcaf583d4b0af8c3b179be5e7019da |
Hashes for dimod-0.8.5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f85dfe33031a82798bcddb47c70a832bf028ecc482a5e336a8e575a1ee530ae4 |
|
MD5 | 922934cb5e21958ceffe9d51abf63d4a |
|
BLAKE2b-256 | e3b936b113119c9bd41b83e48e7ebf132a56149e9598c966d6327d5421324185 |
Hashes for dimod-0.8.5-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1017475e3f60070281c34ab8a04da6ea74a82207941fdce824200fc37f9baad4 |
|
MD5 | 1490a273e932ce60d4154f959f451e90 |
|
BLAKE2b-256 | 8aa7cd98b612cfee2f089be7c7049785eb982145e04bda59a7639bb56616b8c4 |
Hashes for dimod-0.8.5-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8482af79ec83b8ae01e17b58ef7f7687e36341a49b76829eb82f3a47fd44693 |
|
MD5 | 2fa28346280ea89201e63241d38e8602 |
|
BLAKE2b-256 | 460b8d3ef2eee7823030be93a0d24f6e9af660ed60f3b1fd552128e57fca1073 |
Hashes for dimod-0.8.5-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e70619e486feeb3a9a6060eb6217191c6579cc4237ba875fb2a3f822d9d9fae |
|
MD5 | d1fc7083d905e3ce14f6fd111d164eec |
|
BLAKE2b-256 | cf35207091466dd07cbb5d596566b88e519fdff632d933ded4d2754fa1eb49ad |
Hashes for dimod-0.8.5-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3237a99aacf534d91b74cb37639ae341e4e759edde0501c37490521ef646b7d |
|
MD5 | 27b279b87f321c4d10eacf7f7919be63 |
|
BLAKE2b-256 | ddfcee67cabf1719b46fe5a32488f1a4029f1688b522f60e72b02568e1a09bbb |
Hashes for dimod-0.8.5-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c756eef389e6434573fd9b23631a6b0928927f1b19113d088bc45eea973f3dc |
|
MD5 | 742fff16bdcd14c9ffad349df3c6f488 |
|
BLAKE2b-256 | 310079e33f3c21202a683d75a728cfae10383abfe9e060fef6c4d721416b622e |
Hashes for dimod-0.8.5-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 351928def887729eaf62497e81ebcc9e01b4f87bff85e4536379b9986490e637 |
|
MD5 | cb5ff3f4c457b851c758557419caaa7e |
|
BLAKE2b-256 | cfb6c7d0071404457d1cf4a44f33f0361218181b28019fc7f4b09566e19f1c90 |
Hashes for dimod-0.8.5-cp34-cp34m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a80a31e4c2fc502466f9c37ea3ed93369190b4a4d4bc80a381460151cb13885c |
|
MD5 | 65d9fc7cd337cc427cad362122a607f1 |
|
BLAKE2b-256 | 12d020d4481184a57fc0356e50c6d00bb811f0ec6d36230ba5578de615070341 |
Hashes for dimod-0.8.5-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eabde3c9a196f38d93bd7813489e505d370b211a1a454d430c86ed43d6539931 |
|
MD5 | 5373da09b968694a4950cb737c46daaa |
|
BLAKE2b-256 | 8cb911a9979c5d36cd4984380ee611897cb113a421ec832c30bf166c3fa09421 |
Hashes for dimod-0.8.5-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ddcb40d964b02978ce47d49716599cb3e79f16db41af645a37b2ecd66095c31 |
|
MD5 | c65fa91de5613e3bc78465226093b9eb |
|
BLAKE2b-256 | 4d225053e46c3aabef6056853b8d732c66146db4cf9495933532d2b04a1c679b |
Hashes for dimod-0.8.5-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ff0ab78d381787cee9111578a912b96ace4eca2f6642c6a504e31595220691c |
|
MD5 | 1e8d273c8a48d330dbff054800b81aa0 |
|
BLAKE2b-256 | fdbfc4a625c42804c691607a213ec775df50f486f1cbe2425a7cf30d39f9f565 |
Hashes for dimod-0.8.5-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1146c79dc3f06f1fea0936e7176ed6aa19cd362cc5367257edb8e94bfcf03143 |
|
MD5 | 08ab36d1b27abd6d9e4537d9c4912148 |
|
BLAKE2b-256 | 207283251fdc51c4025a5b7cae981422bb5122c45488fa1a7818a4104fc50f29 |
Hashes for dimod-0.8.5-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c0dfcf020b65f64dd0ea829a37bdf7012a2022c337bdb7dc800b4884465906f |
|
MD5 | aca750f7c1bd73e600464e9d720ca3b3 |
|
BLAKE2b-256 | 8aa1f6672dfab22ee6b3145295bf757b3c7cf826a23e4cdbb6808956e65ee4a5 |
Hashes for dimod-0.8.5-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fce40ca819c49bf6ba2edf4dad2b41dbce65f7764777f46cdf072f0aaea9c4d |
|
MD5 | 3dd22f8de0613fef2f2c18251e202430 |
|
BLAKE2b-256 | 31290dc12b309e46f985e8a58ba3afaaf7b412f81acebf8157fb0fecda05e66c |
Hashes for dimod-0.8.5-cp27-cp27m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c60b832f9caddfbe527ff2b58b2977d185705a58db2525587b05f48ddcc66f3c |
|
MD5 | 8153b5084312ad416f9d38f4b77ecc35 |
|
BLAKE2b-256 | 7a25e012d5be0ab9dbb6d49db53fb18c39cabaa2508ec76e5bae1913075ea387 |