dwave.cloud.solver.StructuredSolver.check_problem#

StructuredSolver.check_problem(linear, quadratic)[source]#

Test if an Ising model matches the graph provided by the solver.

Parameters:
  • linear (list/dict) – Linear terms of the model (h).

  • quadratic (dict[(int, int), float]) – Quadratic terms of the model (J).

Returns:

bool

Examples

This example creates a client using the local system’s default D-Wave Cloud Client configuration file, which is configured to access an Advantage QPU, and tests a simple Ising model for two target minor embeddings (that is, representations of the model’s graph by coupled qubits on the QPU’s sparsely connected graph), where only the second is valid.

>>> from dwave.cloud import Client
>>> with Client.from_config() as client:  
...     solver = client.get_solver()
...     print(solver.check_problem({0: -1, 1: 1},{(0, 1):0.5}))
...     print(solver.check_problem({30: -1, 31: 1},{(30, 31):0.5}))
...
False
True