Liu Evans, Gareth
2011-Sep-08 13:54 UTC
[R] global optimisation with inequality constraints
Dear All, I would like to minimise a nonlinear function subject to linear inequality constraints as part of an R program. I have been using the constrOptim function. I have tried all of the methods that come with Optim, but nothing finds the correct solution. If I use the correct solution as the vector of starting values, though, my program does output the correct solution and optimum - the problem seems to be my choice of optimisation method. Optim includes a global optimisation method, SANN, but it doesn't make sense to use this in constrOptim (see http://tolstoy.newcastle.edu.au/R/e4/help/08/01/1328.html, also I tried it unsuccesfully). Is there another global optimisation method that I can use? Regards, Gareth [[alternative HTML version deleted]]
Hi, I think this other post could help: http://stackoverflow.com/questions/7328104/optim-with-inequality-constraint Regards, Carlos Ortega www.qualityexcellence.es On Thu, Sep 8, 2011 at 3:54 PM, Liu Evans, Gareth < Gareth.Liu-Evans@liverpool.ac.uk> wrote:> Dear All, > > I would like to minimise a nonlinear function subject to linear inequality > constraints as part of an R program. I have been using the constrOptim > function. I have tried all of the methods that come with Optim, but nothing > finds the correct solution. If I use the correct solution as the vector of > starting values, though, my program does output the correct solution and > optimum - the problem seems to be my choice of optimisation method. > > Optim includes a global optimisation method, SANN, but it doesn't make > sense to use this in constrOptim (see > http://tolstoy.newcastle.edu.au/R/e4/help/08/01/1328.html, also I tried it > unsuccesfully). Is there another global optimisation method that I can use? > > Regards, > Gareth > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]
Hi, Take a look at the multiStart() function in the "BB" package. This allows you to specify random multiple starting values, which need not satisfy constraints. Then you need to specify the constraints using the `projectLinear' argument. Ravi. ------------------------------------------------------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvaradhan@jhmi.edu<mailto:rvaradhan@jhmi.edu> [[alternative HTML version deleted]]
Please advice on the package I should use to run a linear regression model (weighted least squared) with linear equality constraint. I initially tried "constrOptim" but it turned out that it only supported http://solve-graph-linear-inequalities.blogspot.com/2011/11/blog-post.html linear inequality constraint. Thank you very much in advance. Cheers, NICK -- View this message in context: http://r.789695.n4.nabble.com/global-optimisation-with-inequality-constraints-tp3799258p4075455.html Sent from the R help mailing list archive at Nabble.com.