### Install qpsolvers with Pip Source: https://qpsolvers.github.io/qpsolvers/installation.html Standard installation command for the qpsolvers library using pip. Add `--user` for a user-only installation. ```bash pip install qpsolvers ``` -------------------------------- ### Install a subset of open-source QP solvers Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs qpsolvers with a specific selection of open-source QP solvers. This is useful for reducing installation size or including only necessary solvers. ```bash pip install qpsolvers[clarabel,daqp,proxqp,scs] ``` -------------------------------- ### Install qpsolvers using pip Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs the qpsolvers library using pip. The --user flag can be used for a user-specific installation. ```bash pip install qpsolvers ``` -------------------------------- ### Install All Open Source Solvers with Pip Source: https://qpsolvers.github.io/qpsolvers/installation.html Installs all available open-source QP solvers from the Python Package Index. ```bash pip install "qpsolvers[open_source_solvers]" ``` -------------------------------- ### Install qpOASES solver using Conda Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs the qpOASES solver from the conda-forge channel. This is the recommended method for installing qpOASES. ```bash conda install -c conda-forge qpoases ``` -------------------------------- ### Install Specific Open Source Solvers with Pip Source: https://qpsolvers.github.io/qpsolvers/installation.html Installs a selected subset of open-source QP solvers. ```bash pip install qpsolvers[clarabel,daqp,proxqp,scs] ``` -------------------------------- ### Install Gurobi solver Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs the Gurobi solver using pip from Gurobi's official package repository. This method is for obtaining a Gurobi license and installing the solver. ```bash python -m pip install -i https://pypi.gurobi.com gurobipy ``` -------------------------------- ### Install all open-source QP solvers Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs qpsolvers along with all available open-source QP solvers from the Python Package Index. This provides a comprehensive set of solvers for general use. ```bash pip install "qpsolvers[open_source_solvers]" ``` -------------------------------- ### Install Python Development Headers on Debian/Ubuntu Source: https://qpsolvers.github.io/qpsolvers/installation.html Required before installing the qpsolvers PyPI package on Debian-based systems with Python 3. ```bash sudo apt install python3-dev ``` -------------------------------- ### Install Gurobi Solver Source: https://qpsolvers.github.io/qpsolvers/installation.html Installs the Gurobi solver directly from the company's PyPI server. This version may have limitations. ```bash python -m pip install -i https://pypi.gurobi.com gurobipy ``` -------------------------------- ### Install quadprog solver Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs the quadprog solver from PyPI. This package includes pre-compiled wheels, avoiding the need for source compilation. ```bash pip install quadprog ``` -------------------------------- ### Example QP solution output Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt This is an example of the output produced when running a QP problem solver. It shows the calculated solution vector 'x'. ```bash QP solution: x = [0.30769231, -0.69230769, 1.38461538] Press any key to continue . . . ``` -------------------------------- ### Example Output of qpsolvers Execution Source: https://qpsolvers.github.io/qpsolvers/installation.html This is the expected output when running a qpsolvers program, showing a solved QP. ```text QP solution: x = [0.30769231, -0.69230769, 1.38461538] Press any key to continue . . . ``` -------------------------------- ### Install COPT solver Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs the COPT solver using pip. This command fetches the solver from its official package repository. ```bash python -m pip install coptpy ``` -------------------------------- ### Install HiGHS solver Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs the HiGHS solver using pip. This is the simplest method for installing the solver. ```bash pip install highspy ``` -------------------------------- ### Example Output of Primal-Dual Solution Source: https://qpsolvers.github.io/qpsolvers/quadratic-programming.html This is an example of the output format for a `Solution` object returned by `solve_problem`, showing primal variables (x) and dual variables (z, y, z_box) for inequality, equality, and bound constraints, respectively. ```text Primal: x = [ 0.63333169 -0.33333307 0.70000137] Dual (Gx <= h): z = [0. 0. 7.66660538] Dual (Ax == b): y = [-16.63326017] Dual (lb <= x <= ub): z_box = [ 0. 0. 26.26649724] ``` -------------------------------- ### Install Python development headers on Debian-based systems Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs the necessary Python development headers required for compiling certain Python packages. This is a prerequisite for installing qpsolvers via pip on some Linux distributions. ```bash sudo apt install python3-dev ``` -------------------------------- ### Install COPT Solver Source: https://qpsolvers.github.io/qpsolvers/installation.html Installs the COPT solver using pip. This version may have limitations without a commercial license. ```bash python -m pip install coptpy ``` -------------------------------- ### Install qpsolvers using Conda Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs the qpsolvers library from the conda-forge channel. This is a common method for managing Python packages and their dependencies. ```bash conda install -c conda-forge qpsolvers ``` -------------------------------- ### Install PDHCG solver Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Installs the GPU-accelerated PDHCG solver directly from PyPI. This solver requires an NVIDIA GPU and CUDA 12.0+. ```bash pip install pdhcg ``` -------------------------------- ### Solve a quadratic program using QTQP (Problem object) Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html This function solves a quadratic program defined by a Problem object using the QTQP solver. It does not support warm starting. ```APIDOC ## qtqp_solve_problem ### Description Solve a quadratic program using QTQP. ### Method Signature `qpsolvers.solvers.qtqp_.qtqp_solve_problem(_problem_ , _initvals =None_, _verbose =False_, _** kwargs_)` ### Parameters * **problem** (`Problem`) – Required - Quadratic program to solve. * **initvals** (`Optional[ndarray]`) – Optional - This argument is not used by QTQP. * **verbose** (`bool`) – Optional - Set to True to print out extra information. ### Returns `Solution` - Solution to the QP, if found, otherwise `None`. ### Notes Keyword arguments are forwarded as options to QTQP. For instance, we can call `qtqp_solve_qp(P, q, G, h, atol=1e-8, max_iter=200)`. QTQP options include: - `atol` (float): Absolute tolerance for optimality convergence (default: 1e-7). - `rtol` (float): Relative tolerance for optimality convergence (default: 1e-8). - `atol_infeas` (float): Absolute tolerance for infeasibility detection (default: 1e-8). - `rtol_infeas` (float): Relative tolerance for infeasibility detection (default: 1e-9). - `max_iter` (int): Maximum number of iterations (default: 100). - `step_size_scale` (float): Scale factor in (0,1) for line search step size (default: 0.99). - `min_static_regularization` (float): Diagonal regularization on KKT for robustness (default: 1e-7). - `max_iterative_refinement_steps` (int): Maximum steps for iterative refinement (default: 50). - `linear_solver_atol` (float): Absolute tolerance for iterative refinement (default: 1e-12). - `linear_solver_rtol` (float): Relative tolerance for iterative refinement (default: 1e-12). - `linear_solver` (qtqp.LinearSolver): KKT solver backend (default: qtqp.LinearSolver.SCIPY). - `equilibrate` (bool): Scale/equilibrate data for numerical stability (default: True). ``` -------------------------------- ### List Available Solvers Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Retrieve a list of all solvers currently detected as installed on your machine. ```python qpsolvers.available_solvers ``` -------------------------------- ### Solve Linear Least Squares with qpsolvers Source: https://qpsolvers.github.io/qpsolvers/least-squares.html Build the matrices defining a linear least-squares problem and call `solve_ls`. The backend QP solver is selected via the `solver` keyword argument. This example uses 'osqp' and outputs the solution `[0.12997217, -0.06498019, 1.74004125]`. ```python from numpy import array, dot from qpsolvers import solve_ls R = array([[1., 2., 0.], [-8., 3., 2.], [0., 1., 1.]]) s = array([3., 2., 3.]) G = array([[1., 2., 1.], [2., 0., 1.], [-1., 2., -1.]]) h = array([3., 2., -2.]).reshape((3,)) x_sol = solve_ls(R, s, G, h, solver="osqp") print(f"LS solution: {x_sol = }") ``` -------------------------------- ### Configure CUDA compiler for PDHCG installation Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Sets environment variables to explicitly point to the CUDA compiler (nvcc) when installing PDHCG. This is necessary if multiple CUDA versions are present or if the installation fails to find the compiler. ```bash export CUDACXX=/your/path/to/nvcc export SKBUILD_CMAKE_ARGS="-DCMAKE_CUDA_COMPILER=/your/path/to/nvcc" pip install pdhcg ``` -------------------------------- ### Check solution optimality and residuals Source: https://qpsolvers.github.io/qpsolvers/quadratic-programming.html Use the Solution object to verify optimality and print primal residual, dual residual, and duality gap. Requires the qpsolvers library and a solver. ```python import numpy as np from qpsolvers import Problem, solve_problem M = np.array([[1., 2., 0.], [-8., 3., 2.], [0., 1., 1.]]) P = M.T.dot(M) # quick way to build a symmetric matrix q = np.array([3., 2., 3.]).dot(M).reshape((3,)) G = np.array([[1., 2., 1.], [2., 0., 1.], [-1., 2., -1.]]) h = np.array([3., 2., -2.]).reshape((3,)) A = np.array([1., 1., 1.]) b = np.array([1.]) lb = -0.6 * np.ones(3) ub = +0.7 * np.ones(3) problem = Problem(P, q, G, h, A, b, lb, ub) solution = solve_problem(problem, solver="qpalm") print(f"- Solution is{\'\' if solution.is_optimal(1e-8) else ' NOT'} optimal") print(f"- Primal residual: {solution.primal_residual():.1e}") print(f"- Dual residual: {solution.dual_residual():.1e}") print(f"- Duality gap: {solution.duality_gap():.1e}") ``` -------------------------------- ### Implement AwesomeQP Solver Connection Source: https://qpsolvers.github.io/qpsolvers/developer-notes.html Connects a new solver's problem-solving function to the historical API. Ensure parameters and return values are documented. ```python def awesomeqp_solve_qp(P, q, G, h, A, b, lb, ub, initvals=None, verbose=False, **kwargs): ) -> Optional[np.ndarray]: r"""Solve a quadratic program using AwesomeQP. [document parameters and return values here] """ problem = Problem(P, q, G, h, A, b, lb, ub) solution = awesomeqp_solve_problem( problem, initvals, verbose, backend, **kwargs ) return solution.x if solution.found else None ``` -------------------------------- ### jaxopt_osqp_solve_qp Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solve a QP with the OSQP algorithm implemented in jaxopt. ```APIDOC ## jaxopt_osqp_solve_qp ### Description Solve a QP with the OSQP algorithm implemented in jaxopt. The quadratic program is defined as: xminimize12xTPx+qTxsubject toGx≤hAx=blb≤x≤ub It is solved using jaxopt.OSQP. ### Method `jaxopt_osqp_solve_qp(_P_ , _q_ , _G =None_, _h =None_, _A =None_, _b =None_, _lb =None_, _ub =None_, _initvals =None_, _verbose =False_, _** kwargs_) ### Parameters #### Path Parameters - **P** (ndarray) - Required - Positive semidefinite cost matrix. - **q** (ndarray) - Required - Cost vector. - **G** (Optional[ndarray]) - Optional - Linear inequality constraint matrix. - **h** (Optional[ndarray]) - Optional - Linear inequality constraint vector. - **A** (Optional[ndarray]) - Optional - Linear equality constraint matrix. - **b** (Optional[ndarray]) - Optional - Linear equality constraint vector. - **lb** (Optional[ndarray]) - Optional - Lower bound constraint vector. - **ub** (Optional[ndarray]) - Optional - Upper bound constraint vector. - **initvals** (Optional[ndarray]) - Optional - This argument is not used by jaxopt.OSQP. - **verbose** (bool) - Optional - Set to True to print out extra information. ### Return type `Optional[ndarray]` ### Returns Primal solution to the QP, if found, otherwise `None`. ``` -------------------------------- ### osqp_solve_qp Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solve a quadratic program using OSQP with explicit matrices and vectors. Supports warm-starting. ```APIDOC ## osqp_solve_qp ### Description Solve a quadratic program using OSQP. The quadratic program is defined as: minimizex12xTPx+qTxsubject toGx≤hAx=blb≤x≤ub ### Parameters * **P** (`Union`[`ndarray`, `csc_matrix`]) – Symmetric cost matrix. * **q** (`ndarray`) – Cost vector. * **G** (`Union`[`ndarray`, `csc_matrix`, `None`]) – Linear inequality constraint matrix. * **h** (`Optional`[`ndarray`]) – Linear inequality constraint vector. * **A** (`Union`[`ndarray`, `csc_matrix`, `None`]) – Linear equality constraint matrix. * **b** (`Optional`[`ndarray`]) – Linear equality constraint vector. * **lb** (`Optional`[`ndarray`]) – Lower bound constraint vector. * **ub** (`Optional`[`ndarray`]) – Upper bound constraint vector. * **initvals** (`Optional`[`ndarray`]) – Warm-start guess vector for the primal solution. * **verbose** (`bool`) – Set to True to print out extra information. ### Return type `Optional`[`ndarray`] ### Returns Solution to the QP, if found, otherwise `None`. ### Raises **ValueError** – If the problem is clearly non-convex. ### Notes OSQP requires a symmetric P and won’t check for errors otherwise. Keyword arguments are forwarded to OSQP. OSQP settings include `max_iter`, `time_limit`, `eps_abs`, `eps_rel`, `eps_prim_inf`, `eps_dual_inf`, `polish`. ``` -------------------------------- ### kvxopt_solve_qp Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solves a quadratic program defined by P, q, G, h, A, b, lb, and ub using KVXOPT. Supports warm-starting and forwarding keyword arguments. ```APIDOC ## kvxopt_solve_qp ### Description Solve a quadratic program using KVXOPT. ### Method `kvxopt_solve_qp(_P_, _q_, _G=None_, _h=None_, _A=None_, _b=None_, _lb=None_, _ub=None_, _solver=None_, _initvals=None_, _verbose=False_, _**kwargs_) ### Parameters #### Positional Parameters - **P** (`Union[ndarray, csc_matrix]`) – Symmetric cost matrix. Must satisfy rank([P AT GT])=n with A and G. - **q** (`ndarray`) – Cost vector. - **G** (`Union[ndarray, csc_matrix, None]`) – Linear inequality matrix. Must satisfy rank([P AT GT])=n with P and A. - **h** (`Optional[ndarray]`) – Linear inequality vector. - **A** (`Union[ndarray, csc_matrix, None]`) – Linear equality constraint matrix. Must be full row rank and satisfy rank([P AT GT])=n with P and G. - **b** (`Optional[ndarray]`) – Linear equality constraint vector. - **lb** (`Optional[ndarray]`) – Lower bound constraint vector. - **ub** (`Optional[ndarray]`) – Upper bound constraint vector. - **solver** (`Optional[str]`) – Set to ‘mosek’ to run MOSEK rather than KVXOPT. - **initvals** (`Optional[ndarray]`) – Warm-start guess vector for the primal solution. - **verbose** (`bool`) – Set to True to print out extra information. ### Returns `Optional[ndarray]` – Primal solution to the QP, if found, otherwise `None`. ### Raises - **ProblemError** – If the KVXOPT rank assumption is not satisfied. - **SolverError** – If KVXOPT failed with an error. ### Notes KVXOPT only considers the lower entries of P. Keyword arguments are forwarded as options to KVXOPT, such as `abstol`, `feastol`, `maxiters`, `refinement`, and `reltol`. ``` -------------------------------- ### Call qpSWIFT with Options Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Forward additional keyword arguments as options to the qpSWIFT solver. Consult the solver documentation for specific option details. ```python qpswift_solve_qp(P, q, G, h, ABSTOL=1e-5) ``` -------------------------------- ### Import and Register AwesomeQP Solver Source: https://qpsolvers.github.io/qpsolvers/developer-notes.html Imports the AwesomeQP solver function and registers it in the solve_function dictionary. Appends the solver to available_solvers. ```python try: from .awesomeqp_ import awesomeqp_solve_qp solve_function["awesomeqp"] = awesomeqp_solve_qp available_solvers.append("awesomeqp") # dense_solvers.append("awesomeqp") if applicable # sparse_solvers.append("awesomeqp") if applicable except ImportError: pass ``` -------------------------------- ### pyqpmad_solve_problem Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solve a quadratic program using pyqpmad. This function takes a Problem object and optional initial values for a warm start. ```APIDOC ## pyqpmad_solve_problem ### Description Solve a quadratic program using pyqpmad. ### Parameters #### Positional Parameters - **problem** (Problem) - Required - Quadratic program to solve. - **initvals** (Optional[ndarray]) - Optional - Initial guess for the primal solution. pyqpmad uses this as a warm-start if provided. - **verbose** (bool) - Optional - Set to True to print out extra information. ### Return Type `Solution` ### Returns Solution to the QP, if found, otherwise `None`. ### Raises **ProblemError :** – If the problem has sparse matrices (pyqpmad is a dense solver). ### Notes Keyword arguments are forwarded as attributes of a `pyqpmad.SolverParameters` object. Supported settings include: Name | Description ---|--- `tolerance` | Solver feasibility/optimality tolerance. `max_iter` | Maximum number of iterations. Check out the qpmad documentation for all available settings. ``` -------------------------------- ### Solving a Quadratic Programming Problem Source: https://qpsolvers.github.io/qpsolvers/_sources/quadratic-programming.rst.txt This snippet demonstrates how to solve a quadratic programming problem using the `qpsolvers` library and access the solution details. ```APIDOC ## solve_problem ### Description Solves a quadratic programming problem using a specified solver. ### Method Signature ```python solution = solve_problem(problem, solver="qpalm") ``` ### Parameters - **problem**: The quadratic programming problem to solve. - **solver** (string, optional): The name of the solver to use. Defaults to "qpalm". ### Returns - **solution**: An object containing the solution details. ### Solution Object Attributes - **is_optimal(tolerance)**: Returns True if the solution is optimal within the given tolerance. - **primal_residual()**: Returns the primal residual of the solution. - **dual_residual()**: Returns the dual residual of the solution. - **duality_gap()**: Returns the duality gap of the solution. ### Example Usage ```python solution = solve_problem(problem, solver="qpalm") print(f"- Solution is{'' if solution.is_optimal(1e-8) else ' NOT'} optimal") print(f"- Primal residual: {solution.primal_residual():.1e}") print(f"- Dual residual: {solution.dual_residual():.1e}") print(f"- Duality gap: {solution.duality_gap():.1e}") ``` ### Example Output ``` - Solution is optimal - Primal residual: 1.1e-16 - Dual residual: 1.4e-14 - Duality gap: 0.0e+00 ``` ``` -------------------------------- ### hpipm_solve_qp Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solve a quadratic program using HPIPM with explicit definition of problem matrices and vectors. Supports warm starts and various solver modes. ```APIDOC ## hpipm_solve_qp ### Description Solve a quadratic program using HPIPM. The quadratic program is defined as: minimizex12xTPx+qTxsubject toGx≤hAx=blb≤x≤ub ### Parameters * **P** (`ndarray`) – Symmetric cost matrix. * **q** (`ndarray`) – Cost vector. * **G** (`Optional`[`ndarray`]) – Linear inequality constraint matrix. * **h** (`Optional`[`ndarray`]) – Linear inequality constraint vector. * **A** (`Optional`[`ndarray`]) – Linear equality constraint matrix. * **b** (`Optional`[`ndarray`]) – Linear equality constraint vector. * **lb** (`Optional`[`ndarray`]) – Lower bound constraint vector. * **ub** (`Optional`[`ndarray`]) – Upper bound constraint vector. * **initvals** (`Optional`[`ndarray`]) – Warm-start guess vector for the primal solution. * **mode** (`str`) – Solver mode, which provides a set of default solver arguments. Pick one of [“speed_abs”, “speed”, “balance”, “robust”]. Default is “balance”. * **verbose** (`bool`) – Set to True to print out extra information. ### Returns `Optional`[`ndarray`] - Solution to the QP, if found, otherwise `None`. ### Notes Keyword arguments are forwarded to HPIPM. For instance, we can call `hpipm_solve_qp(P, q, G, h, u, tol_eq=1e-5)`. HPIPM settings include: Name | Description ---|--- `iter_max` | Maximum number of iterations. `tol_eq` | Equality constraint tolerance. `tol_ineq` | Inequality constraint tolerance. `tol_comp` | Complementarity condition tolerance. `tol_dual_gap` | Duality gap tolerance. `tol_stat` | Stationarity condition tolerance. ``` -------------------------------- ### Enable 64-bit JAX for qpax Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Set jax_enable_x64 to True to use 64-bit floating point numbers in JAX, which can help mitigate numerical instability issues when using the qpax solver. ```python import jax jax.config.update("jax_enable_x64", True) ``` -------------------------------- ### hpipm_solve_problem Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solve a quadratic program using HPIPM. This function provides a high-level interface for the HPIPM solver, supporting warm starts and various solver modes. ```APIDOC ## hpipm_solve_problem ### Description Solve a quadratic program using HPIPM. ### Parameters * **problem** (`Problem`) – Quadratic program to solve. * **initvals** (`Optional`[`ndarray`]) – Warm-start guess vector for the primal solution. * **mode** (`str`) – Solver mode, which provides a set of default solver arguments. Pick one of [“speed_abs”, “speed”, “balance”, “robust”]. The default one is “balance”. * **verbose** (`bool`) – Set to True to print out extra information. ### Returns `Solution` - Solution returned by the solver. ### Notes Keyword arguments are forwarded to HPIPM. For instance, we can call `hpipm_solve_qp(P, q, G, h, u, tol_eq=1e-5)`. HPIPM settings include: Name | Description ---|--- `iter_max` | Maximum number of iterations. `tol_eq` | Equality constraint tolerance. `tol_ineq` | Inequality constraint tolerance. `tol_comp` | Complementarity condition tolerance. `tol_dual_gap` | Duality gap tolerance. `tol_stat` | Stationarity condition tolerance. ``` -------------------------------- ### Solve QP using SIP with explicit matrices Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solves a quadratic program defined by matrices P, q, G, h, A, b, lb, ub using the SIP solver. ```APIDOC ## SIP QP Solver Interface ### Description Solves a quadratic program defined by explicit matrices using the SIP solver. The quadratic program is defined as: minimize 1/2 * x^T * P * x + q^T * x subject to G * x <= h A * x == b lb <= x <= ub ### Method Signature `qpsolvers.solvers.sip_.sip_solve_qp(_P_, _q_, _G=None_, _h=None_, _A=None_, _b=None_, _lb=None_, _ub=None_, _initvals=None_, _allow_non_psd_P=False_, _verbose=False_, _**kwargs_) ### Parameters * **P** (`Union`[`ndarray`, `csc_matrix`]) – Positive semidefinite cost matrix. * **q** (`ndarray`) – Cost vector. * **G** (`Union`[`ndarray`, `csc_matrix`, `None`]) – Linear inequality constraint matrix. * **h** (`Optional`[`ndarray`]) – Linear inequality constraint vector. * **A** (`Union`[`ndarray`, `csc_matrix`, `None`]) – Linear equality constraint matrix. * **b** (`Optional`[`ndarray`]) – Linear equality constraint vector. * **lb** (`Optional`[`ndarray`]) – Lower bound constraint vector. * **ub** (`Optional`[`ndarray`]) – Upper bound constraint vector. * **initvals** (`Optional`[`ndarray`]) – Warm-start guess vector for the primal solution. * **allow_non_psd_P** (`bool`) – Whether to allow non-positive semidefinite P matrices. * **verbose** (`bool`) – Set to True to print out extra information. ### Returns `Optional`[`ndarray`] – The primal solution vector, or None if the problem could not be solved. ``` -------------------------------- ### COPT non-commercial use warning Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Indicates that COPT is starting with size limitations due to a lack of a full license, and directs users to apply for a license for non-commercial use. ```python No license found. Starting COPT with size limitations for non-commercial use Please apply for a license from www.shanshu.ai/copt ``` -------------------------------- ### Gurobi size-limited license warning Source: https://qpsolvers.github.io/qpsolvers/_sources/installation.rst.txt Example of a warning message indicating that a model is too large for the size-limited Gurobi license. Users are directed to obtain a full license for larger problems. ```python Warning: Model too large for size-limited license; visit https://www.gurobi.com/free-trial for a full license ``` -------------------------------- ### Solve Problem using SIP Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solves a quadratic program using the SIP solver. Supports warm-starting. ```APIDOC ## SIP Solver Interface ### Description Solver interface for SIP, a general NLP solver based on the barrier augmented Lagrangian method. ### Method Signature `qpsolvers.solvers.sip_.sip_solve_problem(_problem_, _initvals=None_, _verbose=False_, _allow_non_psd_P=False_, _**kwargs_) ### Parameters * **problem** (`Problem`) – Quadratic program to solve. * **initvals** (`Optional`[`ndarray`]) – Warm-start guess vector for the primal solution. * **verbose** (`bool`) – Set to True to print out extra information. * **allow_non_psd_P** (`bool`) – Whether to allow non-positive semidefinite P matrices. ### Returns `Solution` – Solution to the QP returned by the solver. ### Notes All other keyword arguments are forwarded as options to SIP. For instance, you can call `sip_solve_qp(P, q, G, h, eps_abs=1e-6)`. For a quick overview, the solver accepts settings such as `max_iterations`, `max_ls_iterations`, `initial_regularization`, etc. Check the solver code for a complete list. ``` -------------------------------- ### osqp_solve_problem Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solve a quadratic program using OSQP with a Problem object. Supports warm-starting. ```APIDOC ## osqp_solve_problem ### Description Solve a quadratic program using OSQP. ### Parameters * **problem** (`Problem`) – Quadratic program to solve. * **initvals** (`Optional`[`ndarray`]) – Warm-start guess vector for the primal solution. * **verbose** (`bool`) – Set to True to print out extra information. ### Return type `Solution` ### Returns Solution returned by the solver. ### Raises **ValueError** – If the problem is clearly non-convex. ### Notes OSQP requires a symmetric P and won’t check for errors otherwise. Keyword arguments are forwarded to OSQP. OSQP settings include `max_iter`, `time_limit`, `eps_abs`, `eps_rel`, `eps_prim_inf`, `eps_dual_inf`, `polish`. ``` -------------------------------- ### jaxopt_osqp_solve_problem Source: https://qpsolvers.github.io/qpsolvers/supported-solvers.html Solve a quadratic program with the OSQP algorithm implemented in jaxopt. ```APIDOC ## jaxopt_osqp_solve_problem ### Description Solve a quadratic program with the OSQP algorithm implemented in jaxopt. ### Method `jaxopt_osqp_solve_problem(_problem_ , _initvals =None_, _verbose =False_, _** kwargs_) ### Parameters #### Path Parameters - **problem** (Problem) - Required - Quadratic program to solve. - **initvals** (Optional[ndarray]) - Optional - This argument is not used by jaxopt.OSQP. - **verbose** (bool) - Optional - Set to True to print out extra information. ### Return type `Solution` ### Returns Solution to the QP returned by the solver. ### Notes All other keyword arguments are forwarded as keyword arguments to jaxopt.OSQP. For instance, you can call `jaxopt_osqp_solve_qp(P, q, G, h, sigma=1e-5, momentum=0.9)`. Note that JAX by default uses 32-bit floating point numbers, which can lead to numerical instability. If you encounter numerical issues, consider using 64-bit floating point numbers by setting its jax_enable_x64 configuration. ``` -------------------------------- ### Define AwesomeQP Function Prototype Source: https://qpsolvers.github.io/qpsolvers/developer-notes.html Defines the function prototype for the AwesomeQP solver in the __init__.py file. The prototype must match the actual function signature. ```python # AwesomeQP # ======= awesome_solve_qp: Optional[ Callable[ [ ndarray, ndarray, Optional[ndarray], Optional[ndarray], Optional[ndarray], Optional[ndarray], Optional[ndarray], Optional[str], bool, ], Optional[ndarray], ] ] = None ```