amplify.client.FujitsuDA4SolverClient
- class FujitsuDA4SolverClient
A client class for using FujitsuDA4Solver.
- __init__(self: amplify.client.FujitsuDA4SolverClient, token: str = '', url: str = '', proxy: str = '') None
Methods
__init__
(self[, token, url, proxy])solve
(*args, **kwargs)Solves a given polynomial or matrix model.
Attributes
The number of available variables in Fujitsu Digital Annealer V4, which is 100000.
The parameters of
FujitsuDA4SolverClient
.The address of a proxy server.
When set to
True
,Inequalities
is used to handle linear inequality constraints.When set to
True
,one_way_one_hot_groups
is set if the model has one-hot constraints.When set to
True
,PenaltyBinaryPolynomial
is used to handle constraints.When set to
True
,two_way_one_hot_groups
is set if the model has two-way one-hot constraints.Authentication token for Fujitsu Digital Annealer V4.
The endpoint url for Fujitsu Digital Annealer V4.
Get the API version string of the Fujitsu Digital Annealer.
Set or get the file path to save request data.
Set or get the file path to save request data.
- property num_bits
The number of available variables in Fujitsu Digital Annealer V4, which is 100000.
- property parameters
The parameters of
FujitsuDA4SolverClient
.
- property proxy
The address of a proxy server. The address of proxy server can be set or read from this attribute.
- Type:
- property set_inequalities
When set to
True
,Inequalities
is used to handle linear inequality constraints. If set toFalse
, constraint terms are converted to penalty functions and added to the input polynomial model or thePenaltyBinaryPolynomial
. The default value is set toFalse
.- Type:
- 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 toFalse
.- Type:
- property set_penalty_binary_polynomial
When set to
True
,PenaltyBinaryPolynomial
is used to handle constraints. If set toFalse
, constraint terms are converted to penalty functions and added to the input polynomial model. The default value is set toFalse
.- Type:
- 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 toFalse
.- Type:
- solve(*args, **kwargs)
Solves a given polynomial or matrix model.
Overloads:
- solve(poly)
- solve(matrix, constant)
- Parameters:
poly (
BinaryPoly
,BinaryIntPoly
,IsingPoly
orIsingIntPoly
) –Input polynomial model
matrix (
BinaryMatrix
,BinaryIntMatrix
,IsingMatrix
orIsingIntMatrix
) –Input matrix model
constant (
int
orfloat
, optional) –A constant value to be added to the above matrix. The type is set in accordance with the coefficients of the matrix.
- Returns:
The result class of FujitsuDA4Solver client is returned.
- Return type:
Example
from amplify import BinarySymbolGenerator from amplify.client import FujitsuDA4SolverClient gen = BinarySymbolGenerator() q = gen.array(4) f = 2 * q[0] * q[1] - q[2] * q[3] + 1 client = FujitsuDA4SolverClient() 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 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: