Running examples in ‘GPareto-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: CPF
> ### Title: Conditional Pareto Front simulations
> ### Aliases: CPF
> 
> ### ** Examples
> 
> library(DiceDesign)
> set.seed(42)
> 
> nvar <- 2
> 
> fname <- "P1" # Test function
> 
> # Initial design
> nappr <- 10
> design.grid <- maximinESE_LHS(lhsDesign(nappr, nvar, seed = 42)$design)$design
> response.grid <- t(apply(design.grid, 1, fname))
> 
> # kriging models: matern5_2 covariance structure, linear trend, no nugget effect
> mf1 <- km(~., design = design.grid, response = response.grid[,1])

optimisation start
------------------
* estimation method   : MLE 
* optimisation method : BFGS 
* analytical gradient : used
* trend model : ~X1 + X2
* covariance model : 
  - type :  matern5_2 
  - nugget : NO
  - parameters lower bounds :  1e-10 1e-10 
  - parameters upper bounds :  1.691138 1.841373 
  - best initial criterion value(s) :  -49.90334 

N = 2, M = 5 machine precision = 2.22045e-16
At X0, 0 variables are exactly at the bounds
At iterate     0  f=       49.903  |proj g|=       1.4709
At iterate     1  f =       49.786  |proj g|=             0

iterations 1
function evaluations 2
segments explored during Cauchy searches 2
BFGS updates skipped 0
active bounds at final generalized Cauchy point 2
norm of the final projected gradient 0
final function value 49.7863

F = 49.7863
final  value 49.786306 
converged
> mf2 <- km(~., design = design.grid, response = response.grid[,2])

optimisation start
------------------
* estimation method   : MLE 
* optimisation method : BFGS 
* analytical gradient : used
* trend model : ~X1 + X2
* covariance model : 
  - type :  matern5_2 
  - nugget : NO
  - parameters lower bounds :  1e-10 1e-10 
  - parameters upper bounds :  1.691138 1.841373 
  - best initial criterion value(s) :  -23.64696 

N = 2, M = 5 machine precision = 2.22045e-16
At X0, 0 variables are exactly at the bounds
At iterate     0  f=       23.647  |proj g|=      0.67238
At iterate     1  f =       23.309  |proj g|=             0

iterations 1
function evaluations 2
segments explored during Cauchy searches 2
BFGS updates skipped 0
active bounds at final generalized Cauchy point 2
norm of the final projected gradient 0
final function value 23.3087

F = 23.3087
final  value 23.308741 
converged
> 
> # Conditional simulations generation with random sampling points 
> nsim <- 40
> npointssim <- 150 # increase for better results
> Simu_f1 <- matrix(0, nrow = nsim, ncol = npointssim)
> Simu_f2 <- matrix(0, nrow = nsim, ncol = npointssim)
> design.sim <- array(0, dim = c(npointssim, nvar, nsim))
> 
> for(i in 1:nsim){
+   design.sim[,,i] <- matrix(runif(nvar*npointssim), nrow = npointssim, ncol = nvar)
+   Simu_f1[i,] <- simulate(mf1, nsim = 1, newdata = design.sim[,,i], cond = TRUE,
+                           checkNames = FALSE, nugget.sim = 10^-8)
+   Simu_f2[i,] <- simulate(mf2, nsim = 1, newdata = design.sim[,,i], cond = TRUE, 
+                           checkNames = FALSE, nugget.sim = 10^-8)
+ }
> 
> # Attainment and Voreb'ev expectation + deviation estimation
> CPF1 <- CPF(Simu_f1, Simu_f2, response.grid)
> 
> # Details about the Vorob'ev threshold  and Vorob'ev deviation
> summary(CPF1)

 Number of simulations used: 40 

 Number of simulations points: 150 

 Ref Point: 190.2147 -3.289189 

 Ideal Point: -103.3683 -37.81559 

 Vorob'ev threshold: 0.449707 

 Vorob'ev deviation: 640.505 
> 
> # Graphics
> plot(CPF1)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
GPareto
 --- call from context --- 
plotParetoEmp(x$PF, col = "blue", lwd = 2)
 --- call from argument --- 
if (class(nondominatedPoints) != "matrix") {
    cat("The nondominatedPoints argument should be a matrix \n")
} else {
    if (ncol(nondominatedPoints) == 2) {
        if (add == FALSE) {
            plot(nondominatedPoints, ...)
        }
        temp <- nondominatedPoints[order(nondominatedPoints[, 
            1]), , drop = FALSE]
        if (max) {
            if (add) {
                lim_left <- par("usr")[1]
                lim_bottom <- par("usr")[3]
            }
            else {
                lim_left <- -abs(20 * temp[nrow(temp), 1])
                lim_bottom <- -abs(20 * temp[1, 2])
            }
            lines(c(lim_left, temp[1, 1]), c(temp[1, 2], temp[1, 
                2]), ...)
            lines(c(temp[dim(temp)[1], 1], temp[dim(temp)[1], 
                1]), c(temp[dim(temp)[1], 2], lim_bottom), ...)
            if (nrow(temp) > 1) {
                for (i in 1:(nrow(temp) - 1)) {
                  lines(c(temp[i, 1], temp[i, 1]), c(temp[i, 
                    2], temp[i + 1, 2]), ...)
                  lines(c(temp[i, 1], temp[i + 1, 1]), c(temp[i + 
                    1, 2], temp[i + 1, 2]), ...)
                }
            }
        }
        else {
            if (add) {
                lim_right <- par("usr")[2]
                lim_up <- par("usr")[4]
            }
            else {
                lim_right <- abs(20 * temp[nrow(temp), 1])
                lim_up <- abs(20 * temp[1, 2])
            }
            lines(c(temp[1, 1], temp[1, 1]), c(lim_up, temp[1, 
                2]), ...)
            lines(c(temp[dim(temp)[1], 1], lim_right), c(temp[dim(temp)[1], 
                2], temp[dim(temp)[1], 2]), ...)
            if (nrow(temp) > 1) {
                for (i in 1:(nrow(temp) - 1)) {
                  lines(c(temp[i, 1], temp[i + 1, 1]), c(temp[i, 
                    2], temp[i, 2]), ...)
                  lines(c(temp[i + 1, 1], temp[i + 1, 1]), c(temp[i, 
                    2], temp[i + 1, 2]), ...)
                }
            }
        }
    }
    else if (ncol(nondominatedPoints) == 3) {
        if (max) {
            cat("plotParetoEmp with 3 objectives only works for minimization \n")
        }
        else {
            paretoFront <- nondominatedPoints
            Front.range <- diff(apply(paretoFront, 2, range))
            if (is.null(bounds)) 
                bounds <- rbind(apply(paretoFront, 2, min) - 
                  0.1 * Front.range, apply(paretoFront, 2, max) + 
                  0.1 * Front.range)
            n.pareto <- nrow(paretoFront)
            if (add == FALSE) {
                plot3d(x = paretoFront[, 1], y = paretoFront[, 
                  2], z = paretoFront[, 3], xlim = bounds[, 1], 
                  ylim = bounds[, 2], zlim = bounds[, 3], xlab = "f1", 
                  ylab = "f2", zlab = "f3", col = "red", size = 4)
            }
            paretoFront <- paretoFront[order(paretoFront[, 3], 
                decreasing = TRUE), , drop = FALSE]
            for (i in 1:(n.pareto)) {
                if (i == 1) 
                  z2 <- bounds[2, 3]
                else z2 <- paretoFront[i - 1, 3]
                z1 <- paretoFront[i, 3]
                front2D <- t(nondominated_points(t(paretoFront[(i:n.pareto), 
                  1:2, drop = FALSE])))
                front2D <- front2D[order(front2D[, 1]), , drop = FALSE]
                if (nrow(front2D) > 1) {
                  for (j in 1:(nrow(front2D) - 1)) {
                    quads3d(x = front2D[c(0, 1, 1, 0) + j, 1], 
                      y = front2D[rep(j, 4), 2], z = c(z1, z1, 
                        z2, z2), col = "blue", alpha = alpha)
                    quads3d(x = front2D[rep(j + 1, 4), 1], y = front2D[c(0, 
                      1, 1, 0) + j, 2], z = c(z1, z1, z2, z2), 
                      col = "darkblue", alpha = alpha)
                  }
                }
                quads3d(x = c(max(front2D[, 1]), bounds[2, 1], 
                  bounds[2, 1], max(front2D[, 1])), y = rep(min(front2D[, 
                  2]), 4), z = c(z1, z1, z2, z2), col = "blue", 
                  alpha = alpha)
                quads3d(y = c(max(front2D[, 2]), bounds[2, 2], 
                  bounds[2, 2], max(front2D[, 2])), x = rep(min(front2D[, 
                  1]), 4), z = c(z2, z2, z1, z1), col = "darkblue", 
                  alpha = alpha)
            }
            paretoFront <- paretoFront[order(paretoFront[, 1], 
                decreasing = TRUE), , drop = FALSE]
            for (i in 1:(n.pareto)) {
                if (i == 1) 
                  x2 <- bounds[2, 1]
                else x2 <- paretoFront[i - 1, 1]
                x1 <- paretoFront[i, 1]
                front2D <- t(nondominated_points(t(paretoFront[(i:n.pareto), 
                  2:3, drop = FALSE])))
                front2D <- front2D[order(front2D[, 1]), , drop = FALSE]
                if (nrow(front2D) > 1) {
                  for (j in 1:(nrow(front2D) - 1)) {
                    quads3d(y = front2D[c(0, 1, 1, 0) + j, 1], 
                      z = front2D[rep(j, 4), 2], x = c(x1, x1, 
                        x2, x2), col = "blue", alpha = alpha)
                  }
                }
                quads3d(y = c(max(front2D[, 1]), bounds[2, 2], 
                  bounds[2, 2], max(front2D[, 1])), z = rep(min(front2D[, 
                  2]), 4), x = c(x1, x1, x2, x2), col = "blue", 
                  alpha = alpha)
            }
        }
    }
    else {
        cat("plotParetoEmp only works with 2 or 3 objectives \n")
    }
}
 --- R stacktrace ---
where 1: plotParetoEmp(x$PF, col = "blue", lwd = 2)
where 2: filled.contour(x$x, x$y, x$values, col = graypalette(7), levels = c(0, 
    0.01, 0.2, 0.4, 0.6, 0.8, 0.99, 1), main = substitute(paste("Empirical attainment function, ", 
    beta, "* = ", a), list(a = formatC(x$beta_star, digits = 2))), 
    xlab = expression(f[1]), ylab = expression(f[2]), plot.axes = {
        axis(1)
        axis(2)
        points(x$response[, 1], x$responses[, 2], pch = 17, col = "blue")
        contour(x$x, x$y, x$values, add = T, levels = c(0, 0.2, 
            0.4, 0.6, 0.8, 1), labcex = 1)
        plotParetoEmp(x$PF, col = "blue", lwd = 2)
        plotParetoEmp(x$VE, col = "cyan", lwd = 2)
    })
where 3: plot.CPF(CPF1)
where 4: plot(CPF1)
where 5: plot(CPF1)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (nondominatedPoints, add = TRUE, max = FALSE, bounds = NULL, 
    alpha = 0.5, ...) 
{
    if (class(nondominatedPoints) != "matrix") {
        cat("The nondominatedPoints argument should be a matrix \n")
    }
    else {
        if (ncol(nondominatedPoints) == 2) {
            if (add == FALSE) {
                plot(nondominatedPoints, ...)
            }
            temp <- nondominatedPoints[order(nondominatedPoints[, 
                1]), , drop = FALSE]
            if (max) {
                if (add) {
                  lim_left <- par("usr")[1]
                  lim_bottom <- par("usr")[3]
                }
                else {
                  lim_left <- -abs(20 * temp[nrow(temp), 1])
                  lim_bottom <- -abs(20 * temp[1, 2])
                }
                lines(c(lim_left, temp[1, 1]), c(temp[1, 2], 
                  temp[1, 2]), ...)
                lines(c(temp[dim(temp)[1], 1], temp[dim(temp)[1], 
                  1]), c(temp[dim(temp)[1], 2], lim_bottom), 
                  ...)
                if (nrow(temp) > 1) {
                  for (i in 1:(nrow(temp) - 1)) {
                    lines(c(temp[i, 1], temp[i, 1]), c(temp[i, 
                      2], temp[i + 1, 2]), ...)
                    lines(c(temp[i, 1], temp[i + 1, 1]), c(temp[i + 
                      1, 2], temp[i + 1, 2]), ...)
                  }
                }
            }
            else {
                if (add) {
                  lim_right <- par("usr")[2]
                  lim_up <- par("usr")[4]
                }
                else {
                  lim_right <- abs(20 * temp[nrow(temp), 1])
                  lim_up <- abs(20 * temp[1, 2])
                }
                lines(c(temp[1, 1], temp[1, 1]), c(lim_up, temp[1, 
                  2]), ...)
                lines(c(temp[dim(temp)[1], 1], lim_right), c(temp[dim(temp)[1], 
                  2], temp[dim(temp)[1], 2]), ...)
                if (nrow(temp) > 1) {
                  for (i in 1:(nrow(temp) - 1)) {
                    lines(c(temp[i, 1], temp[i + 1, 1]), c(temp[i, 
                      2], temp[i, 2]), ...)
                    lines(c(temp[i + 1, 1], temp[i + 1, 1]), 
                      c(temp[i, 2], temp[i + 1, 2]), ...)
                  }
                }
            }
        }
        else if (ncol(nondominatedPoints) == 3) {
            if (max) {
                cat("plotParetoEmp with 3 objectives only works for minimization \n")
            }
            else {
                paretoFront <- nondominatedPoints
                Front.range <- diff(apply(paretoFront, 2, range))
                if (is.null(bounds)) 
                  bounds <- rbind(apply(paretoFront, 2, min) - 
                    0.1 * Front.range, apply(paretoFront, 2, 
                    max) + 0.1 * Front.range)
                n.pareto <- nrow(paretoFront)
                if (add == FALSE) {
                  plot3d(x = paretoFront[, 1], y = paretoFront[, 
                    2], z = paretoFront[, 3], xlim = bounds[, 
                    1], ylim = bounds[, 2], zlim = bounds[, 3], 
                    xlab = "f1", ylab = "f2", zlab = "f3", col = "red", 
                    size = 4)
                }
                paretoFront <- paretoFront[order(paretoFront[, 
                  3], decreasing = TRUE), , drop = FALSE]
                for (i in 1:(n.pareto)) {
                  if (i == 1) 
                    z2 <- bounds[2, 3]
                  else z2 <- paretoFront[i - 1, 3]
                  z1 <- paretoFront[i, 3]
                  front2D <- t(nondominated_points(t(paretoFront[(i:n.pareto), 
                    1:2, drop = FALSE])))
                  front2D <- front2D[order(front2D[, 1]), , drop = FALSE]
                  if (nrow(front2D) > 1) {
                    for (j in 1:(nrow(front2D) - 1)) {
                      quads3d(x = front2D[c(0, 1, 1, 0) + j, 
                        1], y = front2D[rep(j, 4), 2], z = c(z1, 
                        z1, z2, z2), col = "blue", alpha = alpha)
                      quads3d(x = front2D[rep(j + 1, 4), 1], 
                        y = front2D[c(0, 1, 1, 0) + j, 2], z = c(z1, 
                          z1, z2, z2), col = "darkblue", alpha = alpha)
                    }
                  }
                  quads3d(x = c(max(front2D[, 1]), bounds[2, 
                    1], bounds[2, 1], max(front2D[, 1])), y = rep(min(front2D[, 
                    2]), 4), z = c(z1, z1, z2, z2), col = "blue", 
                    alpha = alpha)
                  quads3d(y = c(max(front2D[, 2]), bounds[2, 
                    2], bounds[2, 2], max(front2D[, 2])), x = rep(min(front2D[, 
                    1]), 4), z = c(z2, z2, z1, z1), col = "darkblue", 
                    alpha = alpha)
                }
                paretoFront <- paretoFront[order(paretoFront[, 
                  1], decreasing = TRUE), , drop = FALSE]
                for (i in 1:(n.pareto)) {
                  if (i == 1) 
                    x2 <- bounds[2, 1]
                  else x2 <- paretoFront[i - 1, 1]
                  x1 <- paretoFront[i, 1]
                  front2D <- t(nondominated_points(t(paretoFront[(i:n.pareto), 
                    2:3, drop = FALSE])))
                  front2D <- front2D[order(front2D[, 1]), , drop = FALSE]
                  if (nrow(front2D) > 1) {
                    for (j in 1:(nrow(front2D) - 1)) {
                      quads3d(y = front2D[c(0, 1, 1, 0) + j, 
                        1], z = front2D[rep(j, 4), 2], x = c(x1, 
                        x1, x2, x2), col = "blue", alpha = alpha)
                    }
                  }
                  quads3d(y = c(max(front2D[, 1]), bounds[2, 
                    2], bounds[2, 2], max(front2D[, 1])), z = rep(min(front2D[, 
                    2]), 4), x = c(x1, x1, x2, x2), col = "blue", 
                    alpha = alpha)
                }
            }
        }
        else {
            cat("plotParetoEmp only works with 2 or 3 objectives \n")
        }
    }
}
<bytecode: 0x5618d0e7f5a8>
<environment: namespace:GPareto>
 --- function search by body ---
Function plotParetoEmp in namespace GPareto has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1