NECĀ¶
NEC Vector Annealing (VA) Service 2.0Ā¶
NEC provides the QUBO solver, which runs on the vector supercomputer SX-Aurora TSUBASA.
The Amplify SDK provides NECVA2Client
which calls the NEC Vector Annealing Service 2.0 API with automatically detected and configured request parameters.
- Solver specification:
Client class
API method3
SAC Service Client (Python)
API reference
1: Corresponding to API reference ā3-3-2 solve_paramsā
2: Corresponding to API reference ā3-4. Responseā
3: No need for additional installationBinary variable
Ising variable
Integer variable
Real variable
Objective function
2nd
-
-
-
Equality constraint
*
-
-
-
Inequality constraint
*
-
-
-
*: Several 1st and 2nd order constraints described later are supported.
- Client class:
In addition to the common interface of the client class, it has the following attributes.
Attribute
Data type
Details
If set as
True
,fixed
constraints are detected from the modelās constraints as many as possible and are passed to thefixed
parameter which is a flip option. (Default:True
)If set as
True
,onehot
constraints are detected from the modelās constraints as many as possible and are passed to theonehot
parameter which is a flip option. (Default:True
)If set as
True
,andzero
constraints are detected from the modelās constraints as many as possible and are passed to theandzero
parameter which is a flip option. (Default:True
)If set as
True
,orone
constraints are detected from the modelās constraints as many as possible and are passed to theorone
parameter which is a flip option. (Default:True
)If set as
True
,supplement
constraints are detected from the modelās constraints as many as possible and are passed to thesupplement
parameter which is a flip option. (Default:True
)If set as
True
,maxone
constraints are detected from the modelās constraints as many as possible and are passed to themaxone
parameter which is a flip option. (Default:True
)If set as
True
,minmaxone
constraints are detected from the modelās constraints as many as possible and are passed to theminmaxone
parameter which is a flip option. (Default:True
)Flip option constraints are detected only when a constraint expression is set that matches the following form, including coefficients. \(q_1, q_2, \dots , q_N\) (\(N\) is a natural number) are binary variables independent of each other and \(m, n, k\) are integer constants.
Attribute for the flip option
Form of the constraint to be detected
\(q_1 + k = k\)
\(q_1 + k = k + 1\)\(q_1 + q_2 + \cdots + q_N + k = k + 1\)
\(q_1 + q_2 + \cdots + q_N + k \leq k + N - 1\)
\(n q_1 q_2 + k = k\)\(q_1 + q_2 + \cdots + q_N + k \geq k + 1\)
\(n (q_1 - 1)(q_2 - 1) + k = k\)\(n (q_1 - q_2 q_3) + k = k\)
\(q_1 + q_2 + \cdots + q_N + k \leq n \quad (0 \leq n - k \leq N)\)
\(m \leq q_1 + q_2 + \cdots + q_N + k \leq n \quad (0 \leq m - k, n - k \leq N)\)
Note
Regardless of whether the flip option is enabled, penalty functions of constraints are added to the objective function as needed.
- Execution time:
The NEC VA Service 2.0 returns the execution time for each sampling of VA but does not return the total processing time taken to find the solution. Therefore, in addition to the sampling time, the
NECVA2Client
independently measures and returns the response time of thesolve_qubo()
API of the SAC Service Client, the execution time of the the VA (which is also included in the response time), and the queue time. These timing attributes are stored in the~amplify.NECVA2Client.Result.timing
attribute of the result class.Attribute
Details
VA sampling time for each read.
Execution time of the
solve_qubo
Python APIExecution time of the VA (including network overhead and queue time)
Queue time
- Configuration example:
from amplify import NECVA2Client client = NECVA2Client() # Set API token client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Run in speed mode client.parameters.vector_mode = "speed"
- Execution example:
from amplify import VariableGenerator, Model, solve # Define 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 the solver result = solve(model, client) # Print API execution time print(result.execution_time)
Obtain the solver version:
>>> client.version '2.0.2'
Obtain detailed execution time:
>>> result.client_result.result[0].time datetime.timedelta(microseconds=4257) >>> result.client_result.timing NECVA2Client.Result.Timing({ "execution_time": 3.8289530351758003, "solve_qubo_time": 24.603095658123493, "queue_time": 0.0007024258375167847 })