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 4.2.1 (2022-06-23)
## Platform: x86_64-apple-darwin21.6.0 (64-bit)
## Running under: macOS Ventura 13.0
## 
## Matrix products: default
## BLAS:   /usr/local/Cellar/openblas/0.3.21/lib/libopenblasp-r0.3.21.dylib
## LAPACK: /usr/local/Cellar/r/4.2.1_4/lib/R/lib/libRlapack.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] bookdown_0.29   digest_0.6.30   R6_2.5.1        jsonlite_1.8.3 
##  [5] magrittr_2.0.3  evaluate_0.17   blogdown_1.13   stringi_1.7.8  
##  [9] cachem_1.0.6    rlang_1.0.6     cli_3.4.1       jquerylib_0.1.4
## [13] bslib_0.4.0     rmarkdown_2.17  tools_4.2.1     stringr_1.4.1  
## [17] xfun_0.34       yaml_2.3.6      fastmap_1.1.0   compiler_4.2.1 
## [21] htmltools_0.5.3 knitr_1.40      sass_0.4.2

Source

R Markdown

References