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.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e3fe2f59cdaa5fc4a747b6f96ab9ddd991b0dd7ab23ea7ae1975b4723c608c3 |
|
MD5 | 2080156e00305e34eae56f077203071f |
|
BLAKE2b-256 | 27f5ca5260548d9b7d9fb039e699185bfa80ee3b2109198d5295be0d64a93013 |
Hashes for dimod-0.8.4-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 288c3de322a370248ac869fdf603b6c61444fc5aed059d4a01cd9201a4de7eef |
|
MD5 | f0da32c3c6db88b180483d009c4aa869 |
|
BLAKE2b-256 | a729c3b8da1326c101a9114dd5eea5915acad44205e269b4ae5f20763f1d9344 |
Hashes for dimod-0.8.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 797ceeaa5d1a1010153db9abac2bf5bb61d1de3cec3d5b10c53a34786915dcd9 |
|
MD5 | 76c0b8c216cea25d08d8d1480bf508a8 |
|
BLAKE2b-256 | e7c781bb3ccb265c190f9ba6ec6b3b27047b90a2ab65a1e585893e67950c41a3 |
Hashes for dimod-0.8.4-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2792b6a2b7723c6a3dd3d6d06c7b359c8fbc7289e6999f66ed20c58aacd347a7 |
|
MD5 | 40f4356a40939fc811f8a7ef183da66a |
|
BLAKE2b-256 | d33c9b86193ce89adbd16310d6d4d749d7b9dc734ec18b31325c522856924ac5 |
Hashes for dimod-0.8.4-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a68eefda9a552b95fe08ab9c81b79499951493d18ae511aba85b45bb3939fdb2 |
|
MD5 | 0a905213489de09f26383214dd0230ad |
|
BLAKE2b-256 | 4b4019904cc1ed65b663734f5ac19901f0188a3b067770a7e798ff05b617ee06 |
Hashes for dimod-0.8.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94a293c8017f7a959c01bf69c719a978d44f68b3099eaea8ce1cded4c7cc0958 |
|
MD5 | 80219fb2696539ecaebd8410fb8788ba |
|
BLAKE2b-256 | b3d58b3d0c71b382ff0681463906c680e9a30d401f9a891044ca3ac9a9f60f60 |
Hashes for dimod-0.8.4-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e789b0e3f06f293f6b53d91fd4dfba19772c537d6bf0a6bd405ba148c51f7c4 |
|
MD5 | 078e489701198f9e67417005e12c6f20 |
|
BLAKE2b-256 | 0a33841b4832f014be8fc7cd6c447d5218c0a7634145591f44f43aea93dc2796 |
Hashes for dimod-0.8.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bcce194feb8cfc0ffaf246bc08ad0003e1076ef854853490f219310d133835d |
|
MD5 | 97615c528146c9449209e2374aab550b |
|
BLAKE2b-256 | d0beb01d03f6a76ba899ced94c218d55b01bb93ec1d033eb9ab57cb193fcc399 |
Hashes for dimod-0.8.4-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27807fe412c8eae0439b4ceb1c84358959c75c46ecd726c7b8ec791e1cc6ad0d |
|
MD5 | 3a056a6e1712196478f031de58aa7ce2 |
|
BLAKE2b-256 | cb5cf907a405cc37aa64a7974ddeee58945dab0c82b92252af4b39f2948c231a |
Hashes for dimod-0.8.4-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93e0c881e73d0b48c2f645e2464fc5af5ba3fc25882dd9e0b5278c8905906eb6 |
|
MD5 | 7b9b8ae9c09e82464038e7066fe86ae1 |
|
BLAKE2b-256 | 3aeae25f7a13a45abfe880c20d7b700cb6ce2bf5742890ed16e76cf9aa754372 |
Hashes for dimod-0.8.4-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce7494534142a2a77a38daf267a20cbb5010c4316617a971bf751c7fb0a27119 |
|
MD5 | 57b15d73e4756af080890abd8523ae28 |
|
BLAKE2b-256 | 0fb21c807c4ab3e233d79631f161a2ff55579ec198a1b1c5f0e6c571892caa8f |
Hashes for dimod-0.8.4-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e25b02aad40c9bdaa7ab60d94e3c76bd457088aa451b491da8d7aa750140aa1 |
|
MD5 | 1005bd806770d43a83f8e56c9ee73b7a |
|
BLAKE2b-256 | d6510b85eaef6f74bcffb21a1d0d76f9b76edf097da7b99c9d4f9332980d2c17 |
Hashes for dimod-0.8.4-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c8a8c307926607be88c200b35dce193838af261a515b9f45bf60079f2c4b5fa |
|
MD5 | 1a3a4edc317d1584b4d2ddaccd915d17 |
|
BLAKE2b-256 | cdb6575b7de9164b3a124ed20daec3b1a2b2c44d64c3ec80612c83e1939c624c |
Hashes for dimod-0.8.4-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbdeac90379f198f3fd50fb2df1169794d5f0e92e837fb3081820f2ba2b30444 |
|
MD5 | 0f9264e10f0d3824b8bfa359c0238ec9 |
|
BLAKE2b-256 | e372685e51826364ef5a2b974c0f7d64dbe4d1cdab548d0e8ec907c47c1e1d66 |
Hashes for dimod-0.8.4-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47d3c8f16e4aeeff7fe74938a4b53401f8d6587ff2dd7c582da2d649fc5ad297 |
|
MD5 | d67bc5aa67a02beee447bd53b216c29a |
|
BLAKE2b-256 | 85c386c4442a827a9ba55758c5279b1c370f5e34765cc9091ebc43b8d297bbea |
Hashes for dimod-0.8.4-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 143ebd32fb8572df2bd5e0e8b6167067762adcdac10d9aa27c6452e4bf4499a2 |
|
MD5 | 47a4d77a13af91b35bacd8a94622c5f6 |
|
BLAKE2b-256 | c009437de187bf59687ab5649495f3035b756269707f17db648aca5da0c91525 |
Hashes for dimod-0.8.4-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 919bbbe704c633c421a3c15c866feffe5d6cb41626ae90aa422482521e2bb542 |
|
MD5 | 64678cb9a75cf4adcd355b1475c4c43c |
|
BLAKE2b-256 | bd35db49eb8aea1e639e74a02b12d261c7ab829800510004bbc1843a1aa3a97a |
Hashes for dimod-0.8.4-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f61bb487604759ec24e662992001ff94423b385ecfd1da37b93ca32051a0c394 |
|
MD5 | f2c2eb99e4ac23ce2f92b96ffb7bf452 |
|
BLAKE2b-256 | f5170494a0e95276d0521c50b8f082134179533c3d057f708e98e075b6b3f378 |
Hashes for dimod-0.8.4-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cfa96ba3884f8fa1908e7d54e67bd8ba57d0b0ea361fd072c44c4cbba782144 |
|
MD5 | 05b45426e9bb7fe06379890098a496f7 |
|
BLAKE2b-256 | 46cea62db630ed92c87f88b2864fb118c88c97fd3726d6412e645b7f4abbf04a |
Hashes for dimod-0.8.4-cp34-cp34m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c016d3cfc4faf0f09be942409fa0d1a508fd71d2c29727f8563682922cb7724 |
|
MD5 | 03cdbda2fc36b8bc628bd6096963611a |
|
BLAKE2b-256 | 860f86242914a5cb3cbb97f39b6a1c74c9881b0ce6d1cc7e1156e8ce0ce2fbbb |
Hashes for dimod-0.8.4-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc586ed7f23a8ae28ad3607162e8028ff95eb691fc74cc205d94d4dda45b1b77 |
|
MD5 | 72c2b5fcc37917a6baecd5d264d09133 |
|
BLAKE2b-256 | e453413fae20447130dfa64f308f5ec0d7e677d372b1eabf1bf9be15032d9dfa |
Hashes for dimod-0.8.4-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f163263b42e7b9a1565f9a3416d1636f7af7f49b2bfa396fdd9884e23caa161 |
|
MD5 | b73b5704e67868420b5c90031976ef9f |
|
BLAKE2b-256 | 81525f111bb2447b1b1a554526bf4bf652c25850e262f687daa99657c7f119a4 |
Hashes for dimod-0.8.4-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbd07f65581a43af2c2d38a98ad2983af920b26da7471a3b578ddf832043125f |
|
MD5 | b6cbf75fdf1a0de31042499f13452b4c |
|
BLAKE2b-256 | f324f84d6c5090526555751b46f8b83137a79165c6443c58fd713d851cc303af |
Hashes for dimod-0.8.4-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e98f60d10f2bbe4f23bf6d80b972906ac003e3b8b80c4dcf3003fb821d2b23a0 |
|
MD5 | bfd6d416232b6c2d586b4dc90888e5bd |
|
BLAKE2b-256 | 93a8188e1537a66e57010fa512387b4dd5c4dc18c2280ff6fce0a89ffced2d93 |
Hashes for dimod-0.8.4-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b2c87945b015ce3b5f72e48e92d6ca8f6fac68a092739b22ba6c7eae3ef2620 |
|
MD5 | cb55dd89200e76164a3fee785879a93d |
|
BLAKE2b-256 | 660c8d76709c696f6103706220b0f2a9a1a21adc01f0bcf5ce22b869117ae637 |
Hashes for dimod-0.8.4-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e78e762549dc6e3f3add03fa842fc609ecc009c849e16bdd7e103967c2d388e2 |
|
MD5 | 7988cf91ca287a26b23a4875b71b545b |
|
BLAKE2b-256 | 196559eb6374e8502cd94d3424dbbbc1077761421d93da843d9e2d77d05a6b23 |
Hashes for dimod-0.8.4-cp27-cp27m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f39ce7ed394cb4710d50da643ba2def112b744acfafecd0c664d1b8beb84f30d |
|
MD5 | c85c6a179be8b14769575fadf7f82532 |
|
BLAKE2b-256 | 9f6d322648e0c85e0acffd85e4452a1b7dbd2ee1987a27f08616e09b8657c9be |