Running 'compTest.R' [170s]
  Running 'rosenbrock.R' [154s]
Running the tests in 'tests/compTest.R' failed.
Complete output:
  > 
  > Wild <- function(x) { 		## 'Wild' function, global minimum at about -15.81515
  +     sum(10 * sin(0.3 * x) * sin(1.3 * x^2) + 0.00001 * x^4 + 0.2 * x + 80)/length(x)
  + }
  > 
  > Rastrigin <- function(x) {
  +     sum(x+2 - 10 * cos(2*pi*x)) + 20
  + }
  > 
  > Genrose <- function(x, a = 1, b = 100) { 	## One generalization of the Rosenbrock banana valley function (n parameters)
  +     n <- length(x)
  +     1.0 + sum (b * (x[-n]^2 - x[-1])^2 + (x[-1] - a)^2)
  + }
  > 
  > maxIt <- 25         		# not excessive but so that we get some run-time on simple problems
  > 
  > haveDEoptim <- requireNamespace("DEoptim", quietly=TRUE)
  > 
  > suppressMessages({
  +     if (haveDEoptim) {
  +         library(DEoptim) 	# the original, currently 2.0.7
  +     }
  +     library(RcppDE) 		# the contender
  + })
  > 
  > basicDE <- function(n, maxIt, fun, ...) DEoptim::DEoptim(fn=fun, lower=rep(-25, n), upper=rep(25, n),
  +                                                          control=list(NP=10*n, itermax=maxIt, trace=FALSE),
  +                                                          ...)#, bs=TRUE))
  > cppDE <- function(n, maxIt, fun, ...) RcppDE::DEoptim(fn=fun, lower=rep(-25, n), upper=rep(25, n),
  +                                                       control=list(NP=10*n, itermax=maxIt, trace=FALSE),
  +                                                       ...)#, bs=TRUE))
  > 
  > if (haveDEoptim) {
  +     set.seed(42)
  +     valBasic <- basicDE(5, maxIt, function(...) Rastrigin(...))
  +     set.seed(42)
  +     valCpp <- cppDE(5, maxIt, function(...) Rastrigin(...))
  +     ##stopifnot( all.equal(valBasic, valCpp) )
  + }
  > 
  > runPair <- function(n, maxIt, fun, funname, ...) {
  +     gc()
  +     set.seed(42)
  +     bt <- system.time(invisible(ores <- basicDE(n, maxIt, fun, ...)))[3]
  + 
  +     gc()
  +     set.seed(42)
  +     xptr <- RcppDE:::putFunPtrInXPtr(funname)
  +     ct <- system.time(invisible(cres <- cppDE(n, maxIt, xptr, ...)))[3]
  + 
  +     #stopifnot(all.equal(ores, cres))
  + 
  +     gc()
  +     set.seed(42)
  +     rt <- system.time(invisible(rres <- cppDE(n, maxIt, fun, ...)))[3]
  + 
  +     ##stopifnot(all.equal(ores, rres))
  + 
  +     return(data.frame(DEoptim=bt, RcppDEc=ct, RcppDEr=rt))
  + }
  > 
  > if (haveDEoptim) {
  + 
  +     cat("# At", format(Sys.time()), "\n")
  +     options(width=120)
  + 
  +     reps <- c(5, 10, 20, 50)
  + 
  +     res <- rbind(do.call(rbind, lapply(reps, runPair, maxIt, function(...) Rastrigin(...), "rastrigin")),
  +                  do.call(rbind, lapply(reps, runPair, maxIt, function(...) Wild(...), "wild")),
  +                  do.call(rbind, lapply(reps, runPair, maxIt, function(...) Genrose(...), "genrose", a = 1, b = 100))
  +                  )
  +     res <- rbind(res, colMeans(res))
  + 
  +     rownames(res) <- c(paste("Rastrigin", reps, sep=""),
  +                        paste("Wild", reps, sep=""),
  +                        paste("Genrose", reps, sep=""),
  +                        "MEANS")
  + 
  +     res$ratioRcppCompToBasic <- res[,2]/res[,1]
  +     res$pctGainOfRcppComp <- (1-res[,2]/res[,1])*100
  +     ##res$netSpeedUpC <- res[,1]/res[,2]
  + 
  +     res$ratioRcppRToBasic <- res[,3]/res[,1]
  +     res$pctGainOfRcppR <- round((1-res[,3]/res[,1])*100, digits=3)
  +     ##res$netSpeedUpR <- res[,1]/res[,3]
  + 
  + 
  +     print(res)
  +     cat("# Done", format(Sys.time()), "\n")
  + }
  # At 2024-03-23 09:31:57 
                 DEoptim RcppDEc    RcppDEr ratioRcppCompToBasic pctGainOfRcppComp ratioRcppRToBasic pctGainOfRcppR
  Rastrigin5  0.02000000   0.000 0.02000000            0.0000000         100.00000         1.0000000          0.000
  Rastrigin10 0.02000000   0.000 0.00000000            0.0000000         100.00000         0.0000000        100.000
  Rastrigin20 0.04000000   0.020 0.03000000            0.5000000          50.00000         0.7500000         25.000
  Rastrigin50 0.17000000   0.040 0.11000000            0.2352941          76.47059         0.6470588         35.294
  Wild5       0.02000000   0.000 0.01000000            0.0000000         100.00000         0.5000000         50.000
  Wild10      0.02000000   0.020 0.01000000            1.0000000           0.00000         0.5000000         50.000
  Wild20      0.07000000   0.020 0.05000000            0.2857143          71.42857         0.7142857         28.571
  Wild50      0.32000000   0.070 0.25000000            0.2187500          78.12500         0.7812500         21.875
  Genrose5    0.02000000   0.000 0.00000000            0.0000000         100.00000         0.0000000        100.000
  Genrose10   0.02000000   0.000 0.01000000            0.0000000         100.00000         0.5000000         50.000
  Genrose20   0.06000000   0.000 0.03000000            0.0000000         100.00000         0.5000000         50.000
  Genrose50   0.25000000   0.010 0.12000000            0.0400000          96.00000         0.4800000         52.000
  MEANS       0.08583333   0.015 0.05333333            0.1747573          82.52427         0.6213592         37.864
  # Done 2024-03-23 09:32:02 
  > 
  > proc.time()
     user  system elapsed 
     5.23    0.29    5.46 
Running the tests in 'tests/rosenbrock.R' failed.
Complete output:
  > library(Rcpp)
  > library(RcppDE)
  Now loading:
    RcppDE: C++ Implementation of Differential Evolution Optimisation
    Author: Dirk Eddelbuettel
  Based on:
    DEoptim (version 2.0-7): Differential Evolution algorithm in R
    Authors: David Ardia, Katharine Mullen, Brian Peterson and Joshua Ulrich
  > 
  > set.seed(1234)
  > 
  > Rosenbrock <- function(x) {
  +   
  +   # briefly, calls to functions generated with Rcpp Attributes
  +   # could break optimizers due to incorrect sync of RNG state
  +   RcppDE:::putFunPtrInXPtr("dummy")
  +   
  +   x1 <- x[1]
  +   x2 <- x[2]
  +   100 * (x2 - x1 * x1) ^ 2 + (1 - x1) ^ 2
  + }
  > 
  > lower <- c(-10, -10)
  > upper <- -lower
  > cont <- DEoptim.control(trace = 0)
  > 
  > fit <- DEoptim(Rosenbrock, lower, upper, control = cont)
  > 
  > if (packageVersion("Rcpp") >= "0.12.17.1")
  +   stopifnot(all.equal(fit$optim$bestmem, c(par1 = 1, par2 = 1)))
  > 
  > proc.time()
     user  system elapsed 
     0.37    0.06    0.42