Version: | 0.3-1 |
Date: | 2023-12-09 |
Title: | Cone Constrained Convex Problems |
Maintainer: | Bernhard Pfaff <bernhard@pfaffikus.de> |
Depends: | R (≥ 3.0.1), methods |
Suggests: | RUnit, numDeriv |
LazyLoad: | yes |
Description: | Routines for solving convex optimization problems with cone constraints by means of interior-point methods. The implemented algorithms are partially ported from CVXOPT, a Python module for convex optimization (see https://cvxopt.org for more information). |
Imports: | Rcpp (≥ 0.11.2) |
LinkingTo: | Rcpp, RcppArmadillo |
License: | GPL (≥ 3) |
RcppModules: | CPG |
NeedsCompilation: | yes |
Packaged: | 2023-12-09 17:18:24 UTC; bp |
Author: | Bernhard Pfaff [aut, cre], Lieven Vandenberghe [cph] (copyright holder of cvxopt), Martin Andersen [cph] (copyright holder of cvxopt), Joachim Dahl [cph] (copyright holder of cvxopt) |
Repository: | CRAN |
Date/Publication: | 2023-12-09 17:50:02 UTC |
Solving linear and quadratic programs with cone constraints
Description
This function is the main function for defining and solving convex problems in the form of either linear or quadratic programs with cone constraints.
Usage
cccp(P = NULL, q = NULL, A = NULL, b = NULL, cList = list(),
x0 = NULL, f0 = NULL, g0 = NULL, h0 = NULL,
nlfList = list(), nlgList = list(), nlhList = list(),
optctrl = ctrl())
Arguments
P |
An object of class |
q |
An object of class |
A |
An object of class |
b |
An object of class |
cList |
A |
x0 |
An object of class |
f0 |
|
g0 |
|
h0 |
|
nlfList |
A |
nlgList |
A |
nlhList |
A |
optctrl |
An object of S4-class |
Value
An object of class Rcpp_CPS
.
Class "CPD"
Description
Class union of Rcpp_DLP
, Rcpp_DQP
, Rcpp_DCP
and Rcpp_DNL
.
Objects from the Class
A virtual Class: No objects may be created from it.
Methods
No methods defined with class "CPD" in the signature.
Rcpp module: CPG
Description
Module for defining and solving convex programs.
Details
The module contains the following items: classes:
- CONEC
Class for inequality (cone) constraints.
- CTRL
Class for control parameters used in optimizations.
- PDV
Class for primal/dual variables.
- DCP
Class for definition of convex programs.
- DLP
Class for definition of linear programs.
- DNL
Class for definition of linear programs with non-linear constraints.
- DQP
Class for definition of quadratic programs.
- CPS
Class for solution of convex programs.
functions:
- rpp
Function for solving risk parity portfolios.
- gpp
Function for solving a geometric program.
Solving a convex program
Description
This function returns an optimal point for a cone constraint convex program.
Usage
## S4 method for signature 'Rcpp_DCP,Rcpp_CTRL'
cps(cpd, ctrl)
## S4 method for signature 'Rcpp_DLP,Rcpp_CTRL'
cps(cpd, ctrl)
## S4 method for signature 'Rcpp_DNL,Rcpp_CTRL'
cps(cpd, ctrl)
## S4 method for signature 'Rcpp_DQP,Rcpp_CTRL'
cps(cpd, ctrl)
Arguments
cpd |
An object belonging to the class union |
ctrl |
An object of reference-class |
Value
An object of reference-class Rcpp_CPS
.
Creating objects of reference-class CTRL
Description
This function creates an object of reference-class CTRL
which
contains optimization parameters, e.g. the maximum number of
iterations.
Usage
ctrl(maxiters = 100L, abstol = 1e-06, reltol = 1e-06,
feastol = 1e-06, stepadj = 0.95, beta = 0.5, trace = TRUE)
Arguments
maxiters |
|
abstol |
|
reltol |
|
feastol |
|
stepadj |
|
beta |
|
trace |
|
Value
An object of reference-class CTRL
.
Note
Either abstol
or reltol
can be set to a negative real
number. feastol
must be greater than zero.
See Also
Creating a member object of the reference-class DCP
Description
This function returns an object containing the definition of a convex
program with non-linear constraints and (if provided) cone
constraints.
The returned object is a member of the reference-class DCP
.
Usage
dcp(x0, f0, g0, h0, cList = list(), nlfList = list(), nlgList = list(),
nlhList = list(), A = NULL, b = NULL)
Arguments
x0 |
An object of class |
f0 |
|
g0 |
|
h0 |
|
cList |
A |
nlfList |
A |
nlgList |
A |
nlhList |
A |
A |
An object of class |
b |
An object of class |
Value
An object belonging to the reference-class DCP
.
Creating a member object of the reference-class DLP
Description
This function returns an object containing the definition of a cone
constrained linear program. The returned object is a member of the
reference-class DLP
.
Usage
dlp(q, A = NULL, b = NULL, cList = list())
Arguments
q |
An object of class |
A |
An object of class |
b |
An object of class |
cList |
A |
Value
An object belonging to the reference-class DLP
.
Creating a member object of the reference-class DNL
Description
This function returns an object containing the definition of a linear
program with non-linear constraints and (if provided) cone
constraints.
The returned object is a member of the reference-class DNL
.
Usage
dnl(q, A = NULL, b = NULL, cList = list(),
x0, nlfList = list(), nlgList = list(), nlhList = list())
Arguments
q |
|
A |
An object of class |
b |
An object of class |
cList |
A |
x0 |
An object of class |
nlfList |
A |
nlgList |
A |
nlhList |
A |
Value
An object belonging to the reference-class DNL
.
Creating a member object of the reference-class DQP
Description
This function returns an object containing the definition of a cone
constrained quadratic program. The returned object is a member of the
reference-class DQP
.
Usage
dqp(P, q, A = NULL, b = NULL, cList = list())
Arguments
P |
An object of class |
q |
An object of class |
A |
An object of class |
b |
An object of class |
cList |
A |
Value
An object belonging to the reference-class DQP
.
Extractor methods for reference class objects
Description
Returns a member of reference class objects.
Usage
## S4 method for signature 'Rcpp_PDV'
getx(object)
## S4 method for signature 'Rcpp_CPS'
getx(object)
## S4 method for signature 'Rcpp_PDV'
gety(object)
## S4 method for signature 'Rcpp_CPS'
gety(object)
## S4 method for signature 'Rcpp_PDV'
gets(object)
## S4 method for signature 'Rcpp_CPS'
gets(object)
## S4 method for signature 'Rcpp_PDV'
getz(object)
## S4 method for signature 'Rcpp_CPS'
getz(object)
## S4 method for signature 'Rcpp_CPS'
getstate(object)
## S4 method for signature 'Rcpp_CPS'
getstatus(object)
## S4 method for signature 'Rcpp_CPS'
getniter(object)
## S4 method for signature 'Rcpp_CTRL'
getparams(object)
Arguments
object |
An object of either reference-class |
Value
The relevant member object of the class.
Geometric program
Description
This function solves a geometric program.
Usage
gp(F0, g0, FList = list(), gList = list(), nno = NULL,
A = NULL, b = NULL, optctrl = ctrl())
Arguments
F0 |
Matrix in the objective function. |
g0 |
Matrix in the objective function (affine terms). |
FList |
List of matrices in posinomial functions. |
gList |
List of matrices in posinomial functions (affine terms). |
nno |
Object created by a call to |
A |
Lefthand-side matrix of equality constraints. |
b |
Lefthand-side matrix of equality constraints. |
optctrl |
Object of reference class ‘Rcpp_CTRL’, created
by a call to |
Details
Solves a geometric program casted in its epigraph form.
Value
An object of S4-class Rcpp_CPS
.
References
Boyd, S., Kim, S.-J., Vandenberghe, L. and A. Hassibi (2007), A tutorial on geometric programming, Optim Eng, Educational Section, 8:67–127, Springer.
Minimizing L1-norm
Description
This function minimizes a L1-norm of the form ||P u - q||_1
,
whereby P
is a (m \times n)
matrix and q
is a m
\times 1
vector. This function is wrapper function for invoking the
cps
-method of Linear Programs.
Usage
l1(P, q = NULL, optctrl = ctrl())
Arguments
P |
|
q |
|
optctrl |
An object of S4-class |
Value
An object of S4-class Rcpp_CPS
.
Definition of nonlinear inequality constraints
Description
This function is the interface to the reference class NLFC
for
creating nonlinear constraints.
Usage
nlfc(G, h)
Arguments
G |
Object of class |
h |
Object of class |
Value
List with elements: conType
, G
and h
.
Definition of linear inequality constraints
Description
This function is the interface to the reference class NNOC
for
creating linear constraints.
Usage
nnoc(G, h)
Arguments
G |
Object of class |
h |
Object of class |
Value
List with elements: conType
, G
and h
.
Definition of positive semidefinite cone inequality constraints
Description
This function is the interface to the reference class PSDC
for
creating positive semidefinite cone constraints.
Usage
psdc(Flist, F0)
Arguments
Flist |
Object of class |
F0 |
Object of class |
Details
A psd-cone constraint is given as \sum_{i = 1}^n x_i F_i \le
F_0
. The matrix G
is created as G = [\textrm{vech}(F_1) |
\ldots | \textrm{vech}(F_n)]
and the vector h
is constructed as
h = [\textrm{vech}(F_0)]
.
Value
List with elements: conType
, G
and h
.
Class "Rcpp_CONEC"
Description
Class for inequality (cone) constraints.
Extends
Class "C++Object"
, directly.
All reference classes extend and inherit methods from "envRefClass"
.
Fields
cone
:Object of class
activeBindingFunction
: Type of cone constraints.G
:Object of class
activeBindingFunction
: Left-hand side of inequality constraints.h
:Object of class
activeBindingFunction
: Right-hand side of inequality constraints.sidx
:Object of class
activeBindingFunction
: Row index for subsets of cone constraints.dims
:Object of class
activeBindingFunction
: Dimension of cone constraints.K
:Object of class
activeBindingFunction
: Count of inequality constraints.n
:Object of class
activeBindingFunction
: Count of variables in objective.
Examples
showClass("Rcpp_CONEC")
Class "Rcpp_CPS"
Description
Class for solution of convex programs.
Extends
Class "C++Object"
, directly.
All reference classes extend and inherit methods from "envRefClass"
.
Fields
pdv
:Object of class
activeBindingFunction
: Primal-dual variables.state
:Object of class
activeBindingFunction
: Vector of state variables in convex programs.status
:Object of class
activeBindingFunction
: Character indicating the status of the returned solution.niter
:Object of class
activeBindingFunction
: Integer, count of iterations.sidx
:Object of class
activeBindingFunction
: Integer matrix, start and end indices of slack variables.
Examples
showClass("Rcpp_CPS")
Class "Rcpp_CTRL"
Description
Class for control options used in optimization routines.
Extends
Class "C++Object"
, directly.
All reference classes extend and inherit methods from "envRefClass"
.
Fields
ctrlparams
:Object of class
activeBindingFunction
: List of control parameters.
Examples
showClass("Rcpp_CTRL")
Class "Rcpp_DCP"
Description
Class for definition of convex programs with non-linear constraints.
Extends
Class "C++Object"
, directly.
All reference classes extend and inherit methods from "envRefClass"
.
Fields
x0
:Object of class
activeBindingFunction
: Initial values.cList
:Object of class
activeBindingFunction
: Inequality constraints, classCONEC
.nList
:Object of class
activeBindingFunction
: List with elements of functions for evaluating non-linear constraints, their associated gradients and their associated Hessians.A
:Object of class
activeBindingFunction
: Left-hand side of equality cosntraints.b
:Object of class
activeBindingFunction
: Right-hand side of equality cosntraints.
Examples
showClass("Rcpp_DCP")
Class "Rcpp_DLP"
Description
Class for definition of linear programs.
Extends
Class "C++Object"
, directly.
All reference classes extend and inherit methods from "envRefClass"
.
Fields
q
:Object of class
activeBindingFunction
: Matrix related to linear term in objective.A
:Object of class
activeBindingFunction
: Left-hand side of equality cosntraints.b
:Object of class
activeBindingFunction
: Right-hand side of equality cosntraints.cList
:Object of class
activeBindingFunction
: Inequality constraints, classCONEC
.
Examples
showClass("Rcpp_DLP")
Class "Rcpp_DNL"
Description
Class for definition of linear programs with non-linear constraints.
Extends
Class "C++Object"
, directly.
All reference classes extend and inherit methods from "envRefClass"
.
Fields
q
:Object of class
activeBindingFunction
: Matrix related to linear term in objective.A
:Object of class
activeBindingFunction
: Left-hand side of equality cosntraints.b
:Object of class
activeBindingFunction
: Right-hand side of equality cosntraints.cList
:Object of class
activeBindingFunction
: Inequality constraints, classCONEC
.x0
:Object of class
activeBindingFunction
: Initial values.nList
:Object of class
activeBindingFunction
: List with elements of functions for evaluating non-linear constraints, their associated gradients and their associated Hessians.
Examples
showClass("Rcpp_DNL")
Class "Rcpp_DQP"
Description
Class for definition of quadratic programs.
Extends
Class "C++Object"
, directly.
All reference classes extend and inherit methods from "envRefClass"
.
Fields
P
:Object of class
activeBindingFunction
: Matrix related to quadratic term in objective.q
:Object of class
activeBindingFunction
: Matrix related to linear term in objective.A
:Object of class
activeBindingFunction
: Left-hand side of equality cosntraints.b
:Object of class
activeBindingFunction
: Right-hand side of equality cosntraints.cList
:Object of class
activeBindingFunction
: Inequality constraints, classCONEC
.
Examples
showClass("Rcpp_DQP")
Class "Rcpp_PDV"
Description
Class for primal/dual variables in convex programs.
Extends
Class "C++Object"
, directly.
All reference classes extend and inherit methods from "envRefClass"
.
Fields
x
:Object of class
activeBindingFunction
: Primal variables.y
:Object of class
activeBindingFunction
: Dual variables.s
:Object of class
activeBindingFunction
: Primal slack variables.z
:Object of class
activeBindingFunction
: Dual slack variables.kappa
:Object of class
activeBindingFunction
: Self-dual embedding variable; used in LPs, only.tau
:Object of class
activeBindingFunction
: Self-dual embedding variable; used in LPs, only.
Examples
showClass("Rcpp_PDV")
Risk-parity optimization
Description
This function determines a risk-parity solution of a long-only portfolio with a budget-constraint.
Usage
rp(x0, P, mrc, optctrl = ctrl())
Arguments
x0 |
|
P |
|
mrc |
|
optctrl |
An object of S4-class |
Value
An object of S4-class Rcpp_CPS
.
References
Spinu, F. (2013), An Algorithm for Computing Risk Parity Weights, SSRN, OMERS Capital Markets, July 2013.
Definition of second-oder cone inequality constraints
Description
This function is the interface to the reference class SOCC
for
creating second-oder cone constraints.
Usage
socc(F, g, d, f)
Arguments
F |
Object of class |
g |
Object of class |
d |
Object of class |
f |
Object of class |
Details
A second-order cone constraint is given as || Fx + g ||_2 \le d'x
+ f
. The matrix G
is created as G = [-d, -F]
and the
vector h
is constructed as h = [f, g]
.
Value
List with elements: conType
, G
and h
.