amplify.client.ocean.DWaveSamplerClient¶
-
class
DWaveSamplerClient
¶ A client class for using DWaveSampler class in D-Wave system as a client.
For more information, see DWaveSampler for details.
-
__init__
(self: amplify.client.ocean.DWaveSamplerClient, token: str = '', solver: str = '', url: str = '', proxy: str = '') → None¶
Methods
__init__
(self, token, solver, url, proxy)solve
(*args, **kwargs)Solves a given model.
Attributes
num_bits
parameters
proxy
Set to one from
'Advantage_system1.1'
,'DW_2000Q_6'
, or'DW_2000Q_VFYC_6'
Authentication token for a D-Wave account.
url
version
-
solve
(*args, **kwargs)¶ Solves a given model.
Overloads
solve(model)
solve(poly)
solve(matrix, constant)
- Parameters
model (
BinaryQuadraticModel
,BinaryIntQuadraticModel
,IsingQuadraticModel
orIsingIntQuadraticModel
) –Input quadratic model.
poly (
BinaryPoly
,BinaryIntPoly
,IsingPoly
orIsingIntPoly
) –Input polynomial. It is internally converted to a Quadratic Model.
matrix (
BinaryMatrix
,BinaryIntMatrix
,IsingMatrix
orIsingIntMatrix
) –Input matrix. It is internally converted to a Quadratic Model.
constant (
int
orfloat
, optional) –A constant value to be added to the above matrix. The type is set in accordance with the coefficients of the matrix.
- Returns
Client’s result class whose type depends on the input client.
- Return type
Example
from amplify import gen_symbols, BinaryPoly from amplify.client.ocean import DWaveSamplerClient # Available physical bits need to be used # Here, the bits labeled by 38 and 39 are used q = gen_symbols(BinaryPoly, 40) f = 2 * q[38] * q[39] - q[38] - q[39] + 1 client = DWaveSamplerClient() client.token = "XXXX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" client.solver = "Advantage_system1.1" client.parameters.num_reads = 100 result = client.solve(f)
>>> f 2.000000 q_38 q_39 - q_38 - q_39 + 1.000000 >>> [f"energy = {s.energy}, q_38 = {s.values[38]}, q_39 = {s.values[39]}" for s in result] ['energy = 0.0, q_38 = 0, q_39 = 1', 'energy = 0.0, q_38 = 1, q_39 = 0']
-
property
solver
¶ Set to one from
'Advantage_system1.1'
,'DW_2000Q_6'
, or'DW_2000Q_VFYC_6'
-
property
token
¶ Authentication token for a D-Wave account.
-