MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / Client

Class Client

dwave/cloud/client/sw.py:29–72  ·  view source on GitHub ↗

D-Wave Solver API client specialized to work only with remote software solvers. This class can be instantiated explicitly, or via (base) Client's factory method, :meth:`~dwave.cloud.client.Client.from_config` by supplying ``"sw"`` for ``client``. Examples: This example

Source from the content-addressed store, hash-verified

27
28
29class Client(BaseClient):
30 """D-Wave Solver API client specialized to work only with remote software
31 solvers.
32
33 This class can be instantiated explicitly, or via (base) Client's factory
34 method, :meth:`~dwave.cloud.client.Client.from_config` by supplying ``"sw"``
35 for ``client``.
36
37 Examples:
38 This example explicitly instantiates a :class:`dwave.cloud.sw.Client`.
39 :meth:`~dwave.cloud.client.Client.get_solver` is guaranteed to return a
40 software solver.
41
42 .. code-block:: python
43
44 from dwave.cloud.sw import Client
45
46 with Client(token='...') as client:
47 solver = client.get_solver()
48 response = solver.sample_ising(...)
49
50 The following example instantiates a software-solver-only client
51 indirectly. Again, :meth:`~dwave.cloud.client.Client.get_solver`/
52 :meth:`~dwave.cloud.client.Client.get_solvers` are guaranteed to return
53 only software solver(s).
54
55 .. code-block:: python
56
57 from dwave.cloud import Client
58
59 with Client.from_config(client='sw') as client:
60 solver = client.get_solver()
61 response = solver.sample_ising(...)
62
63 """
64
65 @staticmethod
66 def is_solver_handled(solver):
67 """Determine if the specified solver should be handled by this client.
68
69 This predicate function (used from the base class) allows only remote
70 software solvers.
71 """
72 return solver and solver.software

Calls

no outgoing calls