Solvers Resources

Solver resources represent resources that run a problem.

SAPI Endpoints

The following table provides an overview of the SAPI URLs that map to solver resources.

Table 68 SAPI URLs

URL

Method

Reference

/solvers/remote/

GET

Get a List of Available Solvers and Their Properties

/solvers/remote/<solver_id>/

GET

Get the Properties of a Solver

Solver Properties

Table 69 Solver Resource Properties

Property

Description

avg_load

The average load for the solver at the moment it was queried.

description

Description of the solver.

id

Unique ID of the solver.

properties

Solver properties that reside in the properties dict; for example, supported problem types, active qubits, active couplers, total number of qubits, and so on.

status

Status of the solver; for example, a status of online is returned if it is available and offline if it is unavailable.

For details on solver types, solver properties, and the problem-solving parameters that are supported by the different solver types, see the Solver Properties and Parameters Reference.

Get a List of Available Solvers and Their Properties

Request

Retrieve the list of available remote solvers and their properties by sending an HTTP GET request to $SAPI_HOME/solvers/remote. By default, all solver properties are returned. You can use the filter parameter to get a subset of solver properties; see Retrieve a Subset of Solver Properties.

Note

The solvers that are available vary by region.

This example uses curl to retrieve the list of remote solvers and all their properties:

curl -H "X-Auth-Token: $SAPI_TOKEN" $SAPI_HOME/solvers/remote

Response

The system responds with 200 OK and returns a list of solvers and all their properties formatted as a JSON list.

Example of the output:

[
    {
        "properties": {
            "supported_problem_types": ["qubo", "ising"],
            "qubits": [ ... ],
            "couplers": [ ... ],
            "num_qubits": 512
        }
        "id": "Solver 1",
        "description": "Solver #1"
    },
    {
        "properties": {
            "supported_problem_types": ["ising"],
            "qubits": [ ... ],
            "couplers": [ ... ],
            "num_qubits": 512
        }
        "id": "Solver 2",
        "description": "Solver #2"
    }
]

Get the Properties of a Solver

Request

Retrieve the properties of a solver by sending an HTTP GET request to $SAPI_HOME/solvers/remote/<solver_id>. By default, all solver properties are returned. You can use the filter parameter to get a subset of solver properties; see Retrieve a Subset of Solver Properties.

Response

The solver properties are returned as a JSON object.

This example retrieves all properties for a remote solver:

curl -H "X-Auth-Token: $SAPI_TOKEN" $SAPI_HOME/solvers/remote/solver1

Example of the output:

{
    "properties": {
        "supported_problem_types": ["qubo", "ising"],
        "qubits": [ ... ],
        "couplers": [ ... ],
        "num_qubits": 512
    }
    "id": "solver1",
    "description": "solver1"
}

The properties attribute holds the solver properties such as number of active qubits and couplers.

Response codes are as follows:

Table 70 Response Codes for Get Solver Configuration

Response Code

Meaning

200

Success

404

Solver with specified solver_id does not exist.

429

Number of API requests exceeds the permitted limit.

Retrieve a Subset of Solver Properties

To retrieve a subset of solver properties, create a list of the subset of solver properties by specifying the filter parameter via the following syntax:

filter={all|none}[,{+|-}property]... [,{+|-}property]

where:

all

Initializes the list with all solver properties. This is the default.

none

Initializes the list with no solver properties.

{+|-}property

Adds (+) or removes (-) a solver property to or from the list. The properties are evaluated left to right; for example, if a property is both added and removed, the last action prevails. To specify the solver properties in a solver’s properties dict, use dot notation as follows:

properties.property[.property]... [.property]

For example:

properties.problem_timing_data.typical_programming_time

If a property does not exist or a property does not contain a value, nothing is returned for that property. The maximum size of the SAPI URL in the request is 8 KB; thus, the specified filter parameter must not extend the URL beyond this maximum.

Example

This example retrieves a subset of a solver’s properties:

$ curl -G -H "X-Auth-Token: $SAPI_TOKEN" $SAPI_HOME/solvers/remote/hybrid_v1/
--data-urlencode "filter=none,+id,+properties.problem_timing_data.readout_time_model_parameters"

Note

The --data-urlencode option specifies to use URL encoding, specifically for the + sign.

Example of the output:

[
  {
    "id":"hybrid_v1",
    "properties":{
      "problem_timing_data":{
        "readout_time_model_parameters":[0.0,0.4894571331385026,2.53856475984578,
        3.667394307487786,3.745309059940828,1.3214072448125098,1.6409311531346717,
        2.2217284098489896,2.420035642782522,2.4219656882251117]
      }
    }
  }
]