Title: | Variable Neighborhood Trust Region Search |
---|---|
Description: | An implementation of the variable neighborhood trust region algorithm Bierlaire et al. (2009) "A Heuristic for Nonlinear Global Optimization" <doi:10.1287/ijoc.1090.0343>. |
Authors: | Lennart Oelschläger [aut, cre] |
Maintainer: | Lennart Oelschläger <[email protected]> |
License: | GPL-3 |
Version: | 0.1.1 |
Built: | 2025-01-14 02:35:29 UTC |
Source: | https://github.com/loelschlaeger/vntrs |
This function checks the input controls
.
check_controls(controls)
check_controls(controls)
controls |
Either
|
The checked and filled list controls
.
This function performs variable neighborhood trust region search.
vntrs(f, npar, minimize = TRUE, controls = NULL, quiet = TRUE, seed = NULL)
vntrs(f, npar, minimize = TRUE, controls = NULL, quiet = TRUE, seed = NULL)
f |
A function that computes value, gradient, and Hessian of the function to be
optimized and returns them as a named list with elements |
npar |
The number of parameters of |
minimize |
If |
controls |
Either
|
quiet |
If |
seed |
Set a seed for the sampling of the random starting points. |
A data frame. Each row contains information of an identified optimum. The
first npar
columns "p1"
,...,"p<npar>"
store the argument
values, the next column "value"
has the optimal function values and
the last column "global"
contains TRUE
for global optima and
FALSE
for local optima.
Bierlaire et al. (2009) "A Heuristic for Nonlinear Global Optimization" doi:10.1287/ijoc.1090.0343.
rosenbrock <- function(x) { stopifnot(is.numeric(x)) stopifnot(length(x) == 2) f <- expression(100 * (x2 - x1^2)^2 + (1 - x1)^2) g1 <- D(f, "x1") g2 <- D(f, "x2") h11 <- D(g1, "x1") h12 <- D(g1, "x2") h22 <- D(g2, "x2") x1 <- x[1] x2 <- x[2] f <- eval(f) g <- c(eval(g1), eval(g2)) h <- rbind(c(eval(h11), eval(h12)), c(eval(h12), eval(h22))) list(value = f, gradient = g, hessian = h) } vntrs(f = rosenbrock, npar = 2, seed = 1, controls = list(neighborhoods = 1))
rosenbrock <- function(x) { stopifnot(is.numeric(x)) stopifnot(length(x) == 2) f <- expression(100 * (x2 - x1^2)^2 + (1 - x1)^2) g1 <- D(f, "x1") g2 <- D(f, "x2") h11 <- D(g1, "x1") h12 <- D(g1, "x2") h22 <- D(g2, "x2") x1 <- x[1] x2 <- x[2] f <- eval(f) g <- c(eval(g1), eval(g2)) h <- rbind(c(eval(h11), eval(h12)), c(eval(h12), eval(h22))) list(value = f, gradient = g, hessian = h) } vntrs(f = rosenbrock, npar = 2, seed = 1, controls = list(neighborhoods = 1))