dwave.system.composites.TilingComposite.sample¶
-
TilingComposite.
sample
(bqm, **kwargs)[source]¶ Sample from the provided binary quadratic model
Parameters: - bqm (
dimod.BinaryQuadraticModel
) – Binary quadratic model to be sampled from. - **kwargs – Optional keyword arguments for the sampling method, specified per solver.
Returns: Examples
This example uses
TilingComposite
to instantiate a composed sampler that submits a simple Ising problem of just two variables that map to qubits 0 and 1 on the D-Wave solver selected by the user’s default D-Wave Cloud Client configuration file. (The simplicity of this example obviates the need for an embedding composite.) Because the problem fits in a single Chimera unit cell, it is tiled across the solver’s entire Chimera graph, resulting in multiple samples.>>> from dwave.system.samplers import DWaveSampler >>> from dwave.system.composites import EmbeddingComposite, TilingComposite >>> sampler = TilingComposite(DWaveSampler(), 1, 1, 4) >>> response = sampler.sample_ising({0: -1, 1: 1}, {}) >>> for sample in response.samples(): ... print(sample) ... {0: 1, 1: -1} {0: 1, 1: -1} {0: 1, 1: -1} {0: 1, 1: -1} {0: 1, 1: -1} {0: 1, 1: -1} {0: 1, 1: -1} {0: 1, 1: -1} >>> # Snipped above response for brevity
- bqm (