Learn R Programming

⚠️There's a newer version (1.0-14) of this package.Take me there.

CVXR

CVXR 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 includes several open source solvers in addition to the default ECOS and SCS. Recent versions (0.97+) also include support for commercial solvers such as MOSEK and GUROBI.

Installation

This package is now released on CRAN, so you can install the current released version as you would any other package for R, version 3.4 and higher. (CVXR is known to work with earlier versions of R too, but we don’t check our releases against older versions of R.)

install.packages('CVXR', repos = "https://CRAN.R-project.org")

Development versions can be installed from the Github repository assuming you have the development tools for R available, including the C compilers etc. Execute:

library(devtools)
install_github("cvxgrp/CVXR")

Tutorial

A number of tutorial examples are available on the CVXR website.

Copy Link

Version

Install

install.packages('CVXR')

Monthly Downloads

9,969

Version

0.99-7

License

Apache License 2.0 | file LICENSE

Maintainer

Anqi Fu

Last Published

November 7th, 2019

Functions in CVXR (0.99-7)

Abs-class

The Abs class.
CVXR-package

CVXR: Disciplined Convex Optimization in R
BoolConstr-class

The BoolConstr class.
Constraint-class

The Constraint class.
Constant-class

The Constant class.
AffAtom-class

The AffAtom class.
GLPK-class

The GLPK class
Atom-class

The Atom class.
AxisAtom-class

The AxisAtom class.
HStack-class

The HStack class.
GeoMean-class

The GeoMean class.
status_map,GLPK-method

GLPK Status Map
LogSumExp-class

The LogSumExp class.
+,Expression,missing-method

The AddExpression class.
/,Expression,Expression-method

The DivExpression class.
ECOS-class

The ECOS class.
AffineProd-class

The AffineProd class.
==,Expression,Expression-method

The EqConstraint class.
CallbackParam-class

The CallbackParam class.
DiagMat-class

The DiagMat class.
BinaryOperator-class

The BinaryOperator class.
Bool-class

The Bool class.
MOSEK-class

The MOSEK class.
Logistic-class

The Logistic class.
Exp-class

The Exp class.
KLDiv-class

The KLDiv class.
status_map,MOSEK-method

MOSEK Status Map
Conv-class

The Conv class.
Canonical-class

The Canonical class.
DiagVec-class

The DiagVec class.
status_map,GUROBI-method

GUROBI Status Map
Log1p-class

The Log1p class.
GUROBI-class

The GUROBI class.
Kron-class

The Kron class.
<=,Expression,Expression-method

The LeqConstraint class.
LogDet-class

The LogDet class.
Minimize-class

The Minimize class.
ExpCone-class

The ExpCone class.
Huber-class

The Huber class.
Expression-class

The Expression class.
CumSum-class

The CumSum class.
[,Expression,missing,missing,ANY-method

The Index class.
MulElemwise-class

The MulElemwise class.
Pnorm-class

The Pnorm class.
Power-class

The Power class.
status_map,SCS-method

SCS Status Map
SDP-class

The SDP class.
Leaf-class

The Leaf class.
ECOS_BB-class

The ECOS_BB class.
LambdaMax-class

The LambdaMax class.
status_map,ECOS-method

ECOS Status Map
Problem-arith

Arithmetic Operations on Problems
Problem-class

The Problem class.
MaxEntries-class

The MaxEntries class.
Maximize-class

The Maximize class.
Log-class

The Log class.
SigmaMax-class

The SigmaMax class.
NormNuc-class

The NormNuc class.
Objective-arith

Arithmetic Operations on Objectives
SizeMetrics-class

The SizeMetrics class.
abs,Expression-method

Absolute Value
Reshape-class

The Reshape class.
Variable-class

The Variable class.
curvature-comp

Curvature of Composition
SCS-class

The SCS class.
SolverStats-class

The SolverStats class.
MatrixFrac-class

The MatrixFrac class.
Sqrt-class

The Sqrt class.
SymmetricUpperTri-class

The SymmetricUpperTri class.
Solver.solve

Call to Solver
Rdict-class

The Rdict class.
UnaryOperator-class

The UnaryOperator class.
Transpose-class

The Transpose class.
Solver-class

The Solver class.
Rdictdefault-class

The Rdictdefault class.
Trace-class

The Trace class.
Elementwise-class

The Elementwise class.
NonNegative-class

The NonNegative class.
NonlinearConstraint-class

The NonlinearConstraint class.
Entr-class

The Entr class.
IntConstr-class

The IntConstr class.
status_map,LPSOLVE-method

LPSOLVE Status Map
-,Expression,missing-method

The NegExpression class.
Int-class

The Int class.
%*%,Expression,Expression-method

The MulExpression class.
LPSOLVE-class

The LPSOLVE class
%>>%

The PSDConstraint class.
SOC-class

The SOC class.
cvxr_norm

Matrix Norm (Alternative)
curvature

Curvature of Expression
.ProblemData__set_const_to_row

Set the const_to_row map of the ProblemData Object
.LinOp__get_slice

Get the slice field of the LinOp Object
.LinOp__set_type

Set the field named type for the LinOp object
.LinOp__set_sparse_data

Set the field named sparse_data of the LinOp object
.ProblemData__set_V

Set the V field in the ProblemData Object
SOCAxis-class

The SOCAxis class.
.LinOp__get_size

Get the field size for the LinOp object
cone-methods

Second-Order Cone Methods
get_np

Get numpy handle
canonicalize

Canonicalize
UpperTri-class

The UpperTri class.
Solver.choose_solver

Choose a Solver
MaxElemwise-class

The MaxElemwise class.
VStack-class

The VStack class.
Solver-capable

Solver Capabilities
Semidef

Positive Semidefinite Variable
SemidefUpperTri-class

The SemidefUpperTri class.
Parameter-class

The Parameter class.
diag,Expression-method

Matrix Diagonal
QuadOverLin-class

The QuadOverLin class.
conv

Discrete Convolution
.LinOpVector__push_back

Perform a push back operation on the args field of LinOp
cdiac

Global Monthly and Annual Temperature Anomalies (degrees C), 1850-2015 (Relative to the 1961-1990 Mean) (May 2016)
SumLargest-class

The SumLargest class.
.LinOp__args_push_back

Perform a push back operation on the args field of LinOp
.LinOp__get_dense_data

Get the field dense_data for the LinOp object
.LinOp__get_id

Get the id field of the LinOp Object
affine_prod

Affine Product
Symmetric

Symmetric Variable
domain

Domain
bmat

Block Matrix
diff,Expression-method

Lagged and Iterated Differences
RMulExpression-class

The RMulExpression class.
.LinOpVector__new

Create a new LinOpVector object.
.LinOp__set_sparse

Set the flag sparse of the LinOp object
.LinOp__slice_push_back

Perform a push back operation on the slice field of LinOp
.LinOp__set_slice

Set the slice field of the LinOp Object
expression-parts

Parts of an Expression
.LinOp__size_push_back

Perform a push back operation on the size field of LinOp
Square-class

The Square class.
.build_matrix_1

Get the sparse flag field for the LinOp object
.build_matrix_0

Get the sparse flag field for the LinOp object
.LinOp__get_type

Get the field named type for the LinOp object
.ProblemData__set_id_to_col

Set the id_to_col field of the ProblemData Object
.ProblemData__set_const_vec

Set the const_vec field in the ProblemData Object
curvature-methods

Curvature Properties
graph_implementation

Graph Implementation
.LinOp__new

Create a new LinOp object.
.ProblemData__get_id_to_col

Get the id_to_col field of the ProblemData Object
get_problem_data

Get Problem Data
SumEntries-class

The SumEntries class.
matrix_frac

Matrix Fraction
get_sp

Get scipy handle
hstack

Horizontal Concatenation
mean.Expression

Arithmetic Mean
format_constr

Format Constraints
huber

Huber Function
grad

Sub/Super-Gradient
matrix_trace

Matrix Trace
min_elemwise

Elementwise Minimum
cumsum_axis

Cumulative Sum
id

Identification Number
sign_from_args

Atom Sign
pos

Elementwise Positive
to_numeric

Numeric Value of Atom
sum_squares

Sum of Squares
p_norm

P-Norm
harmonic_mean

Harmonic Mean
installed_solvers

Installed Solvers
unpack_results

Parse output from a solver and updates problem state
sign,Expression-method

Sign of Expression
upper_tri

Upper Triangle of a Matrix
inv_pos

Reciprocal Function
curvature-atom

Curvature of an Atom
.LinOp__get_sparse

Get the sparse flag field for the LinOp object
.ProblemData__get_V

Get the V field of the ProblemData Object
.ProblemData__get_J

Get the J field of the ProblemData Object
.ProblemData__get_const_to_row

Get the const_to_row field of the ProblemData Object
.LinOp__get_sparse_data

Get the field named sparse_data from the LinOp object
neg

Elementwise Negative
.ProblemData__get_const_vec

Get the const_vec field from the ProblemData Object
import_solver

Import Solver
.ProblemData__new

Create a new ProblemData object.
lambda_sum_largest

Sum of Largest Eigenvalues
dspop

Direct Standardization: Population
dssamp

Direct Standardization: Sample
norm,Expression,character-method

Matrix Norm
^,Expression,numeric-method

Elementwise Power
validate_args

Validate Arguments
sum_largest

Sum of Largest Values
sum_smallest

Sum of Smallest Values
.LinOp__set_dense_data

Set the field dense_data of the LinOp object
validate_solver

Validate Solver
problem-parts

Parts of a Problem
is_dcp

DCP Compliance
is_qp

Is Problem a QP?
format_results

Format Solver Results
geo_mean

Geometric Mean
max_elemwise

Elementwise Maximum
norm2

Euclidean Norm
norm1

1-Norm
lambda_max

Maximum Eigenvalue
get_data

Get Expression Data
max_entries

Maximum
lambda_min

Minimum Eigenvalue
lambda_sum_smallest

Sum of Smallest Eigenvalues
sigma_max

Maximum Singular Value
.LinOp__set_size

Set the field size of the LinOp object
get_gurobiglue

Get our gurobiglue handle
kronecker,Expression,ANY-method

Kronecker Product
kl_div

Kullback-Leibler Divergence
log_det

Log-Determinant
log,Expression-method

Logarithms
.LinOp_at_index

Return the LinOp element at index i (0-based)
size_from_args

Atom Size
sign-methods

Sign Properties
quad_over_lin

Quadratic over Linear
quad_form

Quadratic Form
name

Variable, Parameter, or Expression Name
.ProblemData__get_I

Get the I field of the ProblemData Object
psolve

Solve a DCP Problem
*,Expression,Expression-method

Elementwise Multiplication
reshape_expr

Reshape an Expression
.ProblemData__set_I

Set the I field in the ProblemData Object
validate_val

Validate Value
residual-methods

Constraint Residual
value-methods

Get or Set Value
square

Square Function
resetOptions

Reset Options
t.Expression

Matrix Transpose
tv

Total Variation
sqrt,Expression-method

Square Root
sum_entries

Sum of Entries
vstack

Vertical Concatenation
vec

Vectorization of a Matrix
.ProblemData__set_J

Set the J field in the ProblemData Object
entr

Entropy Function
exp,Expression-method

Natural Exponential
get_mosekglue

Get our mosekglue handle
get_id

Get ID
log_sum_exp

Log-Sum-Exponential
logistic

Logistic Function
min_entries

Minimum
mixed_norm

Mixed Norm
norm_inf

Infinity-Norm
norm_nuc

Nuclear Norm
setIdCounter

Set ID Counter
scalene

Scalene Function
size

Size of Expression
size-methods

Size Properties