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.8-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b1da0f7b48613674a46b45adc2fa628d2aa17dad88921e28627223c30fab42d |
|
MD5 | 2fbaa82a17149ab7b224affea61dcafd |
|
BLAKE2b-256 | 78f11c1cd03f38dcb4073dbf5d4030aa666ea2475355abb02d9aa9af69209b93 |
Hashes for dimod-0.8.8-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4add2f75395704680f78edccbd876922ee5099f60023e9bcd75617d5244b719f |
|
MD5 | a10579fae0f485320ecf115cf864cfe5 |
|
BLAKE2b-256 | f434dead45d0476239906a2260f274e6eb19087d4cc2b21d53bbfa7f0c19c912 |
Hashes for dimod-0.8.8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 089daa5e499d23af629425d7a7e5d297da075db8916c66822ec2fc0123121fe2 |
|
MD5 | e2b63a8c0c2322fe4e21aeca496a319b |
|
BLAKE2b-256 | 059c1267f9f8033d938df7462d661a26dcc25abd1d844853412c5ed06925052a |
Hashes for dimod-0.8.8-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa5bb0f697c0525977b6d5f3c0694bedddf246dd7d7bedc30166c271018c47a9 |
|
MD5 | aea2af65140563568f64ddf5e623ee27 |
|
BLAKE2b-256 | 5a18fb46a184eed88c1eed0926f632f126f0b6e919e43f967c5df08a66d81fda |
Hashes for dimod-0.8.8-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0b783d47e35539836b346ac72e95c7a49fc20fb2a04f1bec84ad06c5f52e929 |
|
MD5 | 6902514678755f98f731c680c777dd89 |
|
BLAKE2b-256 | 2425ed89f4c8af3d015a03f18f4efdfdaef8fb024500b4d1cccd33e32d8fc276 |
Hashes for dimod-0.8.8-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a463d88f200bde33d30b138ebc8b567cf6d2219edaf90ca24a51ba7a66ef1e41 |
|
MD5 | b73ba4f7ccc0956fdeff96e1b5cdbe71 |
|
BLAKE2b-256 | c1c84bd15778f0987684ab33b457627b9b290d431f1ef8c8f075d0066285931b |
Hashes for dimod-0.8.8-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a20ca95bba3ed6aafed55bc15a56a4134e802d4628d13128c210aec911008c0 |
|
MD5 | c41276f66b8af458ce742633a96d9024 |
|
BLAKE2b-256 | 970df6bddf436992fc0e646d3a238b1b805d381adfbfa3b0984355ea46c000aa |
Hashes for dimod-0.8.8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dee9b147f780a9393bebfc8b4807a46041abb56db1906b93c2599da5f053ee39 |
|
MD5 | 2edd4a3069b5c6af98da7a3ff4c6e51d |
|
BLAKE2b-256 | 9b9b1164c323c803917a067b541ff0f2793aca3371fea9a3988e7285513c0c3b |
Hashes for dimod-0.8.8-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | babab445a99b102982767332e273f4481e0165ef64d1822a2e0bc0a13368d006 |
|
MD5 | 0463f4be05b3c1491cd95613c14a4c86 |
|
BLAKE2b-256 | e9532965eb7adb4a5b8e07b3609f2a8743229dcd3205e868dbf80511a373455b |
Hashes for dimod-0.8.8-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f13ca90ece9dd05c0d422a261c5f16ba927442375dfd37627d4d7925e2a11bfd |
|
MD5 | c24278acb917bcecde1417fe8fd2911f |
|
BLAKE2b-256 | 61d84f6369cb2328b896e8adae478329b58d1402cf3a05329ec980f2c3b541a9 |
Hashes for dimod-0.8.8-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 974cc8359825aacca111ef9fc4b0643c5996469929e1a492087cd2a59382a103 |
|
MD5 | 347252273cf49fbfe6ea3cc9f1506507 |
|
BLAKE2b-256 | 7d0370d2ec7f798ce62d2b57ad81d4149e69d8a220f185529a76b16d060fa06c |
Hashes for dimod-0.8.8-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43e88e50fa3a39123a48903ec15c52ed45d032a68d12424a464073c5e0a6d820 |
|
MD5 | e5156519dc1916dd072045e3071efb35 |
|
BLAKE2b-256 | 76b693d2cfa91525f6cac724b774fe11569453625ab20ad17eafc453b12d175c |
Hashes for dimod-0.8.8-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd9bbaeda90930bb4f226a661179a2d3fe71f19ea84d27df38f0f277ab101056 |
|
MD5 | d9b3bcdca53ff6b5aa4bf7f2a11b1ad3 |
|
BLAKE2b-256 | 05ef5ef4e7a98f6261231aee77c195a888de59a8fa2791b2f922f2d9369cd00b |
Hashes for dimod-0.8.8-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a9d7f29532d38381335917ba7639dd0f709fa7e90030acc028949b01ffb2a37 |
|
MD5 | 86c510ff5723afd8280b412a67902990 |
|
BLAKE2b-256 | 6cc228838a367034f97a2e0fd10dd3da791b3c2cc9b725165d44186cd7438295 |
Hashes for dimod-0.8.8-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 572eff6e63d3b2236cd056e10c4136af548d53db30cbd9b6b1dcbbf2c6b1072e |
|
MD5 | 9e9e3645f70b093f0b6c64e20b95939b |
|
BLAKE2b-256 | d19d6f4a7825f9abf132a9149336c33543657d9d1944d61f80ff865ce330e592 |
Hashes for dimod-0.8.8-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bed643ddf244eeeec9cf32721aa1f0942833474f97523a887516285163f18d4 |
|
MD5 | b9e8a89066baedacd850905f22a5291f |
|
BLAKE2b-256 | 4c3da77777e40a35604a1e8a97fb9db9b8d8fe050d9fac580e03b4c0fb779174 |
Hashes for dimod-0.8.8-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffe261863873ce2d4a834a5df3e5e6e778bcff182880e3a3033f126cbd38672b |
|
MD5 | 2f991af02ce5c700c7e8f228525c159c |
|
BLAKE2b-256 | ffc286fa440b91aafe21c71898be831679af8bc0a36a785637ab3db0868463c7 |
Hashes for dimod-0.8.8-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d102a64ca0e3fc2f0fc59073ccd20a4d43e372c2add8a7cb1b4ea3158d2d2839 |
|
MD5 | 5d6bebe8cbd24e4cf4fa417087c2bc33 |
|
BLAKE2b-256 | 1342b2c335da0eb3d2c0d1d67161e012caff7b1b2cc0e9e307045aa9afd89bb2 |
Hashes for dimod-0.8.8-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b5b01229a7ea74c92fd256246a43cae957ecc81b7010691e3388013869ae6cb |
|
MD5 | 896b8b9ce4a02c50ad8a8839b0ff7bb6 |
|
BLAKE2b-256 | a14723790a6aa5064fd460ad4c7a9c1f399ce957985f7f784af1a2de45b732d7 |
Hashes for dimod-0.8.8-cp34-cp34m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94a3ed19351da1add5b1c93ff4e0d0c5a0e80f5b6e735ced6bf6ed30a40317af |
|
MD5 | 05d185157341094f2575fb3053972ced |
|
BLAKE2b-256 | 411939d65ded192c28d6d06f1f1d2cb05ec71bed0fbaca0eb5eebc6c79269c56 |
Hashes for dimod-0.8.8-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51e989786c5ed5086a3d21a9c01091e86100233b6190a19ae13fc34f431b9891 |
|
MD5 | 4e2aa46d0877c0630f4d680be7872014 |
|
BLAKE2b-256 | 14fe1c6b3be4d8f91cb9572094a082ede95ab107c5c15808bf218014aa2b3aba |
Hashes for dimod-0.8.8-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcc0bbf3abebc31a1514970901e137bd54002a3e6349092cf19038cf8b6539f7 |
|
MD5 | fa12ecf1f8d7ac0d409fbb5e138b68d7 |
|
BLAKE2b-256 | 8a2d7d56a7f60015cddd114be5ec35ea3eef479ec9b1412e6a6d2c9c319f6f50 |
Hashes for dimod-0.8.8-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e7078a3fed26252b5aa916fba82f9e33f45da51e91859c6c115349c9e8511f0 |
|
MD5 | d05e0eee2e103d50dc1d94586d8d4106 |
|
BLAKE2b-256 | 589ed4b3ad7871c56286e82a0c5d73953d2752a1eb736d69beab574a39c24c29 |
Hashes for dimod-0.8.8-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa2ddd64f943eb652f8815c0b3b27cf332a08be2a9564ec009bdcfc7f292da4c |
|
MD5 | b19554a0c27e4c5526bc87c9498da4d6 |
|
BLAKE2b-256 | 0eb66620f0bcd54af147ec22d85cb0dd8bb72376fb34212f4827db317c2695d5 |
Hashes for dimod-0.8.8-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38578552278c65c9d0fbff31aba6d4b15c43079c3de0bec71f3637e3173f6c07 |
|
MD5 | 82df4bffb76097da7eef9633efd5415e |
|
BLAKE2b-256 | aa2709770f8fef931a8ae97b18b1a11e7b9556d1d1ba4db7d2d25b8aa14262e3 |
Hashes for dimod-0.8.8-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9535d211b3af3787b16de713d87e8c6a5f090e9df1e5f004a0f3bd498a16759a |
|
MD5 | 4548bcdc37709ca86ca977508ceb5ac5 |
|
BLAKE2b-256 | 09aa9d118cb0bf2cb8f501250ee1a0dd8cb12bbd0072b075affb1062d1d7eba2 |
Hashes for dimod-0.8.8-cp27-cp27m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b88cdf1cef6a303ad2da5541476b6fc4ff9aa17e6d2891fc6a9cb5ba0e5515b6 |
|
MD5 | c349e57609cc1fe4c0c5b067dec0e2c3 |
|
BLAKE2b-256 | 09af1827231703a8c2510a68325d8e42ea3ca90a1d7791fe167d11bd58b0d864 |