[R] linear constraint optim with bounds/reparametrization

Kahra Hannu kahra at mpsgr.it
Thu Aug 12 17:56:05 CEST 2004

>From Spencer Graves:

>However, for an equality constraint, I've had good luck by with an objective function that adds something like the
>following to my objective function: constraintViolationPenalty*(A%*%theta-c)^2, where "constraintViolationPenalty" is
>passed via "..." in a call to optim.

I applied Spencer's suggestion to a set of eight different constrained portfolio optimization problems. It seems to give a usable practice to solve the portfolio problem, when the QP optimizer is not applicable. After all, practical portfolio management is more an art than a science.   

>I may first run optim with a modest value for constraintViolationPenalty then restart it with the output of the 
>initial run as starting values and with a larger value for constraintViolationPenalty. 

I wrote a loop that starts with a small value for the penalty and stops when the change of the function value, when increasing the penalty, is less than epsilon. I found that epsilon = 1e-06 provides a reasonable accuracy with respect to computational time.

Spencer, many thanks for your suggestion.

Hannu Kahra

More information about the R-help mailing list