# NOT RUN {
g <- function(y)
return(-20 * exp(-0.2 * sqrt(0.5 * (y[1] ^ 2 + y[2] ^ 2))) -
exp(0.5 * (cos(2 * pi * y[1]) + cos(2 * pi * y[2]))) + exp(1) + 20)
starting_point <- rep(1, 10)
g(starting_point)
solution <- RMPSolveH(starting_point, g, rep(-33, 10), rep(33, 10))
g(solution)
RMPSolveH(c(2, 4, 6, 2, 1), g, rep(-3, 5), rep(23, 5), print_output = TRUE)
# Will Print the Updates after Each Iteration
g <- function(y)
return(sum(y ^ 2))
RMPSolveH(rep(2.3, 100),
g,
rep(-11, 100),
rep(13, 100),
max_time = 2,
print = 1)
# Will Exit and Return Result after 2 Seconds
# }
Run the code above in your browser using DataLab