Dealing with Solver-Specific Parameters

Author

Anqi Fu, David Kang and Balasubramanian Narasimhan

Overview

CVXR features five standard parameters that can be passed to the psolve function. Here are the five parameters:

  • verbose : A parameter that deals with the verbosity of the solver. It is a boolean variable for all solvers, but it can also take integer values for the MOSEK solver, whose interface deals with an integer verbosity parameter with the default of 10. The default value of verbose for CVXR is set to FALSE.

  • reltol : Deals with the relative tolerance of the solver.

  • abstol : Deals with the absolute tolerance of the solver.

  • feastol : Deals with feasible tolerance of the solver.

  • num_iter : A parameter that specifies the maximum number of iterations for the solver.

These standard parameters are automatically translated to solver-specific parameter names by psolve(). You can also pass solver-specific parameters directly via .... If both a standard parameter and its solver-native equivalent are given, the solver-native name in ... takes priority.

The mapping table is available as SOLVER_DEFAULT_PARAM.

Solver-Specific Parameters

We will go over some examples for each solver supported by CVXR, the available parameters for each solver, and where to find the documentation for each solver.

CLARABEL

The parameters available for CLARABEL can be found in this link.

Default CVXR-CLARABEL parameter mappings
Standard CLARABEL Value
verbose verbose FALSE
reltol tol_gap_rel 1e-08
abstol tol_gap_abs 1e-08
feastol tol_feas 1e-08
num_iter max_iter 200

The parameters can be entered individually in the arguments of the psolve function. You can use either standard names or solver-specific names:

x <- Variable(1)
obj <- Minimize(x)
prob <- Problem(obj, list(x >= 0))

# Using standard parameter names
result  <- psolve(prob, solver = "CLARABEL", feastol = 1e-2, verbose = FALSE)
check_solver_status(prob)

# Using solver-specific parameter names (equivalent)
result  <- psolve(prob, solver = "CLARABEL", tol_feas = 1e-2, verbose = FALSE)
check_solver_status(prob)

OSQP

The parameters available for OSQP can be found in this link.

Default CVXR-OSQP parameter mappings
Standard OSQP Value
verbose verbose FALSE
reltol eps_rel 1e-05
abstol eps_abs 1e-05
feastol eps_prim_inf 1e-04
num_iter max_iter 10000
x <- Variable(1)
obj <- Minimize(x)
prob <- Problem(obj, list(x >= 0))

# Using standard parameter name
result  <- psolve(prob, solver = "OSQP", feastol = 1e-5, verbose = FALSE)
check_solver_status(prob)

# Using solver-specific parameter name (equivalent)
result  <- psolve(prob, solver = "OSQP", eps_prim_inf = 1e-5, verbose = FALSE)
check_solver_status(prob)

SCS

The parameters available for SCS can be found in this link under the scs_control function.

Default CVXR-SCS parameter mappings
Standard SCS Value
verbose verbose FALSE
reltol eps_rel 1e-05
abstol eps_abs 1e-05
feastol NA NA
num_iter max_iters 2500

Note that SCS does not support a feastol parameter — only verbose, reltol, abstol, and num_iter map to standard names. Additional solver-specific parameters (like scale) can be passed directly.

set.seed(1)
n <- 3
p <- 3
C <- matrix(rnorm(n^2), ncol = n)
A <- lapply(1:p, function(i) matrix(rnorm(n^2), nrow = n))
b <- rnorm(p)

X <- Variable(c(n, n), symmetric = TRUE)
trace_constraints <- lapply(1:p, function(i) matrix_trace(A[[i]] %*% X) == b[i])

obj <- Minimize(matrix_trace(C %*% X))
prob <- Problem(obj, c(list(X >= 0), trace_constraints))
result  <- psolve(prob, solver = "SCS", verbose = FALSE, num_iter = 5000)
check_solver_status(prob)

HiGHS

The HiGHS solver is used for linear and mixed-integer programs. The parameters available for HiGHS can be found in this link.

Default CVXR-HiGHS parameter mappings
Standard HIGHS Value
verbose output_flag FALSE
reltol NA NA
abstol NA NA
feastol NA NA
num_iter simplex_iteration_limit 2147483647
x <- Variable(1)
obj <- Minimize(x)
prob <- Problem(obj, list(x >= 0))
result  <- psolve(prob, solver = "HIGHS", verbose = FALSE)
check_solver_status(prob)

MOSEK

Default CVXR-MOSEK parameter mappings
Standard MOSEK Value
verbose verbose 0
reltol NA NA
abstol NA NA
feastol NA NA
num_iter num_iter 10000

The parameters available for MOSEK can be seen in this link. As you can see, the number of parameters is quite massive. They are also split between three types of parameters in Double, Integer, and String parameters. To pass these into the solver, they must be put in a list beforehand. Moreover, there are also general solver parameters. Here is an example:

x <- Variable(1)
obj <- Minimize(x)
prob <- Problem(obj, list(x >= 0))
iparam <- list()
iparam$AUTO_UPDATE_SOL_INFO <- "OFF"
iparam$BI_IGNORE_NUM_ERROR <- "OFF"
iparam$BI_MAX_ITERATIONS <- 100000

dparam <- list()
dparam$BASIS_REL_TOL_S <- 1.0e-12
dparam$BASIS_TOL_S <- 1.0e-6

result  <- psolve(prob, solver = "MOSEK", verbose = FALSE, dparam = dparam, iparam = iparam)

Note: MOSEK requires a license (free academic licenses are available).

Gurobi

Default CVXR-Gurobi parameter mappings
Standard GUROBI Value
verbose verbose FALSE
reltol NA NA
abstol NA NA
feastol FeasibilityTol 1e-06
num_iter IterationLimit 10000

Gurobi parameters are documented at https://www.gurobi.com/documentation/.

x <- Variable(1)
obj <- Minimize(x)
prob <- Problem(obj, list(x >= 0))
result  <- psolve(prob, solver = "GUROBI", feastol = 1e-4, verbose = FALSE)

Note: Gurobi requires a license (free academic licenses are available).

GLPK / GLPK_MI

Default CVXR-GLPK parameter mappings
Standard GLPK Value
verbose verbose FALSE
reltol NA NA
abstol NA NA
feastol NA NA
num_iter NA NA

GLPK and GLPK_MI have no standard parameter mappings. Solver-specific parameters can be passed directly via ....

ECOS

Default CVXR-ECOS parameter mappings
Standard ECOS Value
verbose verbose FALSE
reltol RELTOL 1e-08
abstol ABSTOL 1e-08
feastol FEASTOL 1e-08
num_iter MAXIT 100
x <- Variable(1)
obj <- Minimize(x)
prob <- Problem(obj, list(x >= 0))
result  <- psolve(prob, solver = "CLARABEL", feastol = 1e-6, verbose = FALSE)
check_solver_status(prob)

ECOS_BB

Default CVXR-ECOS_BB parameter mappings
Standard ECOS_BB Value
verbose verbose FALSE
reltol RELTOL 1e-03
abstol ABSTOL 1e-06
feastol FEASTOL 1e-06
num_iter MI_MAX_ITERS 1000

ECOS_BB is the mixed-integer extension of ECOS.

CPLEX

Default CVXR-CPLEX parameter mappings
Standard CPLEX Value
verbose verbose FALSE
reltol NA NA
abstol NA NA
feastol NA NA
num_iter itlim 10000

Note: CPLEX requires a license (free academic licenses are available).

Session Info

R version 4.5.2 (2025-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS Tahoe 26.3

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] kableExtra_1.4.0 tibble_3.3.1     CVXR_1.8.0.9207 

loaded via a namespace (and not attached):
 [1] Matrix_1.7-4       jsonlite_2.0.0     compiler_4.5.2     highs_1.12.0-3    
 [5] Rcpp_1.1.1         xml2_1.5.2         stringr_1.6.0      dichromat_2.0-0.1 
 [9] systemfonts_1.3.1  scales_1.4.0       textshaping_1.0.4  clarabel_0.11.2   
[13] yaml_2.3.12        fastmap_1.2.0      here_1.0.2         lattice_0.22-9    
[17] R6_2.6.1           knitr_1.51         backports_1.5.0    htmlwidgets_1.6.4 
[21] checkmate_2.3.4    osqp_1.0.0         rprojroot_2.1.1    svglite_2.2.2     
[25] pillar_1.11.1      RColorBrewer_1.1-3 rlang_1.1.7        stringi_1.8.7     
[29] xfun_0.56          S7_0.2.1           otel_0.2.0         viridisLite_0.4.3 
[33] cli_3.6.5          magrittr_2.0.4     digest_0.6.39      grid_4.5.2        
[37] rstudioapi_0.18.0  gmp_0.7-5.1        lifecycle_1.0.5    scs_3.2.7         
[41] vctrs_0.7.1        evaluate_1.0.5     glue_1.8.0         farver_2.1.2      
[45] rmarkdown_2.30     tools_4.5.2        pkgconfig_2.0.3    htmltools_0.5.9