dwave.system.samplers.DWaveSampler.sample_ising

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

Sample from the provided Ising model.

Parameters:
  • h (list/dict) – Linear biases of the Ising model. If a list, the list’s indices are used as variable labels.
  • 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
Returns:

dimod.Response

Examples

This example creates a DWaveSampler based on a D-Wave solver selected by the user’s default D-Wave Cloud Client configuration file and submits a simple Ising problem of just two variables that map to qubits 0 and 1 on the example system. (The simplicity of this example obviates the need for an embedding composite—the presence of qubits 0 and 1 on the selected D-Wave system can be verified manually.)

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