What's new in 1.0?

CVXR 1.0 includes a major rewrite of the CVXR internals, as well as a number of changes to the user interface. The goal is to follow cvxpy as much as possible. We first give an overview of the changes, before diving into the details. We only cover changes that might be of interest to users.

Overview

  • Disciplined geometric programming (DGP): Starting with version 1.0, CVXR lets you formulate and solve log-log convex programs, which generalize both traditional geometric programs and generalized geometric programs. To get started with DGP, check out the tutorial and consult the accompanying paper.

  • Reductions: CVXR 1.0 uses a modular system of reductions to convert problems input by the user into the format required by the solver, which makes it easy to support new standard forms, such as quadratic programs, and more advanced user inputs, such as problems with complex variables. See the accompanying paper for further details.

  • Attributes: Variables and Parameters now support a variety of attributes that describe their symbolic properties, such as nonnegative or symmetric. This unifies the treatment of symbolic properties for variables and parameters and replaces specialized variable classes such as Bool and Semidef.

Reductions

A reduction is a transformation from one problem to an equivalent problem. Two problems are equivalent if a solution of one can be converted to a solution of the other with no more than a moderate amount of effort. CVXR uses reductions to rewrite problems into forms that solvers will accept. The practical benefit of the reduction based framework is that CVXR 1.0 supports quadratic programs as a target solver standard form in addition to cone programs, with more standard forms on the way. It also makes it easy to add generic problem transformations such as converting problems with complex variables into problems with only real variables.

Attributes

Attributes describe the symbolic properties of variables and parameters and are specified as arguments to the constructor. For example, Variable(nonneg=TRUE) creates a scalar variable constrained to be nonnegative. Attributes replace the previous syntax of special variable classes like Bool for boolean variables and Semidef for symmetric positive semidefinite variables, as well as specification of the sign for parameters (e.g., Parameter(sign=‘positive’)). Concretely, write

  • Variable(shape, boolean=TRUE) instead of Bool(shape).

  • Variable(shape, integer=TRUE) instead of Int(shape).

  • Variable(c(n, n), PSD=TRUE) instead of Semidef(n).

  • Variable(c(n, n), symmetric=TRUE) instead of Symmetric(n).

  • Variable(shape, nonneg=TRUE) instead of NonNegative(shape).

  • Parameter(shape, nonneg=TRUE) instead of Parameter(shape, sign='positive').

  • Parameter(shape, nonpos=TRUE) instead of Parameter(shape, sign='negative').

The full constructor of the Leaf class (the parent class of Variable and Parameter) is given below

Leaf <- setClass("Leaf", representation(dim = "NumORNULL", value = "ConstVal", nonneg = "logical", nonpos = "logical",
                                    complex = "logical", imag = "logical", symmetric = "logical", diag = "logical",
                                    PSD = "logical", NSD = "logical", hermitian = "logical", boolean = "NumORLogical", integer = "NumORLogical",
                                    sparsity = "matrix", pos = "logical", neg = "logical",
                                    attributes = "list", boolean_idx = "matrix", integer_idx = "matrix"), ...#more arguments)
  • Parameters
    • value (numeric type) - A value to assign to the variable.
    • nonneg (bool) – Is the variable constrained to be nonnegative?
    • nonpos (bool) – Is the variable constrained to be nonpositive?
    • complex (bool) – Is the variable complex valued?
    • imag (bool) – Is the variable purely imaginary?
    • symmetric (bool) – Is the variable constrained to be symmetric?
    • diag (bool) – Is the variable constrained to be diagonal?
    • PSD (bool) – Is the variable constrained to be symmetric positive semidefinite?
    • NSD (bool) – Is the variable constrained to be symmetric negative semidefinite?
    • hermitian (bool) – Is the variable constrained to be Hermitian?
    • boolean (bool or list of tuple) – Is the variable boolean (i.e., 0 or 1)? True, which constrains the entire variable to be boolean, False, or a list of indices which should be constrained as boolean, where each index is a tuple of length exactly equal to the length of shape.
    • integer (bool or list of tuple) – Is the variable integer? The semantics are the same as the boolean argument.
    • sparsity (matrix) A matrix representing the fixed sparsity pattern of the leaf.
    • pos (bool) Is the leaf strictly positive?
    • neg (bool) Is the leaf strictly negative?

Session Info

sessionInfo()
## R version 3.6.3 (2020-02-29)
## Platform: x86_64-apple-darwin19.3.0 (64-bit)
## Running under: macOS Catalina 10.15.4
## 
## Matrix products: default
## BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
## LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices datasets  utils     methods   base     
## 
## loaded via a namespace (and not attached):
##  [1] compiler_3.6.3  magrittr_1.5    bookdown_0.18   tools_3.6.3    
##  [5] htmltools_0.4.0 yaml_2.2.1      Rcpp_1.0.4.3    stringi_1.4.6  
##  [9] rmarkdown_2.1   blogdown_0.18   knitr_1.28      stringr_1.4.0  
## [13] digest_0.6.25   xfun_0.12       rlang_0.4.5     evaluate_0.14

Source

R Markdown

References