amplify.client.FujitsuDA2PTSolverClientParameters

class FujitsuDA2PTSolverClientParameters

A class that handles the parameters of FujitsuDA2PTSolverClient.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

Attributes

guidance_config

Specifies the initial values of variables.

maximum_replica_temperature

Maximum temperature to set for each replica.

number_iterations

Number of searchs in one annealing.

number_replicas

Number of replicas.

offset_increase_rate

Cumulative energy increment when no new state is selected.

solution_mode

Specifies how solutions are returned.

property guidance_config

Specifies the initial values of variables. The initial configuration of the variables are expressed in terms of a dictionary. The key is the index of a variable in the string form, and the corresponding value is the initial value of the variable expressed as True or False.

Type:

dict

Example

from amplify import BinarySymbolGenerator
from amplify.client import FujitsuDA2PTSolverClient

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

client = FujitsuDA2PTSolverClient()
client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client.parameters.number_iterations = 1000000
client.parameters.guidance_config = {"0": True, "2": False}

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

注釈

Modifying each element of guidance_config by direct reference is not supported. If you need to replace one or more elements, the entire dictionary needs to be redefined.

from amplify.client import FujitsuDA2PTSolverClient

client = FujitsuDA2PTSolverClient(token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
client.parameters.guidance_config = {"0": True, "1": True}
>>> client.parameters.guidance_config
{'1': True, '0': True}
>>> client.parameters.guidance_config["0"] = False # Dictionary elements cannot be replaced by direct reference.
>>> client.parameters.guidance_config
{'1': True, '0': True}
>>> client.parameters.guidance_config= {"0": False, "1": False}  # Redefition of the entire dictionary can replace dictionary elements.
>>> client.parameters.guidance_config
{'1': False, '0': False}
property maximum_replica_temperature

Maximum temperature to set for each replica. If not specified, it is automatically adjusted. A number greater than or equal to 0 should be specified. Automatic adjustment is recommended.

Type:

float

property number_iterations

Number of searchs in one annealing. Specified by an integer from 1 to 2,000,000,000.

Type:

int

property number_replicas

Number of replicas. This is the number of annealing performed in parallel at different initialized temperatures. It is specified by an integer from 26 to 128.

Type:

int

property offset_increase_rate

Cumulative energy increment when no new state is selected. If not specified, it is automatically adjusted. It is specified by a value from 0 to 2,000,000,000. Automatic adjustment is recommended.

Type:

float

property solution_mode

Specifies how solutions are returned. Can be set to "COMPLETE" or "QUICK". "COMPLETE" is set as the default if no value is specified.

  • COMPLETE: Returns all results obtained by the number of annealing specified by number_replicas, but combines the same results into one and returns with the total number of occurrence as frequency.

  • QUICK: Returns one result with the lowerst energy.

Type:

str