hookejeeves: Hooke-Jeeves Function Minimization Method

Description Usage Arguments Details Value Note References See Also Examples

Description

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

Usage

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

Arguments

x0

starting vector.

fn

nonlinear function to be minimized.

...

additional arguments to be passed to the function.

lb, ub

lower and upper bounds.

tol

relative tolerance, to be used as stopping rule.

maxfeval

maximum number of allowed function evaluations.

target

iteration stops when this value is reached.

info

logical, whether to print information during the main loop.

Details

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

Value

List with following components:

xmin

minimum solution found so far.

fmin

value of f at minimum.

count

number of function evaluations.

convergence

NOT USED at the moment.

info

special info from the solver.

Note

Hooke-Jeeves is notorious for its number of function calls. Memoization is often suggested as a remedy.

For a similar implementation of Hooke-Jeeves see the ‘dfoptim’ package.

References

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

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

See Also

nelder_mead

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
##  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.000002 1.000003 1.000007 1.000013
## $fmin
## [1] 5.849188e-11
## $count
## [1] 1691
## $convergence
## [1] 0
## $info
## $info$solver
## [1] "Hooke-Jeeves"
## $info$iterations
## [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
## $count
## [1] 536
## $convergence
## [1] 0
## $info
## $info$solver
## [1] "Hooke-Jeeves"
## $info$iterations
## [1] 26

Example output

$xmin
[1] 1 1 1 1

$fmin
[1] 0

$count
[1] 1163

$convergence
[1] 0

$info
$info$solver
[1] "Hooke-Jeeves"

$info$iterations
[1] 26


$xmin
[1] 0.50000000 0.26221320 0.07797602 0.00608027

$fmin
[1] 1.667875

$count
[1] 578

$convergence
[1] 0

$info
$info$solver
[1] "Hooke-Jeeves"

$info$iterations
[1] 26

pracma documentation built on Dec. 11, 2021, 9:57 a.m.