Hybrid Asynchronous Decomposition Sampler prototype framework.
.. image:: https://badge.fury.io/py/dwave-hybrid.svg :target: https://badge.fury.io/py/dwave-hybrid :alt: Latest version on PyPI
.. image:: https://circleci.com/gh/dwavesystems/dwave-hybrid.svg?style=shield :target: https://circleci.com/gh/dwavesystems/dwave-hybrid :alt: Linux/MacOS/Windows build status
.. image:: https://img.shields.io/codecov/c/github/dwavesystems/dwave-hybrid/master.svg :target: https://codecov.io/gh/dwavesystems/dwave-hybrid :alt: Code coverage
.. image:: https://img.shields.io/pypi/pyversions/dwave-hybrid.svg?style=flat :target: https://pypi.org/project/dwave-hybrid/ :alt: Supported Python versions
.. index-start-marker
A general, minimal Python framework for building hybrid asynchronous decomposition samplers for quadratic unconstrained binary optimization (QUBO) problems.
dwave-hybrid facilitates three aspects of solution development:
The framework enables rapid development and insight into expected performance of productized versions of its experimental prototypes.
Your optimized algorithmic components and other contributions to this project are welcome!
.. index-end-marker
.. installation-start-marker
Install from a package on PyPI::
pip install dwave-hybrid
or from source in development mode::
git clone https://github.com/dwavesystems/dwave-hybrid.git
cd dwave-hybrid
pip install -e .
.. installation-end-marker
Install test requirements and run unittest
::
pip install -r tests/requirements.txt
python -m unittest
.. example-start-marker
.. code-block:: python
import dimod
import hybrid
# Construct a problem
bqm = dimod.BinaryQuadraticModel({}, {'ab': 1, 'bc': -1, 'ca': 1}, 0, dimod.SPIN)
# Define the workflow
iteration = hybrid.RacingBranches(
hybrid.InterruptableTabuSampler(),
hybrid.EnergyImpactDecomposer(size=2)
| hybrid.QPUSubproblemAutoEmbeddingSampler()
| hybrid.SplatComposer()
) | hybrid.ArgMin()
workflow = hybrid.LoopUntilNoImprovement(iteration, convergence=3)
# Solve the problem
init_state = hybrid.State.from_problem(bqm)
final_state = workflow.run(init_state).result()
# Print results
print("Solution: sample={.samples.first}".format(final_state))
.. example-end-marker
Documentation for latest stable release included in Ocean is available as part
of Ocean docs <https://docs.ocean.dwavesys.com/en/stable/docs_hybrid/>
_.
Released under the Apache License 2.0. See <LICENSE>
_ file.
Ocean's contributing guide <https://docs.ocean.dwavesys.com/en/stable/contributing.html>
_
has guidelines for contributing to Ocean packages.