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 selects a hybrid CQM solver.
>>> from dwave.cloud import Client >>> client = Client.from_config() >>> client.get_solvers() BQMSolver(id='hybrid_binary_quadratic_model_version2p'), DQMSolver(id='hybrid_discrete_quadratic_model_version1p'), CQMSolver(id='hybrid_constrained_quadratic_model_version1p'), StructuredSolver(id='Advantage_system6.1')] >>> solver1 = client.get_solver() >>> solver2 = client.get_solver(supported_problem_types__issubset={'cqm'}) >>> solver1.name 'Advantage_system6.1' >>> solver2.name 'hybrid_constrained_quadratic_model_version1p' >>> # code that uses client >>> client.close()