[R] Help on optim

Manoj manojsw at gmail.com
Wed Sep 21 10:33:29 CEST 2005


Dear R-help,
       I am new to optim function and need some help with optimization.

       Problem description: I am trying to optimize a weights vector
such that it produce maximum value for a function maxVal. The
optimization is subjected to constraint. The constraints are a) Min
weight should be greater than or equal to Zero. b) Max weight should
be less than or equal to 1 c) Sum of the weights should be equal to 1.

Now after googling around a bit & trying my hands at RSiteSearch , I
found that I can use optim with L-BFGS-B method and could possible use
lower bound and upper bound for constraint, however I am clueless as
to how I can impose the sum(wgts) = 1 condition. In excel solver, this
problem is extremely simple since it's just a matter of setting an
additional constraint of setting the summation cell to 1.

Your kind help is greatly appreciated.

Best Regards

Manoj




More information about the R-help mailing list