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

solver

Set to one from 'Advantage_system1.1', 'DW_2000Q_6', or 'DW_2000Q_VFYC_6'

token

Authentication token for a D-Wave account.

url

version

solve(*args, **kwargs)

Solves a given model.

Overloads

  1. solve(model)

  2. solve(poly)

  3. solve(matrix, constant)

Parameters
Returns

Client’s result class whose type depends on the input client.

Return type

DWaveSamplerClientResult

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.