dwave.cloud.computation.Future.energies

Future.energies

Energy 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:Energies for each set of samples.
Return type:list or NumPy matrix of doubles

Examples

This example creates a solver using the local system’s default D-Wave Cloud Client configuration file, submits a random Ising problem (+1 or -1 values of linear and quadratic biases on all nodes and edges, respectively, of the solver’s garph) to a remote D-Wave resource for 10 samples, and prints the returned energies.

>>> import random
>>> from dwave.cloud import Client
>>> with Client.from_config() as client:  # doctest: +SKIP
...     solver = client.get_solver()
...     linear = {index: random.choice([-1, 1]) for index in solver.nodes}
...     quad = {key: random.choice([-1, 1]) for key in solver.undirected_edges}
...     computation = solver.sample_ising(linear, quad, num_reads=10)
...     print(computation.energies)
...
[-3976.0, -3974.0, -3972.0, -3970.0, -3968.0, -3968.0, -3966.0,
 -3964.0, -3964.0, -3960.0]