dwave.system.composites.TilingComposite.sample_qubo¶
-
TilingComposite.
sample_qubo
(Q, **parameters)¶ Samples from a QUBO using an implemented sample method.
Examples
This example implements a placeholder Ising sampler and samples using the mixin QUBO sampler.
>>> import dimod >>> class ImplementIsingSampler(dimod.Sampler): ... def sample_ising(self, h, J): ... 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 = ImplementIsingSampler() >>> Q = {(0, 0): -0.5, (0, 1): 1, (1, 1): -0.75} >>> response = sampler.sample_qubo(Q) >>> print(response) [[0 1]]