amplify.client.FujitsuDA2SolverExpertClientParameters

class FujitsuDA2SolverExpertClientParameters

A class that handles the parameters of FujitsuDA2SolverExpertClient.

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(*args, **kwargs)

Initialize self.

Attributes

expert_mode

Boolean value for whether to set the expert mode.

guidance_config

Specifies the initial values of variables.

number_iterations

Number of searchs in one annealing.

number_runs

Number of repeats of annealing.

offset_increase_rate

Cumulative energy increment when no new state is selected.

solution_mode

Specifies how solutions are returned.

temperature_decay

Annealing temperature decay rate.

temperature_interval

Interval of temperature change during annealing.

temperature_mode

Model of annealing temperature change.

temperature_start

Start temperature of annealing.

property expert_mode

Boolean value for whether to set the expert mode. Specify True or False to enable or disable Scaling and Rounding and the ability to manually set various parameters (Parameter Setting). Set to False as the default.

  • True: Scaling and Rounding are disabled, and Parameter Setting is enabled.

  • False: Scaling and Rounding are enabled, and Parameter Setting is disabled.

Type

bool

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 FujitsuDA2SolverExpertClient

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

client = FujitsuDA2SolverExpertClient()
client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client.parameters.time_limit_sec = 1
client.parameters.guidance_config = {"0": True, "4": 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.]']

Note

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 FujitsuDA2SolverExpertClient

client = FujitsuDA2SolverExpertClient(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 number_iterations

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

Type

int

property number_runs

Number of repeats of annealing. An integer from 16 to 128 be specified.

Type

int

property offset_increase_rate

Cumulative energy increment when no new state is selected. A value between 0 and 2,000,000,000 should be specified. Enabled only when expert_mode is set to True.

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_runs, 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

property temperature_decay

Annealing temperature decay rate. Enabled only when expert_mode is set to True.

Type

float

property temperature_interval

Interval of temperature change during annealing. An integer greater than or equal to 1 should be specified. Enabled only when expert_mode is set to True.

Type

int

property temperature_mode

Model of annealing temperature change. Specified from "EXPONENTIAL", "INVERSE", or "INVERSE_ROOT". If not specified, "EXPONENTIAL" is set as the default. Enabled only when expert_mode is set to True.

Type

str

property temperature_start

Start temperature of annealing. A value greater than or equal to 0 should be specified. Enabled only when expert_mode is set to True.

Type

float