amplify.client.NECClient

class NECClient

A class for using Fixstars Amplify Annealing Engine client.

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

Methods

__init__(self[, token, 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 NECClient.

proxy

Set or get the address of proxy server.

set_andzero

Specifies whether to set the andzero constraint parameter of VA.

set_maxone

Specifies whether to set the maxone constraint parameter of VA.

set_minmaxone

Specifies whether to set the minmaxone constraint parameter of VA.

set_onehot

Specifies whether to set the onehot constraint parameter of VA.

set_orone

Specifies whether to set the orone constraint parameter of VA.

token

Set or get the API token.

url

version

Get the version string of NEC Vector Annealing Service.

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 NECClient.

Type

NECClientParameters

property proxy

Set or get the address of proxy server.

Type

str

property set_andzero

Specifies whether to set the andzero constraint parameter of VA.

Type

list

property set_maxone

Specifies whether to set the maxone constraint parameter of VA.

Type

list

property set_minmaxone

Specifies whether to set the minmaxone constraint parameter of VA.

Type

list

property set_onehot

Specifies whether to set the onehot constraint parameter of VA.

Type

list

property set_orone

Specifies whether to set the orone constraint parameter of VA.

Type

list

solve(*args, **kwargs)

Solves a given polynomial or matrix model.

Overloads:

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

A result class that provides information about execution.

戻り値の型

NECClientResult

Example

from amplify import BinarySymbolGenerator
from amplify.client import NECClient

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

client = NECClient()
client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

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 token

Set or get the API token.

Type

str

property version

Get the version string of NEC Vector Annealing Service.

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