dwave.cloud.computation.Future.samples

Future.samples

State buffer for the submitted job.

First calls to access data of a Future object are blocking; subsequent access to this property is non-blocking.

Returns:Samples on the nodes of solver’s graph.
Return type:list of lists or NumPy matrix

Examples

This example creates a solver using the local system’s default D-Wave Cloud Client configuration file, submits a simple QUBO problem (representing a Boolean NOT gate by a penalty function) to a remote D-Wave resource for 5 samples, and prints part of the returned result (the relevant samples).

>>> from dwave.cloud import Client
>>> with Client.from_config() as client:  # doctest: +SKIP
...     solver = client.get_solver()
...     u, v = next(iter(solver.edges))
...     Q = {(u, u): -1, (u, v): 0, (v, u): 2, (v, v): -1}
...     computation = solver.sample_qubo(Q, num_reads=5)
...     for i in range(5):
...         print(computation.samples[i][u], computation.samples[i][v])
...
...
(1, 0)
(0, 1)
(0, 1)
(1, 0)
(0, 1)