pracma (version 1.9.9)

hooke_jeeves: Hooke-Jeeves Minimization Method

Description

An implementation of the Hooke-Jeeves algorithm for derivative-free optimization.

Usage

hooke_jeeves(x0, f, lb = NULL, ub = NULL, tol = 1e-08, target = Inf, maxfeval = Inf, info = FALSE, ...)

Arguments

x0
starting vector.
f
nonlinear function to be minimized.
lb, ub
lower and upper bounds.
tol
relative tolerance, to be used as stopping rule.
target
iteration stops when this value is reached.
maxfeval
maximum number of allowed function evaluations.
info
logical, whether to print information during the main loop.
...
additional arguments to be passed to the function.

Value

List with following components:

Details

This method computes a new point using the values of f at suitable points along the orthogonal coordinate directions around the last point.

References

C.T. Kelley (1999), Iterative Methods for Optimization, SIAM.

Quarteroni, Sacco, and Saleri (2007), Numerical Mathematics, Springer.

See Also

nelder_mead

Examples

Run this code
##  Rosenbrock function
rosenbrock <- function(x) {
    n <- length(x)
    x1 <- x[2:n]
    x2 <- x[1:(n-1)]
    sum(100*(x1-x2^2)^2 + (1-x2)^2)
}

hooke_jeeves(c(0,0,0,0), rosenbrock)
# $xmin
# [1] 1.000000 1.000001 1.000002 1.000004
# $fmin
# [1] 4.774847e-12
# $fcalls
# [1] 2499
# $niter
#[1] 26

hooke_jeeves(rep(0,4), lb=rep(-1,4), ub=0.5, rosenbrock)
# $xmin
# [1] 0.50000000 0.26221320 0.07797602 0.00608027
# $fmin
# [1] 1.667875
# $fcalls
# [1] 571
# $niter
# [1] 26

Run the code above in your browser using DataCamp Workspace