[R] Weighted Sum Optimization in R (Maximization)

GR garamach at gmail.com
Thu Nov 13 08:55:19 CET 2008


There is a package "lpSolve" that you might want to look at. At the R
prompt, do the following:
> install.packages("lpSolve")

Once the package will be installed, you can type help(lpSolve) to get
details.

cheers,
-Girish

On Nov 13, 8:37 am, "Yun, Myung Ho" <myung.... at alliancebernstein.com>
wrote:
> Dear All,
>
> First of all, this is the first time for me to use R for optimization, I
> tried to search r-help postings & googled on weighted sum optimization,
> I could not find anything applicable.
>
> I would need to optimize following function in R;
>
> MAXIMIZE
> function = w1*R1 + w2*R2 + w3*R3 + w4*R4
>
> Where constraints are,
> w1 + w2 + w3 + w4 = 1 and  0 <= w1, w2, w3, w4 <= 1
>
> Does optim in R can do this optimization? If so, could anyone show me
> how to use 'optim()' in R?
>
> Thank you in advance and regards,
> Myung
>



More information about the R-help mailing list