FixedEmbeddingComposite

Class

class FixedEmbeddingComposite(child_sampler, embedding)[source]

Composite to alter the structure of a child sampler via an embedding.

Inherits from dimod.ComposedSampler and dimod.Structured.

Parameters:
  • sampler (dimod.Sampler) – Structured dimod sampler.
  • embedding (dict[hashable, iterable]) – Mapping from a source graph to the specified sampler’s graph (the target graph).

Examples

>>> from dwave.system.samplers import DWaveSampler
>>> from dwave.system.composites import FixedEmbeddingComposite
...
>>> sampler = FixedEmbeddingComposite(DWaveSampler(), {'a': [0, 4], 'b': [1, 5], 'c': [2, 6]})
>>> sampler.nodelist
['a', 'b', 'c']
>>> sampler.edgelist
[('a', 'b'), ('a', 'c'), ('b', 'c')]
>>> resp = sampler.sample_ising({'a': .5, 'c': 0}, {('a', 'c'): -1})

Sampler Properties

FixedEmbeddingComposite.properties dict – Properties in the form of a dict.
FixedEmbeddingComposite.parameters dict[str, list] – Parameters in the form of a dict.

Composite Properties

FixedEmbeddingComposite.children list – List containing the wrapped sampler.
FixedEmbeddingComposite.child First child in children.

Structured Sampler Properties

FixedEmbeddingComposite.nodelist list – Nodes available to the composed sampler.
FixedEmbeddingComposite.edgelist list – Edges available to the composed sampler.
FixedEmbeddingComposite.adjacency dict[variable, set] – Adjacency structure for the composed sampler.
FixedEmbeddingComposite.structure Structure of the structured sampler formatted as a namedtuple Structure(nodelist, edgelist, adjacency), where the 3-tuple values are the nodelist and edgelist properties and adjacency() method.

Methods

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