Convex Optimization in R

What is CVXR?

CVXR is an R package that provides an object-oriented modeling language for convex optimization, similar to CVX, CVXPY, YALMIP, and Convex.jl. It allows the user to formulate convex optimization problems in a natural mathematical syntax rather than the restrictive standard form required by most solvers. The user specifies an objective and set of constraints by combining constants, variables, and parameters using a library of functions with known mathematical properties. CVXR then applies signed disciplined convex programming (DCP) to verify the problem’s convexity. Once verified, the problem is converted into standard conic form using graph implementations and passed to a cone solver such as ECOS or SCS.

CVXR paper

A preliminary draft our paper is available here.


Although CVXR continues to be developed on Github, the current release implements all of the CVXPY atoms except for geo_mean and parameters. The latter is not an impediment since any parameter can be replaced by a variable.

The focus of the development is mostly on speeding up the canonicalization and construction of problem data in CVXR.

Installing CVXR

CVXR is installed like any other R package from CRAN.


A video of the talk by Anqi Fu at useR! 2016 provides a good overview.

An introductory vignette is installed with the package and can be viewed using vignette("cvxr_intro", package = "CVXR").

A large set of examples, many ported from CVXPY, are available on this site in the Examples section.

Citing CVXR

If you use CVXR in your work, please consider citing the paper by Fu, Narasimhan, and Boyd (2017) below.


We are grateful to Steven Diamond, John Miller, and Paul Kunsberg Rosenfield for their contributions to the software’s development. In particular, we are indebted to Steven Diamond for his work on CVXPY. Most of CVXR’s code, documentation, and examples were ported from his Python library.

About this site

Much of the documentation on this site was modified from CVXPY in a semi-automated way.

This site was constructed using R markdown documents, the wonderful blogdown package by Yihui Xie, and the Hugo Alabaster theme. The pages are served out of the CVXR docs repository.


Fu, Anqi, Balasubramanian Narasimhan, and Stephen Boyd. 2017. “CVXR: An R Package for Disciplined Convex Optimization.” Working Paper.