Skip to contents

BOBYQA performs derivative-free bound-constrained optimization using an iteratively constructed quadratic approximation for the objective function.

Usage

bobyqa(
  x0,
  fn,
  lower = NULL,
  upper = NULL,
  nl.info = FALSE,
  control = list(),
  ...
)

Arguments

x0

starting point for searching the optimum.

fn

objective function that is to be minimized.

lower, upper

lower and upper bound constraints.

nl.info

logical; shall the original NLopt info be shown.

control

list of options, see nl.opts for help.

...

additional arguments passed to the function.

Value

List with components:

par

the optimal solution found so far.

value

the function value corresponding to par.

iter

number of (outer) iterations, see maxeval.

convergence

integer code indicating successful completion (> 0) or a possible error number (< 0).

message

character string produced by NLopt and giving additional information.

Details

This is an algorithm derived from the BOBYQA Fortran subroutine of Powell, converted to C and modified for the NLopt stopping criteria.

Note

Because BOBYQA constructs a quadratic approximation of the objective, it may perform poorly for objective functions that are not twice-differentiable.

References

M. J. D. Powell. ``The BOBYQA algorithm for bound constrained optimization without derivatives,'' Department of Applied Mathematics and Theoretical Physics, Cambridge England, technical reportNA2009/06 (2009).

See also

Examples


## Rosenbrock Banana function

rbf <- function(x) {(1 - x[1]) ^ 2 + 100 * (x[2] - x[1] ^ 2) ^ 2}

## The function as written above has a minimum of 0 at (1, 1)

S <- bobyqa(c(0, 0), rbf)


S
#> $par
#> [1] 0.9999999 0.9999998
#> 
#> $value
#> [1] 9.022277e-15
#> 
#> $iter
#> [1] 118
#> 
#> $convergence
#> [1] 4
#> 
#> $message
#> [1] "NLOPT_XTOL_REACHED: Optimization stopped because xtol_rel or xtol_abs (above) was reached."
#> 

## Rosenbrock Banana function with both parameters constrained to [0, 0.5]

S <- bobyqa(c(0, 0), rbf, lower = c(0, 0), upper = c(0.5, 0.5))

S
#> $par
#> [1] 0.50 0.25
#> 
#> $value
#> [1] 0.25
#> 
#> $iter
#> [1] 44
#> 
#> $convergence
#> [1] 4
#> 
#> $message
#> [1] "NLOPT_XTOL_REACHED: Optimization stopped because xtol_rel or xtol_abs (above) was reached."
#>