dwave.cloud.solver.StructuredSolver.sample_qubo¶
-
StructuredSolver.sample_qubo(qubo, **params)¶ Sample from the specified QUBO.
Parameters: Returns: FutureExamples
This example creates a client using the local system’s default D-Wave Cloud Client configuration file, which is configured to access a D-Wave 2000Q QPU, submits a QUBO problem (a Boolean NOT gate represented by a penalty model), and samples 5 times.
>>> 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]) ... ... (0, 1) (1, 0) (1, 0) (0, 1) (1, 0)