# NOT RUN {
g <- function(y)
return(-20 * exp(-0.2 * sqrt(0.5 * (y[1] ^ 2 + (y[2]-1) ^ 2)))
- exp(0.5 * (cos(2 * pi * y[1]) + cos(2 * pi * (y[2]-1))))
+ exp(1) + 20)
# global min value is 0, achieved at c(0,1)
starting_point <- c(0.4,0.6)
g(starting_point)
solution <- RMPSolveS(starting_point, g)
g(solution)
# Example of putting infeasible starting point
g <- function(y)
return(-y[1]) # min value is 1, achieved if first coordinate is 1
RMPSolveS(c(1,0.2,56,0.4),g) # starting point NOT on simplex
# }
# NOT RUN {
# Example of 1000 dimensional problem
g <- function(y)
return(- sum(y^10))
# min value is -1, achieved if only one
# coordinate is equal to 1, rest are 0
RMPSolveS(rep(1 / 1000, 1000), g, print = 1)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab