6. Solver Client

To run a solver from the Amplify SDK, you must create a solver client that abstracts each solver and specifies the connection point, API token, and execution parameters. The solver client also contains information about the solver’s capabilities, such as the types of variables, constraints, degree, and so on that it can handle. Amplify SDK uses this information to perform model conversions automatically, such as variable conversions, degree reduction, constraint implementation, and embedding in hardware topology.

6.1. Configuring solver client

Using the Amplify Annealing Engine (AE) as an example, let’s create the FixstarsClient client as follows.

from amplify import FixstarsClient

client = FixstarsClient()

Tip

Amplify AE provides a free API token when you register as a user.

Most parameters of the client class are initialized (or unset) with the solver’s default values after construction, so you can use them immediately after setting the required parameters for each client. The required parameters vary from client to client, but you must set an API token in the token attribute for most cloud solvers.

client.token = "YOUR_API_TOKEN"

For all clients, the solver’s execution parameters are retrieved and set to attributes in the parameters property. Because the setting items are as consistent as possible with the solver API, see the reference for each solver below for details.

For example, in Amplify AE, you can set the execution time as follows.

from datetime import timedelta

client.parameters.timeout = timedelta(milliseconds=1000)  # 1000 milliseconds

Tip

Because each client has a different time unit and time format for time-related parameters, the Amplify SDK uses the datetime module for input and output.

The Amplify SDK can print parameters set in the client class as strings using the str or print() function.

>>> print(client)   
{"url":"https://optigan.fixstars.com","token":"YOUR_API_TOKEN","compression":true,"parameters":{"outputs":{},"timeout":1000}}

Setting some parameters to None means they are unset, i.e., using the solver defaults.

client.parameters.timeout = None  # reset to solver defaults

6.2. List of solver clients

The Amplify SDK supports the following solver clients.


QUBO Ising MIP

These represent the types of problems that the solver can directly handle.

  • QUBO This solver can solve for the objective function of a quadratic polynomial in binary variables. It cannot directly handle constraints, but some solvers support the input of equality and inequality constraints.

  • Ising This solver can solve for the objective function of a quadratic polynomial in an Ising variable. It cannot directly handle constraints, but some solvers support the input of equality and inequality constraints.

  • MIP This solver can solve mixed integer programming problems. It can directly handle binary, integer, and real variables. It generally targets first-order problems (linear programming problems), but some solvers can handle second-order problems, including QUBO.

Note

The Amplify SDK automatically performs transformations such as variable conversion, degree reduction, and constraint penalty function generation for problems the solver cannot handle directly. Therefore, users do not necessarily need to create problems in a format the solver can address directly. However, depending on the type of solver and the type of model input, it may not be supported or formulated accurately. See Model Conversions for more information.

Graph

This represents a quadratic term that you can pass to the solver. Solvers without these tags have no restrictions on quadratic terms. Other solvers have restrictions on the quadratic terms in the input model and require an operation called graph embedding to solve arbitrary quadratic polynomials. The problem size the solvers can handle is about \(O\left( \sqrt N \right)\) in the worst case for \(N\) variables the solver can take. See “Graph Embedding” for details.

CPU GPU VE QPU Hybrid

This indicates the type of computing device the machine is running on; VE indicates NEC SX-Aurora TSUBASA Vector Engine, and Hybrid indicates that the solver is a hybrid of QPU and other technologies.

☁️ Cloud 💻 Local

This indicates whether the solver is provided as a cloud service or must be installed on the user’s machine.