diff --git a/README.md b/README.rst similarity index 74% rename from README.md rename to README.rst index 591f5ac9d..11c46abe6 100644 --- a/README.md +++ b/README.rst @@ -1,10 +1,19 @@ -# dimod +dimod +===== -[![Build Status](https://travis-ci.org/dwavesystems/dimod.svg?branch=master)](https://travis-ci.org/dwavesystems/dimod) +.. image:: https://travis-ci.org/dwavesystems/dimod.svg?branch=master + :target: https://travis-ci.org/dwavesystems/dimod + +.. image:: https://ci.appveyor.com/api/projects/status/kfhg35q12fa0lux8?svg=true + :target: https://ci.appveyor.com/project/arcondello/dimod + +.. image:: https://coveralls.io/repos/github/dwavesystems/dimod/badge.svg?branch=master + :target: https://coveralls.io/github/dwavesystems/dimod?branch=master A shared API for QUBO/Ising samplers. -## Included Samplers +Included Samplers +----------------- dimod comes with a few samplers that are useful as reference implementations and for unit testing. @@ -12,7 +21,8 @@ dimod comes with a few samplers that are useful as reference implementations and * ExactSolver: determines the energy for every possible sample, but is extremely slow. * RandomSampler: Generates random samples. Used for testing. -## Basic Usage +Basic Usage +----------- ```python >>> import dimod @@ -39,17 +49,23 @@ The response object returned has many ways to access the information See documentation for more examples. -## Install +Install +------- Compatible with Python 2 and 3. `pip install dimod` +To install with optional components + +`pip install dimod[all]` + To install from source: `python setup.py install` -## License +License +------- Released under the Apache License 2.0. See LICENSE.txt diff --git a/dimod/composite_template.py b/dimod/composite_template.py deleted file mode 100644 index 549863e14..000000000 --- a/dimod/composite_template.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -Samplers can be composed. This pattern allows pre- and post-processing -to be applied to binary quadratic programs without needing to change -the underlying sampler implementation. - -We refer to these layers as `composites`. Each composed sampler must -include at least one `sampler`, and possibly many composites. See -'dimod sampler composition pattern' figure below. - -Each composed sampler is itself a dimod sampler with all of the -included methods and parameters. In this way complex samplers -can be constructed. - - -Examples --------- - -We will be using the included composite :class:`.SpinReversalTransform` -and included samplers :class:`.ExactSolver` and -:class:`.SimulatedAnnealingSampler` in our examples. - -Building composed samplers are easy - ->>> composed_sampler_es = dimod.SpinReversalTransform(dimod.ExactSolver()) - -A composite layer can be applied to any dimod sampler. - ->>> composed_sampler_sa = dimod.SpinReversalTransform(dimod.SimulatedAnnealingSampler) - -These composed samplers themselves behave exactly like samplers. - ->>> h = {0: -1, 1: 1} ->>> response = composed_sampler_es.sample_ising(h, {}) ->>> list(response.samples()) -[{0: 1, 1: -1}, {0: -1, 1: -1}, {0: 1, 1: 1}, {0: -1, 1: 1}] - -Composite layers can also be nested. - ->>> composed_sampler_nested = dimod.SpinReversalTransform(composed_sampler_es) - -""" -from dimod import TemplateSampler - - -class TemplateComposite(TemplateSampler): - """Serves as a template for composites. Not intended to be used directly. - - Args: - *samplers: child sampler(s) of the composite. - - Attributes: - children (list): A list of child samplers or child composed samplers. - - """ - def __init__(self, *samplers): - TemplateSampler.__init__(self) - self.children = list(samplers)