# bobyqa

0th

Percentile

##### An R interface to the bobyqa implementation of Powell

The purpose of bobyqa is to minimize a function of many variables by a trust region method that forms quadratic models by interpolation. Box constraints (bounds) on the parameters are permitted.

Keywords
nonlinear, optimize
##### Usage
bobyqa(par, fn, lower = -Inf, upper = Inf, control = list(), ...)
##### Arguments
par
A numeric vector of starting estimates of the parameters of the objective function.
fn
A function that returns the value of the objective at the supplied set of parameters par using auxiliary data in .... The first argument of fn must be par.
lower
A numeric vector of lower bounds on the parameters. If the length is 1 the single lower bound is applied to all parameters.
upper
A numeric vector of upper bounds on the parameters. If the length is 1 the single upper bound is applied to all parameters.
control
An optional list of control settings. See the details section for the names of the settable control values and their effect.
...
Further arguments to be passed to fn.
##### Details

The function fn must return a scalar numeric value.

The control argument is a list. Possible named values in the list and their defaults are: [object Object],[object Object],[object Object],[object Object],[object Object]

##### Value

• A list with components:
• parThe best set of parameters found.
• fvalThe value of the objective at the best set of parameters found.
• fevalThe number of function evaluations used.
• ierrAn integer error code. A value of zero indicates success. Other values are [object Object],[object Object],[object Object],[object Object],[object Object]

UTF-8

##### References

M. J. D. Powell (2007) "Developments of NEWUOA for unconstrained minimization without derivatives", Cambridge University, Department of Applied Mathematics and Theoretical Physics, Numerical Analysis Group, Report NA2007/05, http://www.damtp.cam.ac.uk/user/na/NA_papers/NA2007_05.pdf.

M. J. D. Powell (2009), "The BOBYQA algorithm for bound constrained optimization without derivatives", Report No. DAMTP 2009/NA06, Centre for Mathematical Sciences, University of Cambridge, UK. http://www.damtp.cam.ac.uk/user/na/NA_papers/NA2009_06.pdf. Description was taken from comments in the Fortran code of M. J. D. Powell on which minqa is based.

optim, nlminb

• bobyqa
##### Examples
fr <- function(x) {   ## Rosenbrock Banana function
100 * (x[2] - x[1]^2)^2 + (1 - x[1])^2
}
(x1 <- bobyqa(c(1, 2), fr, lower = c(0, 0), upper = c(4, 4)))
## => optimum at c(1, 1) with fval = 0

str(x1)  # see that the error code and msg are returned

# check the error exits
# too many iterations
x1e<-bobyqa(c(1, 2), fr, lower = c(0, 0), upper = c(4, 4), control = list(maxfun=50))
str(x1e)

# Throw an error because bounds too tight
x1b<-bobyqa(c(4,4), fr, lower = c(0, 3.9999999), upper = c(4, 4))
str(x1b)

# Throw an error because npt is too small -- does NOT work as of 2010-8-10 as
#    minqa.R seems to force a reset.
x1n<-bobyqa(c(2,2), fr, lower = c(0, 0), upper = c(4, 4), control=list(npt=1))
str(x1n)

# To add if we can find them -- examples of ierr = 3 and ierr = 5.
Documentation reproduced from package minqa, version 1.1.13, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.