## Rosenbrock Banana objective function
rbf <- function(x) {(1 - x[1]) ^ 2 + 100 * (x[2] - x[1] ^ 2) ^ 2}
x0 <- c(-1.2, 1)
lb <- c(-3, -3)
ub <- c(3, 3)
## The function as written above has a minimum of 0 at (1, 1)
stogo(x0 = x0, fn = rbf, lower = lb, upper = ub)
Run the code above in your browser using DataLab