Using Other Solvers

Author

Anqi Fu and Balasubramanian Narasimhan

Introduction

CVXR supports 13 solvers, including several bundled open source solvers and optional commercial ones.

Open Source Solvers (on CRAN)

  • Clarabel, a versatile conic solver written in Rust (default solver).
  • SCS, a conic solver using operator splitting, effective for large-scale problems.
  • OSQP, for quadratic and linear programs.
  • HiGHS, for linear, quadratic, and mixed-integer programs.
  • ECOS / ECOS_BB, an interior-point solver for second-order cone programs (ECOS_BB adds mixed-integer support).
  • GLPK / GLPK_MI, for linear programs and mixed-integer linear programs.
  • CVXOPT, for linear and second-order cone programs.
  • PIQP, a proximal interior-point solver for quadratic programs.

Commercial Solvers

  • MOSEK, supporting LP, QP, SOCP, SDP, and exponential/power cone programs. Free academic licenses available.
  • Gurobi, supporting LP, QP, SOCP, and mixed-integer programs. Free academic licenses available.
  • CPLEX, supporting LP, QP, and mixed-integer programs.

Solver Capabilities

The table below shows each solver, its R package dependency, and the problem classes it supports.

Solver Capabilities
Solver R Package LP QP SOCP SDP EXP MIP
CLARABEL clarabel
SCS scs
MOSEK Rmosek
ECOS ECOSolveR
ECOS_BB ECOSolveR
GUROBI gurobi
GLPK Rglpk
GLPK_MI Rglpk
HIGHS highs
CVXOPT cccp
OSQP osqp
CPLEX Rcplex
PIQP piqp

Installing Commercial Solvers

MOSEK

MOSEK provides an academic version that is free of charge: one can obtain the free academic license after registering. Once the license for the product has been activated, the Rmosek documentation provides all the details for installation. A quick check to ensure things are working is to run the example:

library(Rmosek)
example(mosek)

Gurobi

Gurobi offers free academic licenses. After installing Gurobi and the gurobi R package (bundled with the Gurobi installation), verify with:

library(gurobi)
model <- list(A = matrix(c(1, 1), nrow = 1),
              obj = c(1, 1), sense = "<=", rhs = 1)
gurobi(model)

CPLEX

IBM CPLEX is available through IBM’s academic initiative. Install the Rcplex package from CRAN after installing the CPLEX library.

Once a commercial solver is installed, you can use it by passing solver = "MOSEK", solver = "GUROBI", or solver = "CPLEX" to psolve().

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 CVXR_1.8.0.9207 

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

References