amplify.client.FujitsuDA3SolverClient

class FujitsuDA3SolverClient

A client class for using FujitsuDA3Solver.

__init__(self: amplify.client.FujitsuDA3SolverClient, 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 number of available variables in Fujitsu Digital Annealer V3, which is 100000.

parameters

The parameters of FujitsuDA3SolverClient.

proxy

The address of a proxy server.

set_inequalities

When set to True, Inequalities is used to handle a problem with linear inequality constraints.

set_one_way_one_hot_groups

When set to True, one_way_one_hot_groups is set if the model has one-hot constraints.

set_penalty_binary_polynomial

When set to True, PenaltyBinaryPolynomial is used to handle a problem with constraints.

set_two_way_one_hot_groups

When set to True, two_way_one_hot_groups is set if the model has two-way one-hot constraints.

token

Authentication token for Fujitsu Digital Annealer V3.

url

The endpoint url for Fujitsu Digital Annealer V3.

version

Get the API version string of the Fujitsu Digital Annealer.

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 number of available variables in Fujitsu Digital Annealer V3, which is 100000.

property parameters

The parameters of FujitsuDA3SolverClient.

Type:

FujitsuDA3SolverClientParameters

property proxy

The address of a proxy server. The address of proxy server can be set or read from this attribute.

Type:

str

property set_inequalities

When set to True, Inequalities is used to handle a problem with linear inequality constraints. If set to False, constraint terms are converted to a penalty function and added to the input polynomial model or the PenaltyBinaryPolynomial. The default value is set to False.

Type:

bool

property set_one_way_one_hot_groups

When set to True, one_way_one_hot_groups is set if the model has one-hot constraints. The default value is set to False.

Type:

bool

property set_penalty_binary_polynomial

When set to True, PenaltyBinaryPolynomial is used to handle a problem with constraints. If set to False, constraint terms are converted to a penalty function and added to the input polynomial model. The default value is set to False.

Type:

bool

property set_two_way_one_hot_groups

When set to True, two_way_one_hot_groups is set if the model has two-way one-hot constraints. The default value is set to False.

Type:

bool

solve(*args, **kwargs)

Solves a given polynomial or matrix model.

Overloads:

  • solve(poly)
  • solve(matrix, constant)
Parameters:
Returns:

The result class of FujitsuDA3Solver client is returned.

Return type:

FujitsuDA3SolverClientResult

Example

from amplify import BinarySymbolGenerator
from amplify.client import FujitsuDA3SolverClient

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

client = FujitsuDA3SolverClient()
client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client.parameters.time_limit_sec = 1

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

Authentication token for Fujitsu Digital Annealer V3.

Type:

str

property url

The endpoint url for Fujitsu Digital Annealer V3.

Type:

str

property version

Get the API version string of the Fujitsu Digital Annealer.

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