--- hide-toc: true --- # Client details The Amplify SDK provides client classes for the solvers that you can run from the SDK. The client classes wrap each solver's API and provide an interface for configuring the solver and setting execution parameters and methods for requesting the API. Solvers are available in various formats, including WEB API, executable files, and library APIs, but can be handled consistently through the solver client classes of the Amplify SDK. In addition, the Amplify SDK uses a common interface in the client class to allow abstraction of solver execution and analysis of results, in addition to model transformation and graph embedding processes. This page describes the common interfaces provided by the solver clients, and we describe the functions and features specific to each solver client in their respective subpages. (client-common-interface)= ## Client class The client class provides the following three general types of interfaces. * Setting solver execution parameters. * Retrieving client settings and solver information. * Calling solver-provided APIs The common interface for the solver clients is as follows. Interfaces that are only valid for some solvers are classified by the {bdg-primary}`tag` assigned to each solver in [the list of solver clients](#solver-clients). For solver-specific interfaces, see the subpage for each solver. :**Execution parameters**: `parameters`: {py:class}`object` : Returns a parameter class for retrieving and setting the solver execution parameters. The type of parameter class varies from solver to solver but is designed to retrieve and set all possible execution parameters. For more parameter information, see the individual solver subpages and the solver API reference. ```{note} For all solver attributes, if {py:obj}`None` is available, it means it is not set. The Amplify SDK does not set or add the attributes to {py:obj}`None` for the query data. This procedure is to force the solver to use default values. ``` :**Solver information**: `acceptable_degrees`: {py:class}`amplify.AcceptableDegrees` : Retrieves the degree of the problem that the solver can handle. See "[](intermediate.md)" for details. `version`: {py:class}`str` : Retrieves the solver version information. For remote solvers, you may need to set a token to use this interface since the API may be queried. For local solvers, this retrieves the version information for the executable or library. :**Quadratic polynomial graph structure** {bdg-warning}`Graph`: `graph`: {py:class}`~amplify.Graph` : Obtains the solver-specific graph structure. See "[](graph.md)" for details. :**WEB API Connection setting** {bdg-secondary}`☁️ Cloud`: `url`: {py:class}`str` : Gets and sets the solver endpoint URL. `token`: {py:class}`str` : Gets and sets the authentication information such as API token. `proxy`: {py:class}`str` : Gets and sets a proxy server to use for the connection. See "[](proxy.md)" for details. :**Path to executable file and library** {bdg-secondary}`💻 Local`: `library_path`: {py:class}`os.PathLike` : Specifies the file path of the solver library. (client-write-data)= :**Save sent and received data** {bdg-secondary}`☁️ Cloud` {bdg-secondary}`💻 Local`: `write_request_data`: {py:class}`os.PathLike` : Saves the query data sent to the solver to the specified file path. Data format varies by solver. `write_response_data`: {py:class}`os.PathLike` : Saves the response data received from the solver to the specified file path. The data format is different for each solver. (client-solve)= :**Solver execution**: `solve(...)`: : The `solve(...)` method is implemented in each solver client as a function to execute the solver. This is a wrapper function for the solver API. ```{note} Usually, the user does not need to call this method directly. Use the {py:func}`~amplify.solve` function instead. ``` The API can be called with a polynomial ({py:class}`~amplify.Poly`), matrix ({py:class}`~amplify.Matrix`), or constraint ({py:class}`~amplify.Constraint` or {py:class}`~amplify.ConstraintList`) argument, or both, depending on what is available to the solver API. However, unlike the global {py:func}`~amplify.solve` function, no model transformation or graph embedding is performed. Therefore, if a variable type, order, or constraint condition is given that the solver cannot handle, an exception will be thrown. The return type of the `solve(...)` method is different for each solver. For example, in the case of Amplify AE ({py:class}`~amplify.FixstarsClient`), it is an instance of the class {py:class}`amplify.FixstarsClient.Result`. This class is classified so that the data structure of the response data returned by the solver is modified as little as possible. ### Interaction with {py:func}`~amplify.solve` function After performing the model conversion and graph embedding, the {py:func}`~amplify.solve` function calls the solver client's `solve(...)` method to execute the solver and analyze the returned data to obtain information about the solution and execution time. The instance of the {py:class}`~amplify.Result` class returned by the {py:func}`~amplify.solve` function stores the data returned by the solver, the response time, and the execution time in the following attributes. ```{list-table} :width: 100% :header-rows: 1 :widths: 2 1 2 * - Attribute - Data type - Details * - {py:attr}`amplify.Result.client_result` - `Client.Result` - Result of solver client execution (response data) * - {py:attr}`amplify.Result.execution_time` - {py:class}`datetime.timedelta` - Solver internal execution time * - {py:attr}`amplify.Result.response_time` - {py:class}`datetime.timedelta` - Solver response time ``` ```{toctree} :hidden: clients/fixstars.md clients/dwave.md clients/toshiba.md clients/fujitsu.md clients/nec.md clients/gurobi.md ```