amplify.client.HitachiClient

class HitachiClient

A class for using Hitachi CMOS client.

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

Methods

__init__(self[, token, url, proxy])

solve(*args, **kwargs)

Solves a given polynomial or matrix model.

Attributes

num_bits

The maximum number of available variables.

parameters

The parameters of the Hitachi CMOS client.

proxy

Set or get the address of proxy server.

token

Set or get the API token.

url

Set or get the API URL for Hitachi CMOS client.

version

Get the API version string of the Hitachi CMOS annealing machine.

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

The parameters of the Hitachi CMOS client.

Type:

HitachiClientParameters

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)
Parameters:
Returns:

A result class that provides information about execution.

Return type:

HitachiClientResult

Example

from amplify import BinaryPoly, gen_symbols, Solver
from amplify.client import HitachiClient

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

client = HitachiClient()
client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client.parameters.temperature_num_steps = 10
client.parameters.temperature_step_length = 100
client.parameters.temperature_initial = 100.0
client.parameters.temperature_target = 0.02

result = client.solve(f)
>>> f
- 2 q_0 q_513 - q_0 - q_513 + 1
>>> [f"energy = {s.energy}, q[0][0] = {s.values[0]}, q[1][1] = {s.values[513]}" for s in result]
['energy = -3.0, q[0][0] = 1, q[1][1] = 1']
property token

Set or get the API token.

Type:

str

property url

Set or get the API URL for Hitachi CMOS client. Set to https://annealing-cloud.com/api/v2/ by default.

Type:

str

property version

Get the API version string of the Hitachi CMOS annealing machine.

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