Fujitsu
The Fujitsu Digital Annealer provides an alternative to quantum computing technology
Solver
Model | Solvers |
---|---|
Quadratic Unconstrained Binary Optimization (QUBO) | fujitsu.DA3 |
QUBO
import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import (
FujitsuParameterModel
)
from dimod import BinaryQuadraticModel
sw.authenticate(api_key)
linear = {1: -2, 2: -2, 3: -3, 4: -3, 5: -2}
quadratic = {(1, 2): 2, (1, 3): 2, (2, 4): 2, (3, 4): 2, (3, 5): 2, (4, 5): 2}
model = BinaryQuadraticModel(linear, quadratic, "BINARY")
options = FujitsuParameterModel(
time_limit_sec=1, penalty_coef=10000
)
solver = "fujitsu.DA3"
so = StrangeworksOptimizer(model=model, solver=solver, options=options)
sw_job = so.run()
print(f"Job slug: {sw_job.slug}")
print(f"Job status: {so.status(sw_job.slug)}")
results = so.results(sw_job.slug)
Native Dictionary
For more information see: https://portal.aispf.global.fujitsu.com/apidoc/da/jp/api-ref/da-qubo-v3c-en.html.
import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import (
FujitsuParameterModel
)
from strangeworks_optimization_models.problem_models import FujitsuModelList
sw.authenticate(api_key)
model = FujitsuModelList(
binary_polynomial={
"terms": [
{"coefficient": 2, "polynomials": [1, 2]},
{"coefficient": -4, "polynomials": [2, 4]},
{"coefficient": -3, "polynomials": []},
]
}
)
options = FujitsuParameterModel(
time_limit_sec=1, penalty_coef=10000
)
solver = "fujitsu.DA3"
so = StrangeworksOptimizer(model=model,
solver=solver,
options=options)
sw_job = so.run()
print(f"Job slug: {sw_job.slug}")
print(f"Job status: {so.status(sw_job.slug)}")
results = so.results(sw_job.slug)
Conversion
For larger models it is advisable to first convert a BinaryQuadraticModel to a FujitsuModelList before submitting to the solver since it can be more efficient
import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.problem_models import FujitsuModelList
from strangeworks_optimization_models.converter_models import StrangeworksConverterFactory
sw.authenticate(api_key)
linear = {1: -2, 2: -2, 3: -3, 4: -3, 5: -2}
quadratic = {(1, 2): 2, (1, 3): 2, (2, 4): 2, (3, 4): 2, (3, 5): 2, (4, 5): 2}
model = BinaryQuadraticModel(linear, quadratic, "BINARY", offset=1.4)
strangeworks_converter = StrangeworksConverterFactory.from_model(model, FujitsuModelList)
fujitsu_model = strangeworks_converter.convert()
optimizer = StrangeworksOptimizer(model=fujitsu_model, solver="fujitsu.DA3")
optimizer.run()
Parameters
from strangeworks_optimization_models.parameter_models import FujitsuParameterModel
options = FujitsuParameterModel(
.....
)
Parameter | Description | Type | Default | Range |
---|---|---|---|---|
time_limit_sec | Maximum running time of DA in seconds | int | 10 | 1 to 3600 |
target_energy | Threshold energy for fast exit | float | disabled | - |
num_run | The number of parallel attempts of each group | int | 1 | 1 to 16 |
num_output_solution | The number of output solutions of each group | int | 5 | 1 to 1024 |
gs_level | Level of the global search | int | 5 | 0 to 100 |
gs_cutoff | Global search cutoff level | int | 8000 | 0 to 1000000 |
one_hot_level | Level of the 1hot constraint search | int | 3 | 0 to 100 |
one_hot_cutoff | Level of the convergence for 1hot constraint search | int | 100 | 0 to 1000000 |
internal_penalty | Mode of 1hot constraint internal generation | int | 0 | 0 or 1 |
penalty_auto_mode | Coefficient adjustment mode | int | 1 | 0 to 10000 |
penalty_coef | Coefficient of the constraint term | int | 1 | 1 to 9223372036854775807 |
penalty_inc_rate | Parameters for automatic adjustment of constraint terms | int | 150 | 100 to 200 |
max_penalty_coef | Maximum constraint term coefficient | int | 0 | 0 to 9223372036854775807 |
guidance_config | Initial value of each variable | dict | - | - |
fixed_config | Fixed value of each variable | dict | - | - |
one_way_one_hot_groups | Number of variables in each group of one-way one-hot constraints | dict | - | - |
two_way_one_hot_groups | Number of variables in each group of two-way one-hot constraints | dict | - | - |
Solvers
- fujitsu.DA3