Random Search derivative-free optimization

random_search(
  objective,
  lower,
  upper,
  seed = 123,
  control = list(iter.max = 100)
)

Arguments

objective

objective function to be minimized

lower

lower bound for search

upper

upper bound for search

seed

an integer, for reproducing the result

control

a list of control parameters. For now control = list(iter.max=100), where iter.max is the maximum number of iterations allowed

Value

A list with components

par the best set of parameters found

objective the value of objective corresponding to par

iterations number of iterations performed

Examples


fr <- function(x) {   ## Rosenbrock Banana function
x1 <- x[1]
x2 <- x[2]
100 * (x2 - x1 * x1)^2 + (1 - x1)^2
}

random_search(fr, lower = c(-2, -2), upper = c(2, 2), control = list(iter.max=1000))
#> $par
#> [1] 0.8331613 0.7160912
#> 
#> $objective
#> [1] 0.07594302
#> 
#> $iterations
#> [1] 1000
#>