# NOT RUN {
set.seed(000)
# 3-points EI maximization.
# 9-points factorial design, and the corresponding response
d <- 2
n <- 9
design.fact <- expand.grid(seq(0,1,length=3), seq(0,1,length=3))
names(design.fact)<-c("x1", "x2")
design.fact <- data.frame(design.fact)
names(design.fact)<-c("x1", "x2")
response.branin <- apply(design.fact, 1, branin)
response.branin <- data.frame(response.branin)
names(response.branin) <- "y"
lower <- c(0,0)
upper <- c(1,1)
# number of point in the bacth
batchSize <- 3
# model identification
fitted.model <- km(~1, design=design.fact, response=response.branin,
covtype="gauss", control=list(pop.size=50,trace=FALSE), parinit=c(0.5, 0.5))
# maximization of qEI
# With a multistarted BFGS algorithm
maxBFGS <- max_qEI(model = fitted.model, npoints = batchSize, lower = lower, upper = upper,
crit = "exact",optimcontrol=list(nStarts=3,method = "BFGS"))
# comparison
print(maxBFGS$value)
# }
# NOT RUN {
# With a genetic algorithme using derivatives
maxGen <- max_qEI(model = fitted.model, npoints = batchSize, lower = lower, upper = upper,
crit = "exact", optimcontrol=list(nStarts=3,method = "genoud",pop.size=100,max.generations = 15))
# With the constant liar heuristic
maxCL <- max_qEI(model = fitted.model, npoints = batchSize, lower = lower, upper = upper,
crit = "CL",optimcontrol=list(pop.size=20))
print(maxGen$value)
print(maxCL$value)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab