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("anqif/CVXR")

Tutorial

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

Copy Link

Version

Install

install.packages('CVXR')

Monthly Downloads

35,592

Version

0.99-2

License

Apache License 2.0 | file LICENSE

Maintainer

Anqi Fu

Last Published

November 6th, 2018

Functions in CVXR (0.99-2)

Abs-class

The Abs class.
+,Expression,missing-method

The AddExpression class.
DiagMat-class

The DiagMat class.
DiagVec-class

The DiagVec class.
Huber-class

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

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

The Index class.
Log1p-class

The Log1p class.
LogDet-class

The LogDet class.
BinaryOperator-class

The BinaryOperator class.
Exp-class

The Exp class.
Minimize-class

The Minimize class.
Bool-class

The Bool class.
/,Expression,Expression-method

The DivExpression class.
KLDiv-class

The KLDiv class.
ECOS-class

The ECOS class.
MulElemwise-class

The MulElemwise class.
Kron-class

The Kron class.
NormNuc-class

The NormNuc class.
Objective-arith

Arithmetic Operations on Objectives
status_map,SCS-method

SCS Status Map
BoolConstr-class

The BoolConstr class.
GLPK-class

The GLPK class
SDP-class

The SDP class.
status_map,GLPK-method

GLPK Status Map
MOSEK-class

The MOSEK class.
status_map,MOSEK-method

MOSEK Status Map
GeoMean-class

The GeoMean class.
HStack-class

The HStack class.
CVXR-package

CVXR: Disciplined Convex Optimization in R
Constraint-class

The Constraint class.
Constant-class

The Constant class.
SolverStats-class

The SolverStats class.
Sqrt-class

The Sqrt class.
Elementwise-class

The Elementwise class.
QuadOverLin-class

The QuadOverLin class.
Entr-class

The Entr class.
RMulExpression-class

The RMulExpression class.
AffAtom-class

The AffAtom class.
Int-class

The Int class.
IntConstr-class

The IntConstr class.
LogSumExp-class

The LogSumExp class.
AffineProd-class

The AffineProd class.
Solver-capable

Solver Capabilities
Conv-class

The Conv class.
Atom-class

The Atom class.
Solver.choose_solver

Choose a Solver
SumLargest-class

The SumLargest class.
Transpose-class

The Transpose class.
UnaryOperator-class

The UnaryOperator class.
canonicalize

Canonicalize
cdiac

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

Curvature of Composition
LambdaMax-class

The LambdaMax class.
Symmetric

Symmetric Variable
Logistic-class

The Logistic class.
AxisAtom-class

The AxisAtom class.
Leaf-class

The Leaf class.
curvature-methods

Curvature Properties
cumsum_axis

Cumulative Sum
curvature-atom

Curvature of an Atom
.ProblemData__get_const_to_row

Get the const_to_row field of the ProblemData Object
curvature

Curvature of Expression
cvxr_norm

Matrix Norm (Alternative)
.LinOp__get_dense_data

Get the field dense_data for the LinOp object
CallbackParam-class

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

The MulExpression class.
expression-parts

Parts of an Expression
.ProblemData__get_const_vec

Get the const_vec field from the ProblemData Object
Canonical-class

The Canonical class.
CumSum-class

The CumSum class.
MatrixFrac-class

The MatrixFrac class.
.LinOp__get_id

Get the id field of the LinOp Object
-,Expression,missing-method

The NegExpression class.
MaxElemwise-class

The MaxElemwise class.
format_constr

Format Constraints
%>>%

The PSDConstraint class.
status_map,ECOS-method

ECOS Status Map
ExpCone-class

The ExpCone class.
NonNegative-class

The NonNegative class.
ECOS_BB-class

The ECOS_BB class.
get_sp

Get scipy handle
NonlinearConstraint-class

The NonlinearConstraint class.
.LinOp__size_push_back

Perform a push back operation on the size field of LinOp
grad

Sub/Super-Gradient
.LinOp__slice_push_back

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

Set the const_vec field in the ProblemData Object
Expression-class

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

The LeqConstraint class.
Parameter-class

The Parameter class.
Log-class

The Log class.
GUROBI-class

The GUROBI class.
SOC-class

The SOC class.
MaxEntries-class

The MaxEntries class.
Reshape-class

The Reshape class.
.ProblemData__set_id_to_col

Set the id_to_col field of the ProblemData Object
SCS-class

The SCS class.
matrix_frac

Matrix Fraction
SOCAxis-class

The SOCAxis class.
SigmaMax-class

The SigmaMax class.
exp,Expression-method

Natural Exponential
entr

Entropy Function
SizeMetrics-class

The SizeMetrics class.
status_map,GUROBI-method

GUROBI Status Map
LPSOLVE-class

The LPSOLVE class
Square-class

The Square class.
SymmetricUpperTri-class

The SymmetricUpperTri class.
status_map,LPSOLVE-method

LPSOLVE Status Map
Pnorm-class

The Pnorm class.
matrix_trace

Matrix Trace
Maximize-class

The Maximize class.
max_elemwise

Elementwise Maximum
get_id

Get ID
id

Identification Number
get_mosekglue

Get our mosekglue handle
import_solver

Import Solver
Trace-class

The Trace class.
lambda_sum_largest

Sum of Largest Eigenvalues
max_entries

Maximum
affine_prod

Affine Product
Power-class

The Power class.
Problem-arith

Arithmetic Operations on Problems
SumEntries-class

The SumEntries class.
Semidef

Positive Semidefinite Variable
bmat

Block Matrix
diag,Expression-method

Matrix Diagonal
SemidefUpperTri-class

The SemidefUpperTri class.
Variable-class

The Variable class.
diff,Expression-method

Lagged and Iterated Differences
abs,Expression-method

Absolute Value
lambda_sum_smallest

Sum of Smallest Eigenvalues
.LinOp__get_type

Get the field named type for the LinOp object
cone-methods

Second-Order Cone Methods
^,Expression,numeric-method

Elementwise Power
Problem-class

The Problem class.
conv

Discrete Convolution
.LinOp__new

Create a new LinOp object.
problem-parts

Parts of a Problem
.LinOp__set_slice

Set the slice field of the LinOp Object
quad_over_lin

Quadratic over Linear
.LinOpVector__push_back

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

Perform a push back operation on the args field of LinOp
Rdict-class

The Rdict class.
Rdictdefault-class

The Rdictdefault class.
resetOptions

Reset Options
Solver-class

The Solver class.
Solver.solve

Call to Solver
.LinOp__get_sparse

Get the sparse flag field for the LinOp object
.LinOp__get_size

Get the field size for the LinOp object
.LinOp__get_sparse_data

Get the field named sparse_data from the LinOp object
UpperTri-class

The UpperTri class.
.ProblemData__get_J

Get the J field of the ProblemData Object
size_from_args

Atom Size
sqrt,Expression-method

Square Root
p_norm

P-Norm
.LinOp__set_sparse

Set the flag sparse of the LinOp object
.LinOp__get_slice

Get the slice field of the LinOp Object
pos

Elementwise Positive
.LinOp__set_sparse_data

Set the field named sparse_data of the LinOp object
.ProblemData__get_V

Get the V field of the ProblemData Object
.ProblemData__set_V

Set the V field in the ProblemData Object
.ProblemData__set_const_to_row

Set the const_to_row map of the ProblemData Object
.LinOp__set_type

Set the field named type for the LinOp object
format_results

Format Solver Results
.ProblemData__get_id_to_col

Get the id_to_col field of the ProblemData Object
dspop

Direct Standardization: Population
dssamp

Direct Standardization: Sample
.ProblemData__new

Create a new ProblemData object.
hstack

Horizontal Concatenation
scalene

Scalene Function
geo_mean

Geometric Mean
VStack-class

The VStack class.
setIdCounter

Set ID Counter
get_np

Get numpy handle
huber

Huber Function
get_problem_data

Get Problem Data
domain

Domain
log_sum_exp

Log-Sum-Exponential
.LinOpVector__new

Create a new LinOpVector object.
logistic

Logistic Function
*,Expression,Expression-method

Elementwise Multiplication
.LinOp__set_dense_data

Set the field dense_data of the LinOp object
graph_implementation

Graph Implementation
name

Variable, Parameter, or Expression Name
harmonic_mean

Harmonic Mean
size-methods

Size Properties
is_dcp

DCP Compliance
square

Square Function
sum_entries

Sum of Entries
.LinOp__set_size

Set the field size of the LinOp object
validate_args

Validate Arguments
.LinOp_at_index

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

Validate Solver
.ProblemData__get_I

Get the I field of the ProblemData Object
size

Size of Expression
validate_val

Validate Value
is_qp

Is Problem a QP?
min_entries

Minimum
norm_nuc

Nuclear Norm
mixed_norm

Mixed Norm
norm_inf

Infinity-Norm
sign,Expression-method

Sign of Expression
value-methods

Get or Set Value
sign_from_args

Atom Sign
unpack_results

Parse output from a solver and updates problem state
installed_solvers

Installed Solvers
upper_tri

Upper Triangle of a Matrix
.ProblemData__set_I

Set the I field in the ProblemData Object
inv_pos

Reciprocal Function
log,Expression-method

Logarithms
log_det

Log-Determinant
mean.Expression

Arithmetic Mean
min_elemwise

Elementwise Minimum
psolve

Solve a DCP Problem
quad_form

Quadratic Form
.ProblemData__set_J

Set the J field in the ProblemData Object
.build_matrix_0

Get the sparse flag field for the LinOp object
.build_matrix_1

Get the sparse flag field for the LinOp object
sigma_max

Maximum Singular Value
sign-methods

Sign Properties
sum_largest

Sum of Largest Values
get_data

Get Expression Data
sum_smallest

Sum of Smallest Values
t.Expression

Matrix Transpose
get_gurobiglue

Get our gurobiglue handle
kl_div

Kullback-Leibler Divergence
tv

Total Variation
kronecker,Expression,ANY-method

Kronecker Product
lambda_max

Maximum Eigenvalue
lambda_min

Minimum Eigenvalue
neg

Elementwise Negative
norm,Expression,character-method

Matrix Norm
norm1

1-Norm
norm2

Euclidean Norm
reshape_expr

Reshape an Expression
residual-methods

Constraint Residual
sum_squares

Sum of Squares
to_numeric

Numeric Value of Atom
vec

Vectorization of a Matrix
vstack

Vertical Concatenation