constrained_objective_v1(w, R, constraints, ..., trace = FALSE, normalize = TRUE, storage = FALSE)
constrained_objective_v2(w, R, portfolio, ..., trace = FALSE, normalize = TRUE, storage = FALSE, env = NULL)
constrained_objective(w, R, portfolio, ..., trace = FALSE, normalize = TRUE, storage = FALSE, env = NULL)
portfolio
specifying the constraints and objectives for the optimization, see portfolio
.trace=TRUE
.constrained_objective_v1
.optimize.portfolio
optimize.portfolio
so that the weights you see have been
normalized to min_sum if the generated portfolio is smaller than min_sum or max_sum if the
generated portfolio is larger than max_sum.
This normalization increases the speed of optimization and convergence by several orders of magnitude in many cases.You may find that for some portfolios, normalization is not desirable, if the algorithm cannot find a direction in which to move to head towards an optimal portfolio. In these cases, it may be best to set normalize=FALSE, and penalize the portfolios if the sum of the weighting vector lies outside the min_sum and/or max_sum.
Whether or not we normalize the weights using min_sum and max_sum, and are using a numerical optimization engine like DEoptim, we will penalize portfolios that violate weight constraints in much the same way we penalize other constraints. If a min_sum/max_sum normalization has not occurred, convergence can take a very long time. We currently do not allow for a non-normalized full investment constraint. Future version of this function could include this additional constraint penalty.
When you are optimizing a return objective, you must specify a negative multiplier for the return objective so that the function will maximize return. If you specify a target return, any return that deviates from your target will be penalized. If you do not specify a target return, you may need to specify a negative VTR (value to reach) , or the function will not converge. Try the maximum expected return times the multiplier (e.g. -1 or -10). Adding a return objective defaults the multiplier to -1.
Additional parameters for other solvers
(e.g. random portfolios or
DEoptim.control
or pso or GenSA
may be passed in via ...
constraint
, objective
, DEoptim.control