[GSoC-PortA] Quick question on multipliers and constrained_objective()
Ross Bennett
rossbennett34 at gmail.com
Sat Jun 22 03:31:35 CEST 2013
Hi All,
I have a quick question on how the multiplier is used inside of the
constrained_objective() function.
The code below is from lines 230-248 in constrained_objective.R for objects
of class return_objective and portfolio_risk_objective.
# now set the new value of the objective output
if(inherits(objective,"return_objective")){
if (!is.null(objective$target) &
is.numeric(objective$target)){ # we have a target
out = out +
penalty*abs(objective$multiplier)*abs(tmp_measure-objective$target)
}
# target is null or doesn't exist, just maximize, or minimize
violation of constraint
out = out + abs(objective$multiplier)*tmp_measure
} # end handling for return objectives
if(inherits(objective,"portfolio_risk_objective")){
if (!is.null(objective$target) & is.numeric(objective$target)){
# we have a target
out = out +
penalty*abs(objective$multiplier)*abs(tmp_measure-objective$target)
#should we also penalize risk too low for risk targets? or
is a range another objective?
# # half penalty for risk lower than target
# if( prw < (.9*Riskupper) ){ out = out + .5*(penalty*(
prw - Riskupper)) }
}
# target is null or doesn't exist, just maximize, or minimize
violation of constraint
out = out + abs(objective$multiplier)*tmp_measure
} # univariate risk objectives
When specifying objectives, if we want to maximize return, we would set
multiplier=-1 and if we wanted to minimize risk we would set multiplier=1
in the objective object.
Because the code below takes the absolute value of the multiplier
(abs(objective$multiplier)), doesn't this make the multiplier have no
effect?
Any thoughts or insight is much appreciated.
Thanks,
Ross Bennett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/gsoc-porta/attachments/20130621/c618f9b4/attachment.html>
More information about the GSoC-PortA
mailing list