optimize.portfolio: Constrained optimization of portfolios

Description Usage Arguments Details Value Note Author(s) See Also

Description

This function aims to provide a wrapper for constrained optimization of portfolios that specify constraints and objectives.

Usage

1
2
3
4
5
6
7
8
optimize.portfolio_v1(R, constraints, optimize_method = c("DEoptim", "random",
  "ROI", "ROI_old", "pso", "GenSA"), search_size = 20000, trace = FALSE,
  ..., rp = NULL, momentFUN = "set.portfolio.moments_v1")

optimize.portfolio(R, portfolio = NULL, constraints = NULL,
  objectives = NULL, optimize_method = c("DEoptim", "random", "ROI", "pso",
  "GenSA"), search_size = 20000, trace = FALSE, ..., rp = NULL,
  momentFUN = "set.portfolio.moments", message = FALSE)

Arguments

R

an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns

constraints

default=NULL, a list of constraint objects. An object of class 'v1_constraint' can be passed in here.

optimize_method

one of "DEoptim", "random", "ROI", "pso", "GenSA". A solver for ROI can also be specified and will be solved using ROI. See Details.

search_size

integer, how many portfolios to test, default 20,000

trace

TRUE/FALSE if TRUE will attempt to return additional information on the path or portfolios searched

...

any other passthru parameters

rp

matrix of random portfolio weights, default NULL, mostly for automated use by rebalancing optimization or repeated tests on same portfolios

momentFUN

the name of a function to call to set portfolio moments, default set.portfolio.moments_v2

portfolio

an object of type "portfolio" specifying the constraints and objectives for the optimization

objectives

default=NULL, a list of objective objects.

message

TRUE/FALSE. The default is message=FALSE. Display messages if TRUE.

Details

This function currently supports DEoptim, random portfolios, pso, GenSA, and ROI as back ends. Additional back end contributions for Rmetrics, ghyp, etc. would be welcome.

When using random portfolios, search_size is precisely that, how many portfolios to test. You need to make sure to set your feasible weights in generatesequence to make sure you have search_size unique portfolios to test, typically by manipulating the 'by' parameter to select something smaller than .01 (I often use .002, as .001 seems like overkill)

When using DE, search_size is decomposed into two other parameters which it interacts with, NP and itermax.

NP, the number of members in each population, is set to cap at 2000 in DEoptim, and by default is the number of parameters (assets/weights) * 10.

itermax, if not passed in dots, defaults to the number of parameters (assets/weights) * 50.

When using GenSA and want to set verbose=TRUE, instead use trace.

If optimize_method="ROI" is specified, a default solver will be selected based on the optimization problem. The glpk solver is the default solver for LP and MILP optimization problems. The quadprog solver is the default solver for QP optimization problems. For example, optimize_method = "quadprog" can be specified and the optimization problem will be solved via ROI using the quadprog solver.

The extension to ROI solves a limited type of convex optimization problems:

These problems also support a weight_concentration objective where concentration of weights as measured by HHI is added as a penalty term to the quadratic objective.

Because these convex optimization problem are standardized, there is no need for a penalty term. The multiplier argument in add.objective passed into the complete constraint object are ingnored by the ROI solver.

Value

a list containing the following elements

When Trace=TRUE is specified, the following elements will be returned in addition to the elements above. The output depends on the optimization method and is specific to each solver. Refer to the documentation of the desired solver for more information.

optimize_method="random"

optimize_method="DEoptim"

optimize_method="pso"

optimize_method="GenSA"

Note

An object of class v1_constraint can be passed in for the constraints argument. The v1_constraint object was used in the previous 'v1' specification to specify the constraints and objectives for the optimization problem, see constraint. We will attempt to detect if the object passed into the constraints argument is a v1_constraint object and update to the 'v2' specification by adding the constraints and objectives to the portfolio object.

Author(s)

Kris Boudt, Peter Carl, Brian G. Peterson, Ross Bennett

See Also

portfolio.spec


PortfolioAnalytics documentation built on May 1, 2019, 10:56 p.m.