if (FALSE) {
#---------------------------------------------------------------------------
# Example of interactive optimization
#---------------------------------------------------------------------------
set.seed(25468)
library(DiceDesign)
d <- 2
n.obj <- 2
fun <- "P1"
n.grid <- 51
test.grid <- expand.grid(seq(0, 1, length.out = n.grid), seq(0, 1, length.out = n.grid))
nappr <- 20
design.grid <- round(maximinESE_LHS(lhsDesign(nappr, d, seed = 42)$design)$design, 1)
response.grid <- t(apply(design.grid, 1, fun))
paretoFront <- t(nondominated_points(t(response.grid)))
mf1 <- km(~., design = design.grid, response = response.grid[,1])
mf2 <- km(~., design = design.grid, response = response.grid[,2])
model <- list(mf1, mf2)
lower <- rep(0, d); upper <- rep(1, d)
sol <- GParetoptim(model, fun, crit = "SUR", nsteps = 5, lower = lower, upper = upper)
plotGPareto(sol)
target1 <- c(15, -25)
points(x = target1[1], y = target1[2], col = "black", pch = 13)
nDesign <- getDesign(sol$lastmodel, target = target1, lower = rep(0, d), upper = rep(1, d))
points(t(nDesign$mean), col = "green", pch = 20)
target2 <- c(48, -27)
points(x = target2[1], y = target2[2], col = "black", pch = 13)
nDesign2 <- getDesign(sol$lastmodel, target = target2, lower = rep(0, d), upper = rep(1, d))
points(t(nDesign2$mean), col = "darkgreen", pch = 20)
}
Run the code above in your browser using DataLab