dwave.system.composites.FixedEmbeddingComposite.sample_ising

FixedEmbeddingComposite.sample_ising(h, J, **parameters)

Samples from an Ising model using an implemented sample method.

Examples

This example implements a placeholder QUBO sampler and samples using the mixin Ising sampler.

>>> import dimod
>>> class ImplementQuboSampler(dimod.Sampler):
...     def sample_qubo(self, Q):
...         return dimod.Response.from_dicts([{1: -1, 2: +1}], {'energy': [-1.0]}) # Placeholder
...     @property
...     def properties(self):
...         return self._properties
...     @property
...     def parameters(self):
...         return dict()
...
>>> sampler = ImplementQuboSampler()
>>> h = {1: 0.5, 2: -1, 3: -0.75}
>>> J = {}
>>> response = sampler.sample_ising(h, J)
>>> print(response)
[[-1  1]]