EmbeddingComposite

Class

class EmbeddingComposite(child_sampler)[source]

Composite that maps problems to a structured sampler.

Enables quick incorporation of the D-Wave system as a sampler by handling minor-embedding of the problem into the D-Wave system’s Chimera graph. Minor-embedding is calculated using the heuristic minorminer library each time one of its sampling methods is called.

Parameters:sampler (dimod.Sampler) – Structured dimod sampler such as a DWaveSampler().

Examples

This example submits a simple Ising problem to a D-Wave solver selected by the user’s default D-Wave Cloud Client configuration file. EmbeddingComposite maps the problem’s variables ‘a’ and ‘b’ to qubits on the D-Wave system.

>>> from dwave.system import DWaveSampler, EmbeddingComposite
...
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> h = {'a': -1., 'b': 2}
>>> J = {('a', 'b'): 1.5}
>>> response = sampler.sample_ising(h, J)
>>> for sample in response.samples():    
...     print(sample)
{'a': 1, 'b': -1}

See Ocean Glossary for explanations of technical terms in descriptions of Ocean tools.

Properties

EmbeddingComposite.child First child in children.
EmbeddingComposite.children list [child_sampler] – List containing the structured sampler.
EmbeddingComposite.properties dict – Properties in the form of a dict.
EmbeddingComposite.parameters dict[str, list] – Parameters in the form of a dict.

Methods

EmbeddingComposite.sample(bqm[, …]) Sample from the provided binary quadratic model.
EmbeddingComposite.sample_ising(h, J, …) Samples from an Ising model using an implemented sample method.
EmbeddingComposite.sample_qubo(Q, **parameters) Samples from a QUBO using an implemented sample method.