amplify.client.FujitsuDA4SolverClientParameters

class FujitsuDA4SolverClientParameters

A class that handles the parameters of FujitsuDA4SolverClient. For more information, see FujitsuDA4Solver Schemas of Digital Annealer API reference (QUBO API V4) .

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

Attributes

fixed_config

Fixes the values of variables.

gs_cutoff

The level of the convergence test of the global searching.

gs_level

The level of global searching.

guidance_config

Specifies the initial values of variables.

internal_penalty

Selects the mode of generating one-hot constraints internally.

max_penalty_coef

The maximum value of the coefficient of constraint terms.

num_group

The number of groups for trials in parallel.

num_output_solution

The number of output solutions of each of the parallel groups.

num_run

The number of trials computed in parallel.

one_hot_cutoff

The level of the convergence test of the one-hot constraint searching.

one_hot_level

The level of the one-hot constraint searching.

penalty_auto_mode

Selects the mode of global searching for adjusting the coefficient of constraint terms.

penalty_coef

The coefficient of constraint terms.

penalty_inc_rate

A parameter for automatic adjustment of the constaint terms in the global search.

target_energy

Targeted energy value.

time_limit_sec

The upper limit of the execution time in the unit of second.

property fixed_config

Fixes the values of variables. How the values of certain variables should be fixed is expressed in terms of a dictionary. The key is the index of a variable in the string form, and the corresponding boolean value is the value of the variable to be fixed to True or False. For example, when the variables labeled with 0 and 1 are to be fixed to True and False, respectively, after setting the client, you can let client.parameters.fixed_config = {"0": True, "1": False}, similarly to guidance_config.

Type:

dict

Note

Modifying each element of fixed_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 FujitsuDA4SolverClient

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

The level of the convergence test of the global searching. The convergence test is turned off when set to 0. It should be set to an integer between 0 and 1000000. The default value is set to 8000.

Type:

int

property gs_level

The level of global searching. It should be set to an integer value between 0 and 100. The default value is set to 5.

Type:

int

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 FujitsuDA4SolverClient

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

client = FujitsuDA4SolverClient()
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 FujitsuDA4SolverClient

FujitsuDA4SolverClient(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 internal_penalty

Selects the mode of generating one-hot constraints internally. It should be set to 0 or 1. The default value is set to 0.

Type:

int

property max_penalty_coef

The maximum value of the coefficient of constraint terms. It should be set to an integer between 0 and 9223372036854775807. If it is not specified, it is set to 0.

Type:

int

property num_group

The number of groups for trials in parallel. It should be set to an integer between 1 and 16. The number of trials in parallel is given by num_run \(\times\) num_group. The default value is 1.

Type:

int

property num_output_solution

The number of output solutions of each of the parallel groups. It should be set to an integer value between 1 and 1024. The default value is set to 5.

Type:

int

property num_run

The number of trials computed in parallel. It should be set to an integer between 1 and 1024. The number of trials in parallel is given by num_run \(\times\) num_group. The default value is 16.

Type:

int

property one_hot_cutoff

The level of the convergence test of the one-hot constraint searching. The convergence test is turned off when set to 0. It should be set to an integer value between 0 and 1000000. The default value is set to 100.

Type:

int

property one_hot_level

The level of the one-hot constraint searching. It should be set to an integer value between 0 and 100. The default value is set to 3.

Type:

int

property penalty_auto_mode

Selects the mode of global searching for adjusting the coefficient of constraint terms. It should be set to an integer between 0 and 10000. The default value is set to 1.

  • \(0\): The coefficient is set by the value in penalty_coef.

  • \(1 ~ 10000\): The coefficient is automatically adjusted by taking the value in penalty_coef as the initial value.

Type:

int

property penalty_coef

The coefficient of constraint terms. It should be set to an integer between 1 to 9223372036854775807. The default value is set to 1.

Type:

int

property penalty_inc_rate

A parameter for automatic adjustment of the constaint terms in the global search. It should be set to an integer between 100 and 200. The default value is set to 150.

Type:

int

property target_energy

Targeted energy value. The range of the value is between \(-2^{126}\) and \(2^{126}\). When the minimum value of energy reaches the specified target_energy value, the calculation is stopped. It is unspecified by default.

Type:

float

property time_limit_sec

The upper limit of the execution time in the unit of second. It should be set to an integer value between 1 and 3600. If it is not specified, the default value is 10.

Type:

int