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.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a134b0250444c331d37d29b9de32f13d9dd543ab2dd341e110c9ab004397a16 |
|
MD5 | fe6ba4ed4385bd83442dd0c0512c9e47 |
|
BLAKE2b-256 | e22b49e177d80638c4b51010fb4a0312ea807dd4b5258c4ed76633a2e96c91cb |
Hashes for dimod-0.8.6-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c6eba04d61a151ac7c1ef15beba89ea6707b3545d6c00285deec91f8c9a46f2 |
|
MD5 | a380e20e334713e5a6d965a2d4d26b72 |
|
BLAKE2b-256 | be7f27b95227fa822a83dca1513d8614bff2ee3fa0a6e0b17e692e8aa61b18dd |
Hashes for dimod-0.8.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36c47ec23bf8ed4f3eae5704ac34f8a13db74c5cf4404ce4b2c8381896a70e6c |
|
MD5 | 231be3a5218e9d85a69477c2be36ae79 |
|
BLAKE2b-256 | 59b85c28f796f99a793bd776a1043ab1ac29bead0610f42cee6e7ac0c07b0024 |
Hashes for dimod-0.8.6-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e94aed27677f36c9564b5903332dbbfbf61933529272ec4039ba006e5144088e |
|
MD5 | c334be5e47d8ed4d29d0364d9cee6142 |
|
BLAKE2b-256 | 3126b93410b27bdee412a330c9b1676158ba2c4788e382d183ac5864ea92416e |
Hashes for dimod-0.8.6-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40ceb31f2800a42ed27d79b283a36694d38d8f5f17dbc8116626efb97626d88e |
|
MD5 | 6e7db51804df1bd7cd935cad01574ecb |
|
BLAKE2b-256 | af9697cb4c28ad1b6ca2908eba25c71eb313062faedade4a62b7de4337df44eb |
Hashes for dimod-0.8.6-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92977aa766b1aeb943ce643f4caf2d51cf7c5ae048a42eb0e45e459f776782d4 |
|
MD5 | 59401e3a033e2036629d7360697c43b4 |
|
BLAKE2b-256 | 4d648ba0aac2c6a79e75be656a87ec0911292e4ce11db633dc38743117ff5637 |
Hashes for dimod-0.8.6-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21cb54b5a8557442a405016d73b4a8c155f10dba75e2baad772eb2eb7afa6064 |
|
MD5 | 12409d04a7a8c1be2c4bdef88cc0dd85 |
|
BLAKE2b-256 | 7e315170937a029db661d695f1709a1fda896b3db585114ad1089d8caf805b01 |
Hashes for dimod-0.8.6-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbb31e1e94a19eb840b2b6177cca6e667eeadf6a1d120ba3af67af9c1376abde |
|
MD5 | a5095562c9ab8457756aee1ff905ef09 |
|
BLAKE2b-256 | bc611d008e1c6b6353c10e8ebd2114dd6197fa8f7a15793be0fe9a2753af763e |
Hashes for dimod-0.8.6-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 073b75566d15d36517b2290cb74f27156ab1e98e60d66a9664c6755c60901aaa |
|
MD5 | 52267efcec5fb1bc319ff728152b5a6a |
|
BLAKE2b-256 | 93ae481da4928f8c89a1d877294ade153fd5c3dabd89b91b0cf7ebc0c8b2d0ed |
Hashes for dimod-0.8.6-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 264dfc64ec517c07e637d6e84c691e7a27f750fbfe03ac3f98a5624b74e27b37 |
|
MD5 | e60873e1e3e0a682639270febb7c24ff |
|
BLAKE2b-256 | 58a83afd15adcb2b4a7b8db6c7d7670d53fab794c682ec85bb8e92643284d62c |
Hashes for dimod-0.8.6-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a0d43fed1f4f169425b0403ceac49cc82e93445212fdfb2c7965899f707b6a5 |
|
MD5 | ded8a374a53bd5d34cd0b4605cc465dc |
|
BLAKE2b-256 | 11f8ce10f173c5208e94c4f6eece3dccc7ef88bc27b6fe6dc9ca95be7feba88e |
Hashes for dimod-0.8.6-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c831b51cd60f1afb4291e37cab09d53e2a3be78ebe2aa5aa6518c55236dc052 |
|
MD5 | 6ca37532018c722949b770a10874d575 |
|
BLAKE2b-256 | 342c1767c59a1b65cf78f0ec14e8c43e728476e6f41b5c4703272e9d7d7c244f |
Hashes for dimod-0.8.6-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce809f7e6fccfeb7a16b0dfef430039498d33c215f9162197bc70e518385b749 |
|
MD5 | b69a145cd3b2b7efa1a6dd10264bd608 |
|
BLAKE2b-256 | 1dbd6bef139371b42c3b5434aa555558df3bb3a6fd8e4affcd44e77fe0e3bb8b |
Hashes for dimod-0.8.6-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed97f46b4491ee60a45c3ad2c43ea377388bdf22f7f7315839b24f3da71e1cba |
|
MD5 | aafa791b924ce2e6e6518e5641f3c0d1 |
|
BLAKE2b-256 | 6f75e0f04da3bbaf1655261570bc09c370206ab5270c324c4458cf638bb8e3dd |
Hashes for dimod-0.8.6-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58a69477bfac3d612aca2f36416eb8923fa22b55380b36194970060c7e0be42b |
|
MD5 | 06c472f181c274a462f45ae333cad4ca |
|
BLAKE2b-256 | 67be7e50c042f3f798b0bad3e31dfaf832c7b8c2ce582cb79848f817e4f6fe56 |
Hashes for dimod-0.8.6-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb5ebe5ba7ef2bef6b5938854397c9e576104497da7760d1acb1bd0ee8fd334e |
|
MD5 | b5e34c9db892a11ae884359a7dc75256 |
|
BLAKE2b-256 | 1b19eee6b779ce37fc3cc56eb2674edf200c349858785b9880c2d2ae0e203654 |
Hashes for dimod-0.8.6-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c54ca3e333ab4c1ab597ffa0d2d456b1b6b2c12688c0b04a4933449a11499577 |
|
MD5 | 5e8c569b15498c221b81fc28c7c6a8a8 |
|
BLAKE2b-256 | 7c509bf345c81af00108f2aa87526799987c5a142d3d317066a552e4930a2fbd |
Hashes for dimod-0.8.6-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b20555c6910e10aef786edeafebe834f0f6f97eefa777cd8840a2ea6d9d33435 |
|
MD5 | 7ab744c141f314be50075866baa5c82c |
|
BLAKE2b-256 | 6c773976f617cc18f8d588953f33f3b5b985911d87129701c9458c7de971ef59 |
Hashes for dimod-0.8.6-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ce5627e1db76427e794f9f7e7c476205b8f53fa6bf01ad3eb5e9be0b87c247f |
|
MD5 | 53b0f11918494e0467cb96dc18661bd4 |
|
BLAKE2b-256 | 0bd58564a409ee0e92e702ad0d3568099dd3c7ba6deb4fdcb824e3dda7f47c4e |
Hashes for dimod-0.8.6-cp34-cp34m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb33ec0606344dbc299077bb6cc05b5c9b311c885593dca8063dec54d006928e |
|
MD5 | b3da890b1b212b63c24b52db73bb9d36 |
|
BLAKE2b-256 | 2474b94fc8c3d1a7bc85e8e2c9cba8c28efe83fcaa5f5bb62e7b37fc6a803ee2 |
Hashes for dimod-0.8.6-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63f57668ffd3fae17138835615d2e095bbb78a26819803f38521d20025b4fb3a |
|
MD5 | f5852d24ff60ab11b37255b44ea0fd24 |
|
BLAKE2b-256 | d54030fa1c1a63eb4f8de2760c01568b263e1fc644ab9e091f6b7b3a62922219 |
Hashes for dimod-0.8.6-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1724b11860e308e48266d0b8ba6072806f6d0280a0e55a59a199b3d1d4e07191 |
|
MD5 | e5717b7060b7a1b16ef2041a96355402 |
|
BLAKE2b-256 | e94fb1ba6794df06b4d07de0ba346b6e8869a453d02e85307c925f80064a641e |
Hashes for dimod-0.8.6-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c9d80d6206660a6672235f13763455a4fabef0ffb2762d1325b26712badcedb |
|
MD5 | ae21c56b44759842b63706526554dabe |
|
BLAKE2b-256 | 6030b43c3b27533fab5e309834440cc7a727fbd88eb5d4f383e267343472791c |
Hashes for dimod-0.8.6-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f6f903a5f055f2f75392318bbdf6222e523d93a881096b35c84ec60b68dc258 |
|
MD5 | d8c141b1a70bfe367b2777ae1f27f0c3 |
|
BLAKE2b-256 | 6cbec17427680d48e56fc24841e85472172f446c2907d98703e49a74b4ab6c13 |
Hashes for dimod-0.8.6-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e543bf71995584b9d079752e01423ff659041583f041418623ca0a7a329ad23 |
|
MD5 | 1dce570c255a9877a8f758edf3691ab0 |
|
BLAKE2b-256 | 59a8ebeb8dc3732feee9d2411b8b6a02f8d039b77088093756e74a2df7c159f1 |
Hashes for dimod-0.8.6-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 041233ed87d13e5d2721e63a4ba5793ecb4a9adc546ccada530956b224f7480e |
|
MD5 | fdcc4f580fc855096402856c360ba010 |
|
BLAKE2b-256 | 8407ee567f527ce8d9a2a1614219bcc568b4062529bc8b8e1c109daff58f6555 |
Hashes for dimod-0.8.6-cp27-cp27m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bcfb860fa836fbc014ffae0daab773c9a6ee1474cfd5dd9ab6b543b565c027a |
|
MD5 | 1cab1ae6fea8eef85bf533992398a004 |
|
BLAKE2b-256 | 6eba7fe7ee978585dc7b4d3cf20ceab3d6301ddc6177b5e7fe0900343fbf6526 |