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 ----------------------------------------- The information contained in the linked e-mail transmission and any attachments may be privileged and confidential and is intended only for the use of the person(s) named in the linked e-mail transmission. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you should not review, disseminate, distribute or duplicate this e-mail transmission or any attachments. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. We do not accept account orders and/or instructions related to AllianceBernstein products or services by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions. The linked e-mail transmission and any attachments are provided for informational purposes only and should not be construed in any manner as any solicitation or offer to buy or sell any investment opportunities or any related financial instruments and should not be construed in any manner as a public offer of any investment opportunities or any related financial instruments. If you, as the intended recipient of the linked e-mail transmission, the purpose of which is to inform and update our clients, prospects and consultants of developments relating to our services and products, would not like to receive further e-mail correspondence from the sender, please "reply" to the sender indicating your wishes. Although we attempt to sweep e-mail and attachments for viruses, we will not be liable for any damages arising from the alteration of the contents of this linked e-mail transmission and any attachments by a third party or as a result of any virus being passed on. Please note: Trading instructions sent electronically to Bernstein shall not be deemed accepted until a representative of Bernstein acknowledges receipt electronically or by telephone. Comments in the linked e-mail transmission and any attachments are part of a larger body of investment analysis. For our research reports, which contain information that may be used to support investment decisions, and disclosures, see our website at www.bernsteinresearch.com. [[alternative HTML version deleted]]
This is 'linear programming'. Try RSiteSearch("linear programming") The first few fits will give you a lot to explore. On Thu, 13 Nov 2008, Yun, Myung Ho 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 > > > > > > ----------------------------------------- > The information contained in the linked e-mail transmission and any attachments may be privileged and confidential and is intended only for the use of the person(s) named in the linked e-mail transmission. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you should not review, disseminate, distribute or duplicate this e-mail transmission or any attachments. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. We do not accept account orders and/or instructions related to AllianceBernstein products or services by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions. The linked e-mail transmission and any attachments are provided for informational purposes only and should not be construed in any manner as any solicitation or offer to buy or sell any investment opportu!ni!> ties or any related financial instruments and should not be construed in any manner as a public offer of any investment opportunities or any related financial instruments. If you, as the intended recipient of the linked e-mail transmission, the purpose of which is to inform and update our clients, prospects and consultants of developments relating to our services and products, would not like to receive further e-mail correspondence from the sender, please "reply" to the sender indicating your wishes. Although we attempt to sweep e-mail and attachments for viruses, we will not be liable for any damages arising from the alteration of the contents of this linked e-mail transmission and any attachments by a third party or as a result of any virus being passed on. Please note: Trading instructions sent electronically to Bernstein shall not be deemed accepted until a representative of Bernstein acknowledges receipt electronically or by telephone. Comments in the linked e-mail !t!> ransmission and any attachments are part of a larger body of investmen > t analysis. For our research reports, which contain information that may be used to support investment decisions, and disclosures, see our website at www.bernsteinresearch.com. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
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 >