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:

1: Corresponding to API reference ā€œ3-3-2 solve_paramsā€
2: Corresponding to API reference ā€œ3-4. Responseā€
3: No need for additional installation

Binary 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

set_fixed

bool

If set as True, fixed constraints are detected from the modelā€™s constraints as many as possible and are passed to the fixed parameter which is a flip option. (Default: True)

set_onehot

bool

If set as True, onehot constraints are detected from the modelā€™s constraints as many as possible and are passed to the onehot parameter which is a flip option. (Default: True)

set_andzero

bool

If set as True, andzero constraints are detected from the modelā€™s constraints as many as possible and are passed to the andzero parameter which is a flip option. (Default: True)

set_orone

bool

If set as True, orone constraints are detected from the modelā€™s constraints as many as possible and are passed to the orone parameter which is a flip option. (Default: True)

set_supplement

bool

If set as True, supplement constraints are detected from the modelā€™s constraints as many as possible and are passed to the supplement parameter which is a flip option. (Default: True)

set_maxone

bool

If set as True, maxone constraints are detected from the modelā€™s constraints as many as possible and are passed to the maxone parameter which is a flip option. (Default: True)

set_minmaxone

bool

If set as True, minmaxone constraints are detected from the modelā€™s constraints as many as possible and are passed to the minmaxone 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

set_fixed

\(q_1 + k = k\)
\(q_1 + k = k + 1\)

set_onehot

\(q_1 + q_2 + \cdots + q_N + k = k + 1\)

set_andzero

\(q_1 + q_2 + \cdots + q_N + k \leq k + N - 1\)
\(n q_1 q_2 + k = k\)

set_orone

\(q_1 + q_2 + \cdots + q_N + k \geq k + 1\)
\(n (q_1 - 1)(q_2 - 1) + k = k\)

set_supplement

\(n (q_1 - q_2 q_3) + k = k\)

set_maxone

\(q_1 + q_2 + \cdots + q_N + k \leq n \quad (0 \leq n - k \leq N)\)

set_minmaxone

\(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 the solve_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

amplify.NECVA2Client.Result.Result.time

VA sampling time for each read.

amplify.NECVA2Client.Result.Timing.solve_qubo_time

Execution time of the solve_qubo Python API

amplify.NECVA2Client.Result.Timing.execution_time

Execution time of the VA (including network overhead and queue time)

amplify.NECVA2Client.Result.Timing.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
})