# hookejeeves: Hooke-Jeeves derivative-free minimization algorithm In dfoptim: Derivative-Free Optimization

## Description

An implementation of the Hooke-Jeeves algorithm for derivative-free optimization. A bounded and an unbounded version are provided.

## Usage

 ```1 2 3``` ```hjk(par, fn, control = list(), ...) hjkb(par, fn, lower = -Inf, upper = Inf, control = list(), ...) ```

## Arguments

 `par` Starting vector of parameter values. The initial vector may lie on the boundary. If `lower[i]=upper[i]` for some `i`, the `i`-th component of the solution vector will simply be kept fixed. `fn` Nonlinear objective function that is to be optimized. A scalar function that takes a real vector as argument and returns a scalar that is the value of the function at that point. `lower, upper` Lower and upper bounds on the parameters. A vector of the same length as the parameters. If a single value is specified, it is assumed that the same bound applies to all parameters. The starting parameter values must lie within the bounds. `control` A list of control parameters. See Details for more information. `...` Additional arguments passed to `fn`.

## Details

Argument `control` is a list specifing changes to default values of algorithm control parameters. Note that parameter names may be abbreviated as long as they are unique.

The list items are as follows:

`tol`

Convergence tolerance. Iteration is terminated when the step length of the main loop becomes smaller than `tol`. This does not imply that the optimum is found with the same accuracy. Default is 1.e-06.

`maxfeval`

Maximum number of objective function evaluations allowed. Default is Inf, that is no restriction at all.

`maximize`

A logical indicating whether the objective function is to be maximized (TRUE) or minimized (FALSE). Default is FALSE.

`target`

A real number restricting the absolute function value. The procedure stops if this value is exceeded. Default is Inf, that is no restriction.

`info`

A logical variable indicating whether the step number, number of function calls, best function value, and the first component of the solution vector will be printed to the console. Default is FALSE.

If the minimization process threatens to go into an infinite loop, set either `maxfeval` or `target`.

## Value

A list with the following components:

 `par` Best estimate of the parameter vector found by the algorithm. `value` value of the objective function at termination. `convergence` indicates convergence (`=0`) or not (`=1`). `feval` number of times the objective `fn` was evaluated. `niter` number of iterations in the main loop.

## Note

This algorithm is based on the Matlab code of Prof. C. T. Kelley, given in his book “Iterative methods for optimization". It is implemented here with the permission of Prof. Kelley.

This version does not (yet) implement a cache for storing function values that have already been computed as searching the cache makes it slower.

## References

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

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

`optim`, `nmk`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```## Hooke-Jeeves solves high-dim. Rosenbrock function rosenbrock <- function(x){ n <- length(x) sum (100*(x[1:(n-1)]^2 - x[2:n])^2 + (x[1:(n-1)] - 1)^2) } par0 <- rep(0, 10) hjk(par0, rosenbrock) hjkb(c(0, 0, 0), rosenbrock, upper = 0.5) # \$par #  0.50000000 0.25742722 0.06626892 ## Hooke-Jeeves does not work well on non-smooth functions nsf <- function(x) { f1 <- x^2 + x^2 f2 <- x^2 + x^2 + 10 * (-4*x - x + 4) f3 <- x^2 + x^2 + 10 * (-x - 2*x + 6) max(f1, f2, f3) } par0 <- c(1, 1) # true min 7.2 at (1.2, 2.4) hjk(par0, nsf) # fmin=8 at xmin=(2,2) ```

### Example output

```\$par
 1.000000 1.000004 1.000008 1.000015 1.000027 1.000050 1.000099 1.000198
 1.000397 1.000793

\$value
 2.144258e-07

\$convergence
 0

\$feval
 4780

\$niter
 19

\$par
 0.50000000 0.25742340 0.06626511

\$value
 0.8069307

\$convergence
 0

\$feval
 229

\$niter
 19

\$par
 2 2

\$value
 8

\$convergence
 0

\$feval
 104

\$niter
 19
```

dfoptim documentation built on Oct. 23, 2020, 8:19 p.m.