DWaveSampler.sample_ising(h, J, **kwargs)[source]

Sample from the specified Ising model.

  • h (dict/list) – Linear biases of the Ising model. If a dict, should be of the form {v: bias, …} where v is a spin-valued variable and bias is its associated bias. If a list, it is treated as a list of biases where the indices are the variable labels, except in the case of missing qubits in which case 0 biases are ignored while a non-zero bias set on a missing qubit raises an error.
  • J (dict[(int, int) – float]): Quadratic biases of the Ising model.
  • **kwargs – Optional keyword arguments for the sampling method, specified per solver in DWaveSampler.parameters. D-Wave System Documentation’s solver guide describes the parameters and properties supported on the D-Wave system.

A dimod SampleSet object. In it this sampler also provides timing information in the info field as described in the D-Wave System Documentation’s timing guide.

Return type:



This example submits a two-variable Ising problem mapped directly to qubits 0 and 1 on a D-Wave system.

>>> from dwave.system.samplers import DWaveSampler
>>> sampler = DWaveSampler()
>>> sampleset = sampler.sample_ising({0: -1, 1: 1}, {})
>>> for sample in sampleset.samples():    # doctest: +SKIP
...    print(sample)
{0: 1, 1: -1}

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