hookejeeves | R Documentation |

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

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

`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. |

This method computes a new point using the values of `f`

at suitable
points along the orthogonal coordinate directions around the last point.

List with following components:

`xmin` |
minimum solution found so far. |

`fmin` |
value of |

`fcalls` |
number of function evaluations. |

`niter` |
number of iterations performed. |

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.

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

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

`neldermead`

## 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) } hookejeeves(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 hookejeeves(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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.