dimod.reference.composites.structure.StructureComposite.sample

StructureComposite.sample(bqm, **sample_kwargs)[source]

Sample from the binary quadratic model.

Parameters:bqm (BinaryQuadraticModel) – Binary quadratic model to be sampled from.
Returns:SampleSet

Examples

This example submits an Ising problem to a composed sampler that uses the dimod ExactSolver only on problems structured for a K2 fully connected graph.

>>> import dimod
...
>>> response = dimod.StructureComposite(dimod.ExactSolver(),
...                  [0, 1], [(0, 1)]).sample_ising({0: 1, 1: 1}, {})
>>> print(next(response.data()))
Sample(sample={0: -1, 1: -1}, energy=-2.0, num_occurrences=1)