--- sd_hide_title: true --- # Fujitsu (clients-FujitsuDA4Client)= ## Fujitsu DA4 Solver [Fujitsu DA4](https://www.fujitsu.com/global/services/business-services/digital-annealer/) is Fujitsu's QUBO solver with the 4th-generation Digital Annealing Unit (DAU (GPU)). :**Solver specification**: ```{list-table} :width: 100% :widths: 2 3 * - Client class - {py:class}`amplify.FujitsuDA4Client` * - [Execution parameters](amplify.FujitsuDA4Client.parameters) - {py:class}`amplify.FujitsuDA4Client.Parameters` * - [Execution result](amplify.Result.client_result) - {py:class}`amplify.FujitsuDA4Client.Result` * - [Execution time](amplify.Result.execution_time) - {py:attr}`amplify.FujitsuDA4Client.SolverTiming.solve_time` * - API method - REST API (JSON) * - API reference - [{bdg-info}`📖 API Reference`](https://portal.aispf.global.fujitsu.com/apidoc/da/jp/api-ref/da-qubo-v4-en.html) ``` ```{csv-table} :header-rows: 1 :stub-columns: 1 :width: 100% :widths: 1 1 1 1 1 ,Binary variable,Ising variable,Integer variable,Real variable Objective function,2nd,\-,\-,\- Equality constraint,\*\/\**,\-,\-,\- Inequality constraint,1st,\-,\-,\- ``` \*: One-way-one-hot and two-way-one-hot constraints are supported. \**: Can be specified as penalty functions. :**Client class**: In addition to [the common interface](#client-common-interface), the client class has the following attributes and methods. ```{list-table} :width: 100% :header-rows: 1 :widths: 1 1 3 * - Attribute - Data type - Details * - {py:attr}`~amplify.FujitsuDA4Client.type_id` - {py:class}`str` | {py:obj}`None` - Specify the type ID when using the [Premium API](https://portal.aispf.global.fujitsu.com/apidoc/da/jp/api-ref/da-qubo-v3c-v4-premium-en.html). * - {py:attr}`~amplify.FujitsuDA4Client.set_penalty_binary_polynomial` - {py:class}`bool` - Pass the penalty function weight setting for the constraint to the `penalty_binary_polynomial` parameter if set to {py:obj}`True` (default: {py:obj}`True`). If set to {py:obj}`False`, the penalty function is added to the objective function. * - {py:attr}`~amplify.FujitsuDA4Client.set_inequalities` - {py:class}`bool` - Pass a first-order inequality constraint to the `inequalities` parameter (default: {py:obj}`True`) if set to {py:obj}`True`. If set to {py:obj}`False`, a penalty function for the inequality constraint is generated and processed according to {py:attr}`~amplify.FujitsuDA4Client.set_penalty_binary_polynomial`. * - {py:attr}`~amplify.FujitsuDA4Client.set_one_way_one_hot_groups` - {py:class}`bool` - If set to {py:obj}`True`, detect one-hot constraints from the beginning of the decision variables as much as possible and pass them to the `one_way_one_hot_groups` parameter (default: {py:obj}`False`). If set to {py:obj}`False`, or if the one-hot constraints cannot be passed to the parameter, penalty functions are generated and processed according to {py:attr}`~amplify.FujitsuDA4Client.set_penalty_binary_polynomial`. * - {py:attr}`~amplify.FujitsuDA4Client.set_two_way_one_hot_groups` - {py:class}`bool` - If set to {py:obj}`True`, detect equally spaced `one_way_one_hot_groups`, and if additional one-hot constraints can be added that satisfy the `two_way_one_hot_groups` condition, they are detected and passed to the `two_way_one_hot_groups` parameter (default: {py:obj}`False`). If set to {py:obj}`False`, or if no one-hot constraints can be passed to the parameter, penalty functions are generated and processed according to {py:attr}`~amplify.FujitsuDA4Client.set_penalty_binary_polynomial`. If set to {py:obj}`True` at the same time as {py:attr}`~amplify.FujitsuDA4Client.set_one_way_one_hot_groups`, `two_way_one_hot_groups` detection is prioritized. ``` ```{list-table} :width: 100% :header-rows: 1 :widths: 1 1 3 * - Method - Return type - Details * - {py:meth}`~amplify.FujitsuDA4Client.health_check` - {py:class}`~amplify.FujitsuDA4Client.CommonError` | {py:obj}`None` - Query the health check API and check if the solver is working properly. Returns {py:obj}`None` if normal. * - {py:meth}`~amplify.FujitsuDA4Client.async_solve` - {py:class}`str` - Execute the `/async/qubo/solve` API asynchronously and return the job ID. * - {py:meth}`~amplify.FujitsuDA4Client.get_jobs` - {py:class}`list`[{py:class}`~amplify.FujitsuDA4Client.JobStatusInfo`] - Obtain a list of job statuses. * - {py:meth}`~amplify.FujitsuDA4Client.cancel_job` - {py:class}`~amplify.FujitsuDA4Client.JobStatus` - Attempt to abort a job by specifying its job ID * - {py:meth}`~amplify.FujitsuDA4Client.get_job_result` - {py:class}`~amplify.FujitsuDA4Client.Result` - Obtain the completed result by specifying the job ID. * - {py:meth}`~amplify.FujitsuDA4Client.delete_job_result` - {py:class}`~amplify.FujitsuDA4Client.Result` - Obtain a completed result and delete the result by specifying the job ID. ``` ```{note} {py:meth}`~amplify.FujitsuDA4Client.solve` in the common interface of the client class is a synchronous version of {py:meth}`~amplify.FujitsuDA4Client.async_solve`. It waits until the job has completed execution and returns the result of the execution. ``` :**Configuration example**: ```{testcode} from amplify import FujitsuDA4Client from datetime import timedelta client = FujitsuDA4Client() # Set API token client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Enable detection of one-way one-hot groups client.set_one_way_one_hot_groups = True # Set the execution time to 100 seconds client.parameters.time_limit_sec = timedelta(seconds=100) ``` :**Execution example**: ```python from amplify import Model, VariableGenerator, solve # Create decision variables and the objective function g = VariableGenerator() q = g.array("Binary", 2) f = q[0] * q[1] + q[0] - q[1] + 1 # Create a model model = Model(f) # Run a solver result = solve(model, client) ``` Perform health check API: ```python >>> client.health_check() ``` Obtain a list of jobs: ```python >>> client.get_jobs() [FujitsuDA4ClientJobStatusInfo({"job_id":"...","job_status":"Done","start_time":"..."}), FujitsuDA4ClientJobStatusInfo({"job_id":"...","job_status":"Done","start_time":"..."}) ...] ``` Obtain and delete job result: ```python >>> client.delete_job_result("...") {"qubo_solution":{"progress":[{"energy":417.0,"penalty_energy":366429644.0,"time":1.179},... ``` Obtain the solver version: ```python >>> client.version 'v4' ``` Obtain detailed execution time: ```python >>> result.client_result.qubo_solution.timing FujitsuDA4Client.SolverTiming({ "solve_time": 101963.0, "total_elapsed_time": 101963.0 }) ``` (clients-FujitsuDA3cClient)= ## Fujitsu DA3c Solver [Fujitsu DA3c](https://www.fujitsu.com/global/services/business-services/digital-annealer/) is Fujitsu's QUBO solver with the 3rd-generation Digital Annealing Unit (DAU (GPU)). ```{note} The client class specification is the same as {py:class}`amplify.FujitsuDA4Client`. ``` :**Solver specification**: ```{list-table} :width: 100% :widths: 2 3 * - Client class - {py:class}`amplify.FujitsuDA3cClient` * - [Execution parameters](amplify.FujitsuDA3cClient.parameters) - {py:class}`amplify.FujitsuDA3cClient.Parameters` * - [Execution result](amplify.Result.client_result) - {py:class}`amplify.FujitsuDA3cClient.Result` * - [Execution time](amplify.Result.execution_time) - {py:attr}`amplify.FujitsuDA3cClient.SolverTiming.solve_time` * - API method - REST API (JSON) * - API reference - [{bdg-info}`📖 API Reference`](https://portal.aispf.global.fujitsu.com/apidoc/da/jp/api-ref/da-qubo-v3c-ja.html) ``` ```{csv-table} :header-rows: 1 :stub-columns: 1 :width: 100% :widths: 1 1 1 1 1 ,Binary variable,Ising variable,Integer variable,Real variable Objective function,2nd,\-,\-,\- Equality constraint,\*\/\**,\-,\-,\- Inequality constraint,1st,\-,\-,\- ``` \*: One-way-one-hot and two-way-one-hot constraints are supported. \**: Can be specified as penalty functions.