amplify.client.ocean.LeapHybridSamplerClient

class LeapHybridSamplerClient

ベースクラス: pybind11_builtins.pybind11_object

A class for using D-Wave Leap Hybrid Solver client.

__init__(self: amplify.client.ocean.LeapHybridSamplerClient, token: str = '', solver: str = '', url: str = '', proxy: str = '')None

Methods

__init__(self, token, solver, url, proxy)

solve(*args, **kwargs)

Overloaded function.

Attributes

num_bits

Maximux number of problem variables accepted by Leap Hybrid Solver client.

parameters

Parameters of Leap Hybrid Solver client.

proxy

Sets or gets the address of proxy server.

solver

Set or get the name of solver to be used.

solver_names

Provides a list of the available solver names.

token

Authentication token for a D-Wave account.

url

The end point url for D-Wave Sampler.

version

Version of D-Wave Leap Hybrid Solver client of Amplify SDK.

property num_bits

Maximux number of problem variables accepted by Leap Hybrid Solver client. For more information, see maximum_number_of_variables.

Type

int

property parameters

Parameters of Leap Hybrid Solver client. See LeapHybridSamplerClientLeapHybridSolverParameters for all available parameters.

Type

LeapHybridSamplerClientLeapHybridSolverParameters

property proxy

Sets or gets the address of proxy server.

Type

str

solve(*args, **kwargs)

Overloaded function.

  1. solve(self: amplify.client.ocean.LeapHybridSamplerClient, arg0: amplify.BinaryPoly) -> qubo::client::ClientResult<qubo::client::LeapHybridSamplerClient, decltype(nullptr)>

  2. solve(self: amplify.client.ocean.LeapHybridSamplerClient, arg0: amplify.BinaryIntPoly) -> qubo::client::ClientResult<qubo::client::LeapHybridSamplerClient, decltype(nullptr)>

  3. solve(self: amplify.client.ocean.LeapHybridSamplerClient, arg0: amplify.IsingPoly) -> qubo::client::ClientResult<qubo::client::LeapHybridSamplerClient, decltype(nullptr)>

  4. solve(self: amplify.client.ocean.LeapHybridSamplerClient, arg0: amplify.IsingIntPoly) -> qubo::client::ClientResult<qubo::client::LeapHybridSamplerClient, decltype(nullptr)>

  5. solve(self: amplify.client.ocean.LeapHybridSamplerClient, matrix: amplify.BinaryMatrix, constant: float = 0.0) -> qubo::client::ClientResult<qubo::client::LeapHybridSamplerClient, decltype(nullptr)>

  6. solve(self: amplify.client.ocean.LeapHybridSamplerClient, matrix: amplify.BinaryIntMatrix, constant: int = 0) -> qubo::client::ClientResult<qubo::client::LeapHybridSamplerClient, decltype(nullptr)>

  7. solve(self: amplify.client.ocean.LeapHybridSamplerClient, matrix: amplify.IsingMatrix, constant: float = 0.0) -> qubo::client::ClientResult<qubo::client::LeapHybridSamplerClient, decltype(nullptr)>

  8. solve(self: amplify.client.ocean.LeapHybridSamplerClient, matrix: amplify.IsingIntMatrix, constant: int = 0) -> qubo::client::ClientResult<qubo::client::LeapHybridSamplerClient, decltype(nullptr)>

Solves a given polynomial or matrix model.

Overloads

  1. solve(polynomial)

  2. solve(matrix, constant)

パラメータ
戻り値

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

戻り値の型

LeapHybridSamplerClientResult

Example

from amplify import BinarySymbolGenerator
from amplify.client.ocean import LeapHybridSamplerClient

client = LeapHybridSamplerClient()
client.token = "XXXX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client.solver = "hybrid_binary_quadratic_model_version2"
client.parameters.time_limit = 3  # time limit is 3 seconds

gen = BinarySymbolGenerator()
q = gen.array(3)
f = 2 * q[0] * q[1] - q[0] - q[2] + 1

result = client.solve(f)
>>> f
2 q_0 q_1 - q_0 - q_2 + 1
>>> [f"energy = {s.energy}, q = {q.decode(s.values)}" for s in result]
['energy = -1.0, q = [1. 0. 1.]']
property solver

Set or get the name of solver to be used. It should be set to "hybrid_binary_quadratic_model_version2" to use Leap Hybrid Solver client.

property solver_names

Provides a list of the available solver names.

Type

list

property token

Authentication token for a D-Wave account.

Type

str

property url

The end point url for D-Wave Sampler.

Type

str

property version

Version of D-Wave Leap Hybrid Solver client of Amplify SDK.

Type

str