Hi Manoj, AFAIK there is no way in R to optimize functions under general linear equality constraints (for inequality constraints there is constrOptim). In your case you could reparametrize such that you estimate weights w(1) ... w(n-1) and simply compute w(n) from those. Even so, it would be great to have a routine that does optimization under general linear constraints. Maybe someone out there could port the OPT++ library to R ... OPT++ is an open source optimization library that does general linear and non-linear and bound-constraint optimization. hth, ingmar
> From: Manoj <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > Date: Wed, 21 Sep 2005 17:33:29 +0900 > To: r-help@stat.math.ethz.ch > Subject: [R] Help on optim > > 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 > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html