Solver Features

Solve method options

The solve method takes optional arguments that let you change how CVXPY parses and solves the problem.

solve(solver=None, verbose=False, gp=False, qcp=False, requries_grad=False, enforce_dpp=False, **kwargs)

Solves the problem using the specified method.

Populates the status and value attributes on the problem object as a side-effect.

  • solver (str, optional) – The solver to use.

  • verbose (bool, optional) – Overrides the default of hiding solver output.

  • gp (bool, optional) – If True, parses the problem as a disciplined geometric program instead of a disciplined convex program.

  • qcp (bool, optional) – If True, parses the problem as a disciplined quasiconvex program instead of a disciplined convex program.

  • requires_grad (bool, optional) –

    Makes it possible to compute gradients of a solution with respect to Parameters by calling problem.backward() after solving, or to compute perturbations to the variables given perturbations to Parameters by calling problem.derivative().

    Gradients are only supported for DCP and DGP problems, not quasiconvex problems. When computing gradients (i.e., when this argument is True), the problem must satisfy the DPP rules.

  • enforce_dpp (bool, optional) – When True, a DPPError will be thrown when trying to solve a non-DPP problem (instead of just a warning). Only relevant for problems involving Parameters. Defaults to False.

  • ignore_dpp (bool, optional) – When True, DPP problems will be treated as non-DPP, which may speed up compilation. Defaults to False.

  • kwargs – Additional keyword arguments specifying solver specific options.


The optimal value for the problem, or a string indicating why the problem could not be solved.

We will discuss the optional arguments in detail below.

Choosing a solver

CVXPY is distributed with the open source solvers CLARABEL, OSQP, and SCS. Many other solvers can be called by CVXPY if installed separately. The table below shows the types of problems the supported solvers can handle.













































































SDPA ***

























(*) Mixed-integer LP only.

(**) Except mixed-integer SDP.

(***) Multiprecision support is available on SDPA if the appropriate SDPA package is installed. With multiprecision support, SDPA can solve your problem with much smaller epsilonDash and/or epsilonStar parameters. These parameters must be manually adjusted to achieve the desired degree of precision. Please see the solver website for details. SDPA can also solve some ill-posed problems with multiprecision support.

LP - Linear Programming refers to problems with a linear objective function and linear constraints.

QP - Quadratic Programming refers to problems with a quadratic objective function and linear constraints.

SOCP - Second-Order Cone Programming refers to problems with second-order cone constraints. The second-order cone is defined as

\(\mathcal{C}_{n+1} = \left\{\begin{bmatrix} x \\ t \end{bmatrix} \mid x \in \mathbb{R}^n , t \in \mathbb{R} , \| x \|_2 \leq t\right\}\)

SDP - Semidefinite Programming refers to problems with semidefinite matrix constraints.

EXP - refers to problems with exponential cone constraints. The exponential cone is defined as

\(\{(x,y,z) \mid y > 0, y\exp(x/y) \leq z \} \cup \{ (x,y,z) \mid x \leq 0, y = 0, z \geq 0\}\).

POW - refers to problems with 3-dimensional power cone constraints. The 3D power cone is defined as

\(\{(x,y,z) \mid x^{\alpha}y^{\alpha} \geq |z|, x \geq 0, y \geq 0 \}\).

Support for power cone constraints is a recent addition (v1.1.8), and CVXPY currently does not have any atoms that take advantage of this constraint. If you want you want to use this type of constraint in your model, you will need to instantiate PowCone3D and/or PowConeND objects manually.

MIP - Mixed-Integer Programming refers to problems where some decision variables are constrained to be integer values.

By default CVXPY calls the solver most specialized to the problem type. For example, ECOS is called for SOCPs. SCS can handle all problems (except mixed-integer programs). If the problem is a QP, CVXPY will use OSQP.

You can change the solver called by CVXPY using the solver keyword argument. If the solver you choose cannot solve the problem, CVXPY will raise an exception. Here’s example code solving the same problem with different solvers.

# Solving a problem with different solvers.
x = cp.Variable(2)
obj = cp.Minimize(x[0] + cp.norm(x, 1))
constraints = [x >= 2]
prob = cp.Problem(obj, constraints)

# Solve with OSQP.
print("optimal value with OSQP:", prob.value)

print("optimal value with CLARABEL:", prob.value)

# Solve with {solver_name}
print("optimal value with {solver_name}:", prob.value)

optimal value with OSQP: 6.0
optimal value with CLARABEL: 6.0

Use the installed_solvers utility function to get a list of the solvers your installation of CVXPY supports.


Viewing solver output

All the solvers can print out information about their progress while solving the problem. This information can be useful in debugging a solver error. To see the output from both CVXPY and the solvers, set verbose=True in the solve method. If you want to see the output from the solver only, set solver_verbose=True.

# Solve with ECOS and display output.
prob.solve(solver=cp.ECOS, verbose=True)
print(f"optimal value with ECOS: {prob.value}")
ECOS 1.0.3 - (c) A. Domahidi, Automatic Control Laboratory, ETH Zurich, 2012-2014.

It     pcost         dcost      gap     pres    dres     k/t     mu      step     IR
 0   +0.000e+00   +4.000e+00   +2e+01   2e+00   1e+00   1e+00   3e+00    N/A     1 1 -
 1   +6.451e+00   +8.125e+00   +5e+00   7e-01   5e-01   7e-01   7e-01   0.7857   1 1 1
 2   +6.788e+00   +6.839e+00   +9e-02   1e-02   8e-03   3e-02   2e-02   0.9829   1 1 1
 3   +6.828e+00   +6.829e+00   +1e-03   1e-04   8e-05   3e-04   2e-04   0.9899   1 1 1
 4   +6.828e+00   +6.828e+00   +1e-05   1e-06   8e-07   3e-06   2e-06   0.9899   2 1 1
 5   +6.828e+00   +6.828e+00   +1e-07   1e-08   8e-09   4e-08   2e-08   0.9899   2 1 1

OPTIMAL (within feastol=1.3e-08, reltol=1.5e-08, abstol=1.0e-07).
Runtime: 0.000121 seconds.

optimal value with ECOS: 6.82842708233

Solving disciplined geometric programs

When the solve method is called with gp=True, the problem is parsed as a disciplined geometric program instead of a disciplined convex program. For more information, see the DGP tutorial.

Solver stats

When the solve method is called on a problem object and a solver is invoked, the problem object records the optimal value, the values of the primal and dual variables, and several solver statistics. We have already discussed how to view the optimal value and variable values. The solver statistics are accessed via the problem.solver_stats attribute, which returns a SolverStats object. For example, problem.solver_stats.solve_time gives the time it took the solver to solve the problem.


Information stored in problem.solver_stats differs in the solver used. For example, if we use MOSEK, problem.solver_stats.num_iters includes the following: iinfitem.intpnt_iter, liinfitem.simplex_iter or iinfitem.mio_num_relax. In addition, problem.solver_stats.extra_stats includes liinfitem.mio_intpnt_iter and liinfitem.mio_simplex_iter. For more information, please visit

Warm start

When solving the same problem for multiple values of a parameter, many solvers can exploit work from previous solves (i.e., warm start). For example, the solver might use the previous solution as an initial point or reuse cached matrix factorizations. Warm start is enabled by default and controlled with the warm_start solver option. The code below shows how warm start can accelerate solving a sequence of related least-squares problems.

import cvxpy as cp
import numpy

# Problem data.
m = 2000
n = 1000
A = numpy.random.randn(m, n)
b = cp.Parameter(m)

# Construct the problem.
x = cp.Variable(n)
prob = cp.Problem(cp.Minimize(cp.sum_squares(A @ x - b)),
                   [x >= 0])

b.value = numpy.random.randn(m)
print("First solve time:", prob.solver_stats.solve_time)

b.value = numpy.random.randn(m)
print("Second solve time:", prob.solver_stats.solve_time)
First solve time: 11.14
Second solve time: 2.95

The speed up in this case comes from caching the KKT matrix factorization. If A were a parameter, factorization caching would not be possible and the benefit of warm start would only be a good initial point.

Warm start can also be used to provide an initial guess the first time a problem is solved. The initial guess is constructed from the value field of the problem variables. If the same problem is solved a second time, the initial guess is constructed from the cached previous solution as described above (rather than from the value field).

Setting solver options

The OSQP, ECOS, GLOP, MOSEK, CBC, CVXOPT, NAG, PDLP, GUROBI, SCS , CLARABEL, DAQP, PIQP and PROXQP Python interfaces allow you to set solver options such as the maximum number of iterations. You can pass these options along through CVXPY as keyword arguments.

For example, here we tell SCS to use an indirect method for solving linear equations rather than a direct method.

# Solve with SCS, use sparse-indirect method.
prob.solve(solver=cp.SCS, verbose=True, use_indirect=True)
print(f"optimal value with SCS: {prob.value}")
    SCS v1.0.5 - Splitting Conic Solver
    (c) Brendan O'Donoghue, Stanford University, 2012
Lin-sys: sparse-indirect, nnz in A = 13, CG tol ~ 1/iter^(2.00)
EPS = 1.00e-03, ALPHA = 1.80, MAX_ITERS = 2500, NORMALIZE = 1, SCALE = 5.00
Variables n = 5, constraints m = 9
Cones:  linear vars: 6
    soc vars: 3, soc blks: 1
Setup time: 2.78e-04s
 Iter | pri res | dua res | rel gap | pri obj | dua obj | kap/tau | time (s)
     0| 4.60e+00  5.78e-01       nan      -inf       inf       inf  3.86e-05
    60| 3.92e-05  1.12e-04  6.64e-06  6.83e+00  6.83e+00  1.41e-17  9.51e-05
Status: Solved
Timing: Total solve time: 9.76e-05s
    Lin-sys: avg # CG iterations: 1.00, avg solve time: 2.24e-07s
    Cones: avg projection time: 4.90e-08s
Error metrics:
|Ax + s - b|_2 / (1 + |b|_2) = 3.9223e-05
|A'y + c|_2 / (1 + |c|_2) = 1.1168e-04
|c'x + b'y| / (1 + |c'x| + |b'y|) = 6.6446e-06
dist(s, K) = 0, dist(y, K*) = 0, s'y = 0
c'x = 6.8284, -b'y = 6.8285
optimal value with SCS: 6.82837896975

Here is the complete list of solver options.

OSQP options:


maximum number of iterations (default: 10,000).


absolute accuracy (default: 1e-5).


relative accuracy (default: 1e-5).

For others see OSQP documentation.

PROXQP options:


solver backend [dense, sparse] (default: dense).


maximum number of iterations (default: 10,000).


absolute accuracy (default: 1e-8).


relative accuracy (default: 0.0).


primal proximal parameter (default: 1e-6).


dual equality constraint proximal parameter (default: 1e-3).


dual inequality constraint proximal parameter (default: 1e-1).

ECOS options:


maximum number of iterations (default: 100).


absolute accuracy (default: 1e-8).


relative accuracy (default: 1e-8).


tolerance for feasibility conditions (default: 1e-8).


absolute accuracy for inaccurate solution (default: 5e-5).


relative accuracy for inaccurate solution (default: 5e-5).


tolerance for feasibility condition for inaccurate solution (default: 1e-4).

DAQP options:

For more information see the DAQP documentation, some features of DAQP are currently unsupported in CVXPY.


tolerance for primal infeasibility (default: 1e-6).


olerance for dual infeasibility (default: 1e-12).


values below are regarded as zero (default: 1e-11).


value used for determining if rows in the LDL factorization should be exchanged. A higher value improves stability (default: 1e-6).


minimum change in objective function to consider it progress (default: 1e-6).


allowed number of iterations without progress before terminating (default: 10).


maximum number of iterations before terminating (default: 1000).


Maximum allowed objective function value. The solver terminates if the dual objective exceeds this value (since it is a lower bound of the optimal value, default: 1e30).


Regularization parameter used for proximal-point iterations (0 means that no proximal-point iterations are performed). If the cost matrix has a null eigenvalue, setting this to 0 (upstream’s default) makes DAQP fail. Note that CVXPY’s canonicalization procedure may add extra variables with 0 quadratic cost which cause the cost matrix to have null eigenvalues (default: 1e-5 if there are null eigenvalues, else 0).


Tolerance that determines if a fix-point has been reached during proximal-point iterations (default: 1e-6).

GLOP options:


Time limit for the solve, in seconds.


A ortools.glop.parameters_pb2.GlopParameters protocol buffer message. For the definition of GlopParameters, see here.

MOSEK options:


A dictionary of MOSEK parameters in the form name: value. Parameter names should be strings, as in the MOSEK C API or command line, for example 'MSK_DPAR_BASIS_TOL_X', 'MSK_IPAR_NUM_THREADS' etc. Values are strings, integers or floats, depending on the parameter. See example.


The name of a file where MOSEK will save the problem just before optimization. Refer to MOSEK documentation for a list of supported file formats. File format is chosen based on the extension.


For a linear problem, if bfs=True, then the basic solution will be retrieved instead of the interior-point solution. This assumes no specific MOSEK parameters were used which prevent computing the basic solution.


If accept_unknown=True, an inaccurate solution will be returned, even if it is arbitrarily bad, when the solver does not generate an optimal point under the given conditions.


Applies tolerance eps to termination parameters for (conic) interior-point, simplex, and MIO solvers. The full list of termination parameters is returned by MOSEK.tolerance_params() in cvxpy.reductions.solvers.conic_solvers.mosek_conif. Explicitly defined parameters take precedence over eps.


In CVXPY 1.1.6 we did a complete rewrite of the MOSEK interface. The main takeaway is that we now dualize all continuous problems. The dualization is automatic because this eliminates the previous need for a large number of slack variables, and never results in larger problems compared to our old MOSEK interface. If you notice MOSEK solve times are slower for some of your problems under CVXPY 1.1.6 or higher, be sure to use the MOSEK solver options to tell MOSEK that it should solve the dual; this can be accomplished by adding the (key, value) pair ('MSK_IPAR_INTPNT_SOLVE_FORM', 'MSK_SOLVE_DUAL') to the mosek_params argument.

CVXOPT options:


maximum number of iterations (default: 100).


absolute accuracy (default: 1e-7).


relative accuracy (default: 1e-6).


tolerance for feasibility conditions (default: 1e-7).


number of iterative refinement steps after solving KKT system (default: 1).


Controls the method used to solve systems of linear equations at each step of CVXOPT’s interior-point algorithm. This parameter can be a string (with one of several values), or a function handle.

KKT solvers built-in to CVXOPT can be specified by strings ‘ldl’, ‘ldl2’, ‘qr’, ‘chol’, and ‘chol2’. If ‘chol’ is chosen, then CVXPY will perform an additional presolve procedure to eliminate redundant constraints. You can also set kktsolver='robust'. The ‘robust’ solver is implemented in python, and is part of CVXPY source code; the ‘robust’ solver doesn’t require a presolve phase to eliminate redundant constraints, however it can be slower than ‘chol’.

Finally, there is an option to pass a function handle for the kktsolver argument. Passing a KKT solver based on a function handle allows you to take complete control of solving the linear systems encountered in CVXOPT’s interior-point algorithm. The API for KKT solvers of this form is a small wrapper around CVXOPT’s API for function-handle KKT solvers. The precise API that CVXPY users are held to is described in the CVXPY source code: cvxpy/reductions/solvers/

SDPA options:


The maximum number of iterations. (default: 100).


The accuracy of an approximate optimal solution for primal and dual SDP. (default: 1.0E-7).


An initial point. (default: 1.0E2).


The search region for an optimal solution. (default: 2.0).


Lower bound of the minimum objective value of the primal SDP. (default: -1.0E5).


Upper bound of the maximum objective value of the dual SDP. (default: 1.0E5).


The parameter for controlling the search direction if the current point is feasible. (default: 0.1).


The parameter for controlling the search direction if the current point is infeasible. (default: 0.2).


A reduction factor for the primal and dual step lengths. (default: 0.9).


The relative accuracy of an approximate optimal solution between primal and dual SDP. (default: 1.0E-7).


Specify whether to check the symmetricity of input matrices. (default: False).


Specify whether to compute DIMACS ERROR. (default: False).


numThreads (default: 'multiprocessing.cpu_count()').


Algorithm option for exploiting sparsity in the domain space. Can be 'none' (exploiting no sparsity in the domain space) or 'basis' (using basis representation) (default: 'none').


Algorithm option for exploiting sparsity in the range space. Can be 'none' (exploiting no sparsity in the range space) or 'decomp' (using matrix decomposition) (default: 'none').


The method to eliminate free variables. Can be 'split' or 'elimination' (default: 'split').


The parameter of range in split method or pivoting in elimination method. (default: 0.0).


The zero point of matrix operation, determine unboundness, or LU decomposition. (default: 1.0E-12).

SCS options:


maximum number of iterations (default: 2500).


convergence tolerance (default: 1e-4).


relaxation parameter (default: 1.8).


Anderson Acceleration parameter for SCS 2.0 and higher. This can be any positive or negative integer; its default value is 10. See this page of the SCS documentation for more information.


The value of this parameter often effects whether or not SCS 2.X will converge to an accurate solution. If you don’t explicitly set acceleration_lookback and SCS 2.X fails to converge, then CVXPY will raise a warning and try to re-solve the problem with acceleration_lookback=0. No attempt will be made to re-solve with problem if you have SCS version 3.0 or higher.


balance between minimizing primal and dual residual (default: 5.0).


whether to precondition data matrices (default: True).


whether to use indirect solver for KKT sytem (instead of direct) (default: True).


whether to use a quadratic objective or reduce it to SOC constraints (default: True).

CBC options:

Cut-generation through CGL

General remarks:
  • some of these cut-generators seem to be buggy (observed problems with AllDifferentCuts, RedSplitCuts, LandPCuts, PreProcessCuts)

  • a few of these cut-generators will generate noisy output even if 'verbose=False'

The following cut-generators are available:

GomoryCuts, MIRCuts, MIRCuts2, TwoMIRCuts, ResidualCapacityCuts, KnapsackCuts FlowCoverCuts, CliqueCuts, LiftProjectCuts, AllDifferentCuts, OddHoleCuts, RedSplitCuts, LandPCuts, PreProcessCuts, ProbingCuts, SimpleRoundingCuts.


if cut-generator is activated (e.g. 'GomoryCuts=True')


an integer variable is deemed to be at an integral value if it is no further than this value (tolerance) away


stop after given amount of seconds


stop after given maximum number of nodes


stop after evalutation x number of solutions


sets the number of threads


returns a solution if the gap between the best known solution and the best possible solution is less than this value.


returns a solution if the gap between the best known solution and the best possible solution is less than this fraction.


returns if the gap between the best known solution and the best possible solution is less than this percentage.

COPT options:

COPT solver options are specified in CVXPY as keyword arguments. The full list of COPT parameters with defaults is listed here.

CPLEX options:


a dictionary where the key-value pairs are composed of parameter names (as used in the CPLEX Python API) and parameter values. For example, to set the advance start switch parameter (i.e., CPX_PARAM_ADVIND), use “advance” for the parameter name. For the data consistency checking and modeling assistance parameter (i.e., CPX_PARAM_DATACHECK), use “read.datacheck” for the parameter name, and so on.


a string specifying the filename to which the problem will be written. For example, use “model.lp”, “model.sav”, or “model.mps” to export to the LP, SAV, and MPS formats, respectively.


A boolean. This is only relevant for problems where CPLEX initially produces an “infeasible or unbounded” status. Its default value is False. If set to True, then if CPLEX produces an “infeasible or unbounded” status, its algorithm parameters are automatically changed and the problem is re-solved in order to determine its precise status.

NAG options:


a dictionary of NAG option parameters. Refer to NAG’s Python or Fortran API for details. For example, to set the maximum number of iterations for a linear programming problem to 20, use “LPIPM Iteration Limit” for the key name and 20 for its value .

SCIP options:

'scip_params' a dictionary of SCIP optional parameters, a full list of parameters with defaults is listed here.

SCIPY options:

'scipy_options' a dictionary of SciPy optional parameters, a full list of parameters with defaults is listed here.

  • Please note: All options should be listed as key-value pairs within the 'scipy_options' dictionary, and there should not be a nested dictionary called options. Some of the methods have different parameters, so please check the parameters for the method you wish to use, e.g., for method = ‘highs-ipm’. Also, note that the ‘integrality’ and ‘bounds’ options should never be specified within 'scipy_options' and should instead be specified using CVXPY.

  • The main advantage of this solver is its ability to use the HiGHS LP and MIP solvers, which are coded in C++. However, these require versions of SciPy larger than 1.6.1 and 1.9.0, respectively. To use the HiGHS LP solvers, simply set the method parameter to ‘highs-ds’ (for dual-simplex), ‘highs-ipm’ (for interior-point method) or ‘highs’ (which will choose either ‘highs-ds’ or ‘highs-ipm’ for you). To use the HiGHS MIP solver, leave the method parameter unspecified or set it explicitly to ‘highs’.

PDLP options:


Time limit for the solve, in seconds.


A ortools.pdlp.solvers_pb2.PrimalDualHybridGradientParams protocol buffer message. For the definition of PrimalDualHybridGradientParams, see here.

GUROBI options:

Gurobi solver options are specified in CVXPY as keyword arguments. The full list of Gurobi parameters with defaults is listed here.

In addition to Gurobi’s parameters, the following options are available:


Allows for the passage of a Gurobi Environment, which specifies parameters and license information. Keyword arguments will override any settings in this environment.


A boolean. This is only relevant for problems where GUROBI initially produces an “infeasible or unbounded” status. Its default value is False. If set to True, then if GUROBI produces an “infeasible or unbounded” status, its algorithm parameters are automatically changed and the problem is re-solved in order to determine its precise status.

CLARABEL options:


maximum number of iterations (default: 50).


time limit in seconds (default: 0.0, giving no limit).

For others see CLARABEL documentation.

XPRESS options:


Whether (and how many) Irreduceable Infeasible Subsystems (IISs) should be saved in the event a problem is found to be infeasible. If 0 (default), no IIS is saved; if negative, all IISs are stored; if a positive 'k>0', at most 'k' IISs are saved.


Filename (with extension '.mps') in which Xpress will save the quadratic or conic problem.


Time limit in seconds (must be integer).

All controls of the Xpress Optimizer can be specified within the 'solve' command. For all controls see FICO Xpress Optimizer manual.

PIQP options:


solver backend [dense, sparse] (default: sparse).


maximum number of iterations (default: 250).


absolute accuracy (default: 1e-8).


relative accuracy (default: 1e-9).

For others see PIQP documentation.

Custom Solvers

Although cvxpy supports many different solvers out of the box, it is also possible to define and use custom solvers. This can be helpful in prototyping or developing custom solvers tailored to a specific application.

To do so, you have to implement a solver class that is a child of cvxpy.reductions.solvers.qp_solvers.qp_solver.QpSolver or cvxpy.reductions.solvers.conic_solvers.conic_solver.ConicSolver. Then you pass an instance of this solver class to solver.solve(.) as following:

import cvxpy as cp
from cvxpy.reductions.solvers.qp_solvers.osqp_qpif import OSQP


    def name(self):
        return "CUSTOM_OSQP"

    def solve_via_data(self, *args, **kwargs):
        print("Solving with a custom QP solver!")
        super().solve_via_data(*args, **kwargs)

x = cp.Variable()
quadratic = cp.square(x)
problem = cp.Problem(cp.Minimize(quadratic))

You might also want to override the methods invert and import_solver of the Solver class.

Note that the string returned by the name property should be different to all of the officially supported solvers (a list of which can be found in cvxpy.settings.SOLVERS). Also, if your solver is mixed integer capable, you should set the class variable MIP_CAPABLE to True. If your solver is both mixed integer capable and a conic solver (as opposed to a QP solver), you should set the class variable MI_SUPPORTED_CONSTRAINTS to the list of cones supported when solving mixed integer problems. Usually MI_SUPPORTED_CONSTRAINTS will be the same as the class variable SUPPORTED_CONSTRAINTS.