amplify.client.ABSClient

class ABSClient

A class for using ABS client.

__init__(self: amplify.client.ABSClient, url: str = '', user_name: str = '', password: str = '', proxy: str = '') None

Methods

__init__(self[, url, user_name, password, proxy])

solve(*args, **kwargs)

Solves a given polynomial or matrix model.

Attributes

num_bits

The maximum number of available variables.

parameters

Obtains the parameter class of ABSClient.

password

Set or get the password.

proxy

Set or get the address of proxy server.

url

Set or get the API URL for ABS client.

user_name

Set or get the user name.

version

Get the version string of the ABS QUBO solver client.

write_request_data

Set or get the file path to save request data.

write_response_data

Set or get the file path to save request data.

property num_bits

The maximum number of available variables.

Type

int

property parameters

Obtains the parameter class of ABSClient.

Type

ABSClientParameters

property password

Set or get the password.

Type

str

property proxy

Set or get the address of proxy server.

Type

str

solve(*args, **kwargs)

Solves a given polynomial or matrix model.

Overloads:

  • solve(poly)
  • solve(matrix, constant)
パラメータ
戻り値

A result class that provides information about execution.

戻り値の型

ABSClientResult

Example

from amplify import BinarySymbolGenerator
from amplify.client import ABSClient

gen = BinarySymbolGenerator()
q = gen.array(3)
f = 2 * q[0] * q[1] - q[0] - q[2] + 1  # BinaryPoly type input model

client = ABSClient()
client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client.parameters.timeout = 1  # timeout 1 second

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 url

Set or get the API URL for ABS client. Set to https://qubosolver.cs.hiroshima-u.ac.jp by default.

Type

str

property user_name

Set or get the user name.

Type

str

property version

Get the version string of the ABS QUBO solver client.

Type

str

property write_request_data

Set or get the file path to save request data. The default value is an empty string, so saving is disabled.

Type

str

property write_response_data

Set or get the file path to save request data. The default value is an empty string, so saving is disabled.

Type

str