# NOT RUN {
# EXAMPLE 1
# The negative 4-dimensional paraboloid can be maximised as follows:
negparaboloid <- function(x) { -sum((x - (1:4))^2) }
sol <- noisyCE2(negparaboloid, domain = rep('real', 4))
# EXAMPLE 2
# The 10-dimensional Rosenbrock's function can be minimised as follows:
rosenbrock <- function(x) {
sum(100 * (tail(x, -1) - head(x, -1)^2)^2 + (head(x, -1) - 1)^2)
}
newvar <- type_real(
init = c(0, 2),
smooth = list(
quote(smooth_lin(x, xt, 1)),
quote(smooth_dec(x, xt, 0.7, 5))
)
)
sol <- noisyCE2(
rosenbrock, domain = rep(list(newvar), 10),
maximise = FALSE, N = 2000, maxiter = 10000
)
# EXAMPLE 3
# The negative 4-dimensional paraboloid with additive Gaussian noise can be
# maximised as follows:
noisyparaboloid <- function(x) { -sum((x - (1:4))^2) + rnorm(1) }
sol <- noisyCE2(noisyparaboloid, domain = rep('real', 4), stoprule = geweke(x))
# where the stopping criterion based on the Geweke's test has been adopted
# according to Bee et al. (2017).
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab