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.17-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd0564ff427058c66ef572e799e38f99235ed3895a7eff0fcb606c86051dd596 |
|
MD5 | 16704fdc41868d7df46edd593a477edd |
|
BLAKE2b-256 | ebaf91099282c1588be88c4d5d596bb4d8f4341f8b1c56ad7861e314a00ca0fd |
Hashes for dimod-0.8.17-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a908b358f55f26fd5f88bba33d9955645af2b2f4f9fc4234d262f143dbe72206 |
|
MD5 | e411aae0fbcf2bb6e46f1910a8649a79 |
|
BLAKE2b-256 | 00ac728e9d0bd2a08cf939b8a4f6964c3a09a2e9d1798acb024f56f0bc2fbf77 |
Hashes for dimod-0.8.17-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fe063483d85c5f28490d666533dfec98cef0b1c5ea2da29998f103d5ccba8f5 |
|
MD5 | 1614183e18e2b495c5ecddb88a78cc1c |
|
BLAKE2b-256 | bb9226ec7d5831d3154635e70efb7912e207619fda5f520d7daed0a59e085593 |
Hashes for dimod-0.8.17-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 703eb6adf61c4df56b0ee97c510a70e92349ac50e58a66ff6cc97a4aca1e1a59 |
|
MD5 | ea6a8b90ce9882c4ce0b34760dce6c1e |
|
BLAKE2b-256 | 4736ede6e2c52c2823f95e5d54929f6ea7c0aee76a60717b6965740f7773908f |
Hashes for dimod-0.8.17-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b10d3c1664c8e35e6f96d7f1731d2e04457a20dc8b45349d2c2232f0e0dd88ad |
|
MD5 | 0e2cfac4e747cd2441a2cdd1cdeec820 |
|
BLAKE2b-256 | 5c870c29af49a901c4a71c5b2c3c3902c6e49c8dc5aed5e08283df495cbeb0f0 |
Hashes for dimod-0.8.17-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23708a4d85c0d3b03820dab9d83f3c875315e29bce6b19b30d110cbf8aa1b119 |
|
MD5 | 755ea94c3db4228ed3e91addc79660c2 |
|
BLAKE2b-256 | b71070e6c46adf3f82682b251672e08a84ab203eb7ad700a02fe6c75dc92cb2b |
Hashes for dimod-0.8.17-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a11b368efe926031f724b1123177d59c58cda848c6b6d18fa7ab848582748a58 |
|
MD5 | bc0b45532c4cac20621af385c7b15e4e |
|
BLAKE2b-256 | 2bd792b8ebac549618141546bd2411e012353d01585c5941c88d60a1249a5afb |
Hashes for dimod-0.8.17-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ffed5e50f88cd05b7f642e884408e79a2c32b00875db8d57d3fa73e6b53c1e5 |
|
MD5 | b65ea6b97253fdf7c710a26a32545150 |
|
BLAKE2b-256 | 34f98d555d19342b05324ea091edb4cedcb5fd13c542f34d7705be4397853331 |
Hashes for dimod-0.8.17-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d1f1cef88014e2cacaf78d290bd2425a9b9a280036e650004f3b874134b5af3 |
|
MD5 | 0a874e096a117bd07fb16fae6007bffe |
|
BLAKE2b-256 | d60a8f7eedb5be52980634d24c4737e1780c3c14aa48659c6e5491d3a4c65b99 |
Hashes for dimod-0.8.17-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28d36b558d682115e48aade165f4c6b46c24f9f47cb9d18b4fc6921491afcb32 |
|
MD5 | bd6b0ce885e24f32952218f7d7892981 |
|
BLAKE2b-256 | 1d9a54a237a0deab104554b4fb8ee1b6ec7b8728a017d220a1af9528546bbaa4 |
Hashes for dimod-0.8.17-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0a180054a2d1a132b70d581ddaa9951b5b058513349184b9cdca3b8cee34720 |
|
MD5 | d6899a14bbaf5c2df97b288d8daa9f5f |
|
BLAKE2b-256 | d9994df516223c91f837e56d1e2a0e5c5e1969072a605d7b964f4f06503ee4b2 |
Hashes for dimod-0.8.17-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53105ad749e11acb16e5952b10b80d711d9fc34541028f660addf11910c1b4d4 |
|
MD5 | 813f6d7e82a0a0dfff9928afecd53c04 |
|
BLAKE2b-256 | ef0a5f1c64708f18b848d344ca01f2ab4887711ebc9f4876d8e1e336a25f254b |
Hashes for dimod-0.8.17-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7139d55e38babe213fbc80e4c82f01fc6e7791114dd6ac3971a94af1d8765b07 |
|
MD5 | 8b446b9dbd18c0d2d035d0b0962516ff |
|
BLAKE2b-256 | a621d7c4c7a7037e99ac22321e2c0ab381a44c4ab2dcc37d34d44e7a5e55e50c |
Hashes for dimod-0.8.17-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c28fa30d4182a31e3bae0c61d43300bad7bc52ce3d5e67f68cec75e0f08e31a |
|
MD5 | a1b23b882c7686b8fc5b2cf5c75d231b |
|
BLAKE2b-256 | c7153839b0b911549d5704b2d8de2b28bf0f44688bb74fa80e2ef5931a29f69c |
Hashes for dimod-0.8.17-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 806830a7291bc11fcba9e4d566f20d36bae362bf402a640eb701cd57f9981304 |
|
MD5 | 8813a9dd50ee623387a154f2f521b432 |
|
BLAKE2b-256 | 4b428404cb2c27ee813702de0a46a5e8755d003eb1806f40c614f0d4b08c55b7 |
Hashes for dimod-0.8.17-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57f4fc767ffa24c4359fb0fbbbd335f98e86446b23e2c742125e335225629b6f |
|
MD5 | 3e3ac5ec656caf028fd4992ef2101cbd |
|
BLAKE2b-256 | 9e2c5746297446b99d76439d33843fb228917d51b3876c91e0adbb17c1de2f89 |
Hashes for dimod-0.8.17-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c5e9e62ce3e2a9e42dee74deb2570076b62ff4e80dcaaae76120882a6f2eb16 |
|
MD5 | a9ec79228697a649efa680c4e472ab92 |
|
BLAKE2b-256 | dceb8a86bec29d1697c6e7f82b020237552cf8b735f37ba4f73155e11b3eb2d0 |
Hashes for dimod-0.8.17-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a77f5c4b78429121e8b3ac9806416baf7bd4e1283d54629ba5157582322ea28 |
|
MD5 | e4687cd4d3b0aeb27dc87e072015c6bc |
|
BLAKE2b-256 | 9a690b220fa2aeb760b850f52503f18c0eaddfefc9aecd10d0aec27d060b5f76 |
Hashes for dimod-0.8.17-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3a8de413744e45daa6ffca7ed5c70c7b640bab09ad920328788496339a0a1d6 |
|
MD5 | 89c097300a26a98d24a1aefd6921cb2d |
|
BLAKE2b-256 | 934e9c70c2466f987865fdf41afadddf178a0413759c93b30814e60db3e7a97a |
Hashes for dimod-0.8.17-cp34-cp34m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b8660c11b1c3e19ca90f5729f666232333760ef985e61f4e932881800af02d1 |
|
MD5 | d8b4ad3de122ed0c7846c4f52be98cf9 |
|
BLAKE2b-256 | 0bc96fd833bb97eeb29e7f362cbaf96974ffd71eda86ad6a558c8830d1479ff7 |
Hashes for dimod-0.8.17-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df217d695f6336ad365484ca9868148267f220c412c51b0acd2cbe85cba76bf9 |
|
MD5 | c6abc1b97cccd6c9639c98a34590c179 |
|
BLAKE2b-256 | be1ad52319bc0e35d11c22b622654344f8c69f94ea28c1dd4a943c4458033a07 |
Hashes for dimod-0.8.17-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f144411572fa1b11d7f1a4ebb669c8263f053605c01db84bbb68ba8d7c8211de |
|
MD5 | 5cb443e4a2a369d806ab0f97def7e845 |
|
BLAKE2b-256 | 109005efac5275ff1807f4855a73bb705845ea1e14bbe138baf1c57165a4e322 |
Hashes for dimod-0.8.17-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdb176354d05c439070109dacb927a408767bb7b60d03470b82beb80ea548489 |
|
MD5 | ae2a347f5e39adef0fc66bef9ff5e267 |
|
BLAKE2b-256 | e252ac85e9890de4320600fb312500eaa2917d46dcfb09439e3b27b305ed5373 |
Hashes for dimod-0.8.17-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad96e00d2332f41a9cdc8c0e57cbc889fa3ca263cbec9204ce57e7001ac5e234 |
|
MD5 | 5a1f09c7a7719fecd07c65a73bc9298a |
|
BLAKE2b-256 | 1144be3984b5a68b77069e95ce33501caf3049b1a3c6a698319546688c04ab61 |
Hashes for dimod-0.8.17-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccdd41afb11091ebee332bd46f7595546680019a9e6a37d70b2258e90a26123d |
|
MD5 | 63eed5284c301f9dc7875a7a3bf8e83d |
|
BLAKE2b-256 | 69c57c7468e9236896911f98be1d42ea8924e404132bcda27e0e673c5b541194 |
Hashes for dimod-0.8.17-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dfa33937cc24637f4549d6b4b9a89e09ca717b2d64c9a9bafc5cc2c8f775344 |
|
MD5 | 8582b6273e6c894ec17a0e054846da82 |
|
BLAKE2b-256 | 36028353d406e0f8a07ab2ad240e93756cbf3a210b8da915dfbe132ec0dae5cd |
Hashes for dimod-0.8.17-cp27-cp27m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de094b4550418b38668282ee0e535470ae8067ec57a427b43db3882fc3107687 |
|
MD5 | 9fd333b52775f5a0df09805ce3772d81 |
|
BLAKE2b-256 | a144631eaff8941913650f7d06aa970ada91a6a22f9aa303bf5d43c9c3445284 |