dwave.cloud.client.Client.get_solver¶
- Client.get_solver(name=None, refresh=False, **filters)[source]¶
Load the configuration for a single solver.
Makes a blocking web call to {endpoint}/solvers/remote/{solver_name}/, where {endpoint} is a URL configured for the client, and returns a
Solver
instance that can be used to submit sampling problems to the D-Wave API and retrieve results.- Parameters
name (str) – ID of the requested solver.
None
returns the default solver. If default solver is not configured,None
returns the first available solver inClient
’s class (QPU/software/base).**filters (keyword arguments, optional) – Dictionary of filters over features this solver has to have. For a list of feature names and values, see:
get_solvers()
.order_by (callable/str/None, default='avg_load') – Solver sorting key function (or
Solver
attribute/item dot-separated path). By default, solvers are sorted by average load. For details, seeget_solvers()
.refresh (bool) – Return solver from cache (if cached with
get_solvers()
), unless set toTrue
.
- Returns
Solver
Examples
This example creates two solvers for a client instantiated from a local system’s auto-detected default configuration file, which configures a connection to a D-Wave resource that provides two solvers. The first uses the default solver, the second explicitly selects another solver.
>>> from dwave.cloud import Client >>> client = Client.from_config() >>> client.get_solvers() [Solver(id='2000Q_ONLINE_SOLVER1'), Solver(id='2000Q_ONLINE_SOLVER2')] >>> solver1 = client.get_solver() >>> solver2 = client.get_solver(name='2000Q_ONLINE_SOLVER2') >>> solver1.id '2000Q_ONLINE_SOLVER1' >>> solver2.id '2000Q_ONLINE_SOLVER2' >>> # code that uses client >>> client.close()