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
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.7.7-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f310edcdafd1d5970079303e4fc7c2079121ec2eae359180571b744951512dc |
|
MD5 | fe8a52420cdd0512f7e1942f8300bc74 |
|
BLAKE2b-256 | 063cc74bd6bfec995376c14598993964b4f3b41d9c95d946ee49b47eab682ae9 |
Hashes for dimod-0.7.7-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 160ce670909c13562d8bf0a25a9930f41147c9afedae5c3cc0b98c1a6a2b53c8 |
|
MD5 | 626b89bb3dec27929092716c80acee20 |
|
BLAKE2b-256 | c781b771f71bc90b319b94cd1e5fbda72bddfe597f154a060a148f5b8f843dcb |
Hashes for dimod-0.7.7-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e4d42b32f73a7ce83a5322767fc0e2ade97b4ba205368073a9e6fe206bc4205 |
|
MD5 | c7162e18eac6d91b3e5e99a829a226fe |
|
BLAKE2b-256 | 4c4a425302fe7bcc06a49d1b2a02131c414c08bdcfdfd91ff94b8db893648e2d |
Hashes for dimod-0.7.7-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c251ee0a546d3945b9b8b733a0a1b02796d882ec40fb1d64cc428bcdb1b7ce6c |
|
MD5 | 3e16bb7e658b7aa05824e816df00c659 |
|
BLAKE2b-256 | fa8084eb1c98e5af3fe76da656dc97cc3d328998ad045083268d5e26c9a83f03 |
Hashes for dimod-0.7.7-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b88d390d75b8859721f62ab50a3c0e35bce1d050bbd7165560880977540f2914 |
|
MD5 | 1ca7481fa23587af9944d9ce5b4d432b |
|
BLAKE2b-256 | 9c5942b02780f06f95a03316167254f929c8e6cbca4c9abcb0f464deecc66833 |
Hashes for dimod-0.7.7-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7880846fee00aae92b83ac9ba5eeee58fa0f6adcbe7746cb533683962240f0f |
|
MD5 | 96e757238f3216441d612705c0e58ce3 |
|
BLAKE2b-256 | 7ad0138a2d7998f973796fd59dfb969d939fa49765c427048b911a81bbde33f1 |
Hashes for dimod-0.7.7-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f41834794bd1bbd30ee676cbecbc29bdd82cd76aa6a15bbc1737e72da9de37eb |
|
MD5 | 01f2634e086fe9f111d1c9b1300ec72a |
|
BLAKE2b-256 | 941f666398f0e3bd45c1a1a0b0d7206ee4320cb9fe0da9796f62d25af018a45b |
Hashes for dimod-0.7.7-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65f1583c9f1821e275712f90d3f248210907b02ac8599237597b4ba79b008751 |
|
MD5 | aec6620ce1a24f3eef0cabb6b992635c |
|
BLAKE2b-256 | ec3465cf924eb732b763a995267b8cb04670b367794f2e381addbe870617a2f8 |
Hashes for dimod-0.7.7-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f6ac559721f91ae5efb49c807c474126b747e550a76bb592dece3df4d4aa30d |
|
MD5 | 136119a30436b53c811e0101aa32daee |
|
BLAKE2b-256 | 6dc701694b74815b9159a55f3a12a2d631714484d594a80cbd9008ca9d0a4ac7 |
Hashes for dimod-0.7.7-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d614a5e4149eeb4b6b2ecbc4f6fa5558a3d6498009f973eb30526a66b61e2f54 |
|
MD5 | ce99a3cfe452f8ee87f0297963bf3084 |
|
BLAKE2b-256 | 167a03c54eea19de00c5829de1b125bad54c1992bc10b6a5891adfe1477dcbc6 |
Hashes for dimod-0.7.7-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccafae98650b4022a0a50a86af51932a83dbfad44b6e00735f749ee1f7c6d768 |
|
MD5 | 8ad5709e099c471f5fa0683d2157cb5a |
|
BLAKE2b-256 | ab911bed3a6852b770e58e094224d1a648997d04809465217b1ffda766c05cc9 |
Hashes for dimod-0.7.7-cp34-cp34m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7831e58a2d30bda88a7bcdb8b75ec80690144c02550bffa56101982c32a6568 |
|
MD5 | c228703d2b72427f03e7bd4b31411ce0 |
|
BLAKE2b-256 | 9bde40271905d19f156c83b3527d9a5651eb0b97252c147b82d37eabcb468874 |
Hashes for dimod-0.7.7-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 865faf0292256fa27d4b5f69603b43dd7c61c288183bed0d0ecbeae35357b65a |
|
MD5 | 2b70945de7c9a43c0eb4d7b0e789cf57 |
|
BLAKE2b-256 | 6bccdc4ad2bbbdcde983e86115b5fa3cf0c8f71070594b66762d9909b4139f67 |
Hashes for dimod-0.7.7-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca43b3f121d331422347eaa4b38ef930cbe56ef0b387954926ade171a11a4177 |
|
MD5 | b74a326435836dfbb8b27c7dff3cbb64 |
|
BLAKE2b-256 | a8917037d32df94adfc052f5c9a7f12cf35df3d968b6e6273951f6013586b1ff |
Hashes for dimod-0.7.7-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e47e5cde338538a9a66769848b5ee40ec9a38014afefdc0e79032e589f2c604c |
|
MD5 | 5a88bc591214579670387058e39a631f |
|
BLAKE2b-256 | 1ec7fb55b17943b55c6d06748f45931d9c45100b587bd34a16dc089a6b3803fc |
Hashes for dimod-0.7.7-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51e3e344783b161a04151d7e81536f4f32d40321e513cb8d6a8d302848119f6e |
|
MD5 | 2969aaa6ded063b38f0971a6e27eca58 |
|
BLAKE2b-256 | 46dac655db65c4b45d0ab5559e2c5214aa3471001aaadfce8309a78b1be15d9b |
Hashes for dimod-0.7.7-cp27-cp27m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75c166fe235abd3399e7fd58aed924a920a567e9ed4f9fc299fbb355fb380ca5 |
|
MD5 | 3ef237491f9b58d1a8f8d0143c77eb4c |
|
BLAKE2b-256 | a916a814ec79a733fb816c427baf1f02fa21c2ce44ff6e99ee35d1dd846a4060 |