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_v2(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)
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)
set.portfolio.moments_v2
weights
: The optimal set weights.
objective_measures
: A list containing the value of each objective corresponding to the optimal weights.
opt_values
: A list containing the value of each objective corresponding to the optimal weights.
out
: The output of the solver.
call
: The function call.
portfolio
: The portfolio object.
R
: The asset returns.
data summary:
The first row and last row of R
.
elapsed_time:
The amount of time that elapses while the optimization is run.
end_t:
The date and time the optimization completed.
optimize_method="random"
random_portfolios
: A matrix of the random portfolios.
random_portfolio_objective_results
: A list of the following elements for each random portfolio.
out
: The output value of the solver corresponding to the random portfolio weights.
weights
: The weights of the random portfolio.
objective_measures
: A list of each objective measure corresponding to the random portfolio weights.
optimize_method="DEoptim"
DEoutput:
A list (of length 2) containing the following elements:
optim
member
DEoptim_objective_results
: A list containing the following elements for each intermediate population.
out
: The output of the solver.
weights
: Population weights.
init_weights
: Initial population weights.
objective_measures
: A list of each objective measure corresponding to the weights
optimize_method="pso"
PSOoutput
: A list containing the following elements:
optimize_method="GenSA"
GenSAoutput:
A list containing the following elements:
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:
optimize.portfolio
as an added argument to the portfolio
object).
maxSR=TRUE
in optimize.portfolio
.
If both mean and StdDev are specified as objective names, the default action is to maximize quadratic utility, therefore maxSR=TRUE
must be specified to maximize Sharpe Ratio.
maxSTARR=TRUE
in optimize.portfolio
.
If both mean and ES/ETL/CVaR are specified as objective names, the default action is to maximize mean return per unit ES/ETL/CVaR.
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.
portfolio.spec