Thanks, but I still cannot get to solve my problem: consider this simple example:
######## f <- function(x){ return(x[1]+x[2]) } # objective function g <- function(x){ return(x[1]^2+x[2]^2) } # constraint ######### I wanna Maximize f(x) subject to g(x) = 1. By hand the solution is (1/sqrt(2), 1/sqrt(2), sqrt(2)). This is to maximizing a linear function subject to a nonlinear equality constraint. I didn't find any suitable function in the packages I went through. Thanks in advance, Gildas Spencer Graves a écrit : > To find every help page containing the term "constrained > optimization", you can try the following: > > > library(sos) > co <- findFn('constrained optimization') > > > "Printing" this "co" object opens a table in a web browser with > all matches sorted first by the package with the most matches and with > hot links to the documentation page. > > > writeFindFn2xls(co) > > > This writes an excel file, with the browser table as the second > tab and the first being a summary of the packages. This summary table > can be made more complete and useful using the "installPackages" > function, as noted in the "sos" vignette. > > > A shameless plug from the lead author of the "sos" package. > Spencer Graves > > > On 8/9/2010 10:01 AM, Ravi Varadhan wrote: >> constrOptim can only handle linear inequality constraints. It cannot >> handle >> equality (linear or nonlinear) as well as nonlinear inequality >> constraints. >> >> Ravi. >> >> -----Original Message----- >> From: r-help-boun...@r-project.org >> [mailto:r-help-boun...@r-project.org] On >> Behalf Of Dwayne Blind >> Sent: Monday, August 09, 2010 12:56 PM >> To: Gildas Mazo >> Cc: r-help@r-project.org >> Subject: Re: [R] optimization subject to constraints >> >> Hi ! >> >> Why not constrOptim ? >> >> Dwayne >> >> 2010/8/9 Gildas Mazo<gildas.m...@curie.fr> >> >>> Dear R users, >>> >>> I'm looking for tools to perform optimization subject to constraints, >>> both linear and non-linear. I don't mind which algorithm may be >>> used, my >>> primary aim is to get something general and easy-to-use to study >>> simples >>> examples. >>> >>> Thanks for helping, >>> >>> Gildas >>> >>> ______________________________________________ >>> 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<http://www.r-project.org/posting >> >> -guide.html> >>> and provide commented, minimal, self-contained, reproducible code. >>> >> [[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. >> >> ______________________________________________ >> 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. > ______________________________________________ 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.