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,fixedconstraints are detected from the modelās constraints as many as possible and are passed to thefixedparameter which is a flip option. (Default:True)If set as
True,onehotconstraints are detected from the modelās constraints as many as possible and are passed to theonehotparameter which is a flip option. (Default:True)If set as
True,andzeroconstraints are detected from the modelās constraints as many as possible and are passed to theandzeroparameter which is a flip option. (Default:True)If set as
True,oroneconstraints are detected from the modelās constraints as many as possible and are passed to theoroneparameter which is a flip option. (Default:True)If set as
True,supplementconstraints are detected from the modelās constraints as many as possible and are passed to thesupplementparameter which is a flip option. (Default:True)If set as
True,maxoneconstraints are detected from the modelās constraints as many as possible and are passed to themaxoneparameter which is a flip option. (Default:True)If set as
True,minmaxoneconstraints are detected from the modelās constraints as many as possible and are passed to theminmaxoneparameter 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\)
\(m \leq q_1 + q_2 + \cdots + q_N + k \leq n \quad (0 \leq m - k, n - k \leq N)\)
\(q_1 + q_2 + \cdots + q_N + k = n \quad (0 \leq n - k \leq N)\)
\(q_1 + q_2 + \cdots + q_N + k \leq n \quad (0 \leq n - k \leq N)\)
\(q_1 + q_2 + \cdots + q_N + k \geq n \quad (0 \leq n - k \leq N)\)\(q_1 + q_2 + \cdots + q_N + k \leq n \quad (0 \leq n - k \leq N)\)
The flip options for each constraint expression are detected in the same order of precedence as shown in the table above. If a constraint matches multiple flip options, the flip option with the highest priority among those set to
Trueis selected.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
NECVA2Clientindependently 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.timingattribute of the result class.Attribute
Details
VA sampling time for each read.
Execution time of the
solve_quboPython 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 })