[Rcpp-commits] r2425 - in pkg/RcppDE: . scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 9 00:43:24 CET 2010


Author: edd
Date: 2010-11-09 00:43:23 +0100 (Tue, 09 Nov 2010)
New Revision: 2425

Added:
   pkg/RcppDE/scripts/benchmark.r
   pkg/RcppDE/scripts/bigBenchmark.r
   pkg/RcppDE/scripts/check.r
   pkg/RcppDE/scripts/compBenchmark.r
   pkg/RcppDE/scripts/openmp.r
   pkg/RcppDE/scripts/profile.r
Removed:
   pkg/RcppDE/benchmark.r
   pkg/RcppDE/bigBenchmark.r
   pkg/RcppDE/compBenchmark.r
   pkg/RcppDE/openmp.r
   pkg/RcppDE/profile.r
Log:
consolidated scripts in scripts/


Deleted: pkg/RcppDE/benchmark.r
===================================================================
--- pkg/RcppDE/benchmark.r	2010-11-08 23:41:34 UTC (rev 2424)
+++ pkg/RcppDE/benchmark.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -1,5 +0,0 @@
-#!/usr/bin/r -t
-
-svnver <- system("svnversion", intern=TRUE)
-cat("# small benchmark at SVN", svnver, "\n")
-source("demo/SmallBenchmark.R")

Deleted: pkg/RcppDE/bigBenchmark.r
===================================================================
--- pkg/RcppDE/bigBenchmark.r	2010-11-08 23:41:34 UTC (rev 2424)
+++ pkg/RcppDE/bigBenchmark.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -1,5 +0,0 @@
-#!/usr/bin/r -t
-
-svnver <- system("svnversion", intern=TRUE)
-cat("# big benchmark at SVN", svnver, "\n")
-source("demo/LargeBenchmark.R")

Deleted: pkg/RcppDE/compBenchmark.r
===================================================================
--- pkg/RcppDE/compBenchmark.r	2010-11-08 23:41:34 UTC (rev 2424)
+++ pkg/RcppDE/compBenchmark.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -1,5 +0,0 @@
-#!/usr/bin/r -t
-
-svnver <- system("svnversion", intern=TRUE)
-cat("# compiled benchmark at SVN", svnver, "\n")
-source("demo/CompiledBenchmark.R")

Deleted: pkg/RcppDE/openmp.r
===================================================================
--- pkg/RcppDE/openmp.r	2010-11-08 23:41:34 UTC (rev 2424)
+++ pkg/RcppDE/openmp.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -1,28 +0,0 @@
-#!/usr/bin/r -t
-#
-# with OpenMP we do not get the same uniform random number draws as we act in parallel, so just compare results (and timings)
-
-suppressMessages(library(DEoptim)) 	# the original, currently 2.0.7
-suppressMessages(library(RcppDE))    	# the contender
-
-Genrose <- function(x) { 	## One generalization of the Rosenbrock banana valley function (n parameters)
-    n <- length(x)
-    1.0 + sum (100 * (x[-n]^2 - x[-1])^2 + (x[-1] - 1)^2)
-}
-
-
-maxIt <- 500                           # not excessive but so that we get some run-time on simple problems
-n <- 40
-
-set.seed(42)
-print(system.time( {
-    res <- RcppDE::DEoptim(fn=Genrose, lower=rep(-25, n), upper=rep(25, n), control=list(NP=10*n, itermax=maxIt, trace=FALSE))
-    print(res[[1]])
-}))
-
-set.seed(42)
-print(system.time( {
-    res <- DEoptim::DEoptim(fn=Genrose, lower=rep(-25, n), upper=rep(25, n), control=list(NP=10*n, itermax=maxIt, trace=FALSE))
-    print(res[[1]])
-}))
-

Deleted: pkg/RcppDE/profile.r
===================================================================
--- pkg/RcppDE/profile.r	2010-11-08 23:41:34 UTC (rev 2424)
+++ pkg/RcppDE/profile.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -1,14 +0,0 @@
-#!/usr/bin/r -t
-
-suppressMessages(library(RcppDE))
-
-Genrose <- function(x) { 	## One generalization of the Rosenbrock banana valley function (n parameters)
-    n <- length(x)
-    1.0 + sum (100 * (x[-n]^2 - x[-1])^2 + (x[-1] - 1)^2)
-}
-
-
-maxIt <- 2500                            # not excessive but so that we get some run-time on simple problems
-n <- 100
-
-RcppDE::DEoptim(fn=Genrose, lower=rep(-25, n), upper=rep(25, n), control=list(NP=10*n, itermax=maxIt, trace=FALSE))

Copied: pkg/RcppDE/scripts/benchmark.r (from rev 2423, pkg/RcppDE/benchmark.r)
===================================================================
--- pkg/RcppDE/scripts/benchmark.r	                        (rev 0)
+++ pkg/RcppDE/scripts/benchmark.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -0,0 +1,5 @@
+#!/usr/bin/r -t
+
+svnver <- system("svnversion", intern=TRUE)
+cat("# small benchmark at SVN", svnver, "\n")
+source("demo/SmallBenchmark.R")

Copied: pkg/RcppDE/scripts/bigBenchmark.r (from rev 2423, pkg/RcppDE/bigBenchmark.r)
===================================================================
--- pkg/RcppDE/scripts/bigBenchmark.r	                        (rev 0)
+++ pkg/RcppDE/scripts/bigBenchmark.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -0,0 +1,5 @@
+#!/usr/bin/r -t
+
+svnver <- system("svnversion", intern=TRUE)
+cat("# big benchmark at SVN", svnver, "\n")
+source("demo/LargeBenchmark.R")

Added: pkg/RcppDE/scripts/check.r
===================================================================
--- pkg/RcppDE/scripts/check.r	                        (rev 0)
+++ pkg/RcppDE/scripts/check.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -0,0 +1,51 @@
+#!/usr/bin/r -t
+
+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) { 	## One generalization of the Rosenbrock banana valley function (n parameters)
+    n <- length(x)
+    1.0 + sum (100 * (x[-n]^2 - x[-1])^2 + (x[-1] - 1)^2)
+}
+
+#maxIt <- 100                            # not excessive but so that we get some run-time on simple problems
+n <- 20
+maxIt <- 50
+useBS <- TRUE
+storeFrom <- maxIt+1
+strat <- 6                              # TODO fix segfault when strat==6
+
+suppressMessages(library(DEoptim)) 	# the original, currently 2.0.7
+suppressMessages(library(RcppDE))    	# the contender
+
+ctrl <- DEoptim::DEoptim.control(NP=10*n,
+                                 itermax=maxIt,
+                                 trace=FALSE,
+                                 bs=useBS,
+                                 storepopfrom=storeFrom,
+                                 strategy=strat)
+
+basicDE <- function(n, maxIt, fun) DEoptim::DEoptim(fn=fun, lower=rep(-25, n), upper=rep(25, n), control=ctrl)
+cppDE <- function(n, maxIt, fun) RcppDE::DEoptim(fn=fun, lower=rep(-25, n), upper=rep(25, n), control=ctrl)
+
+set.seed(42)
+valBasic <- basicDE(n, maxIt, function(...) Rastrigin(...))
+#print(str(valBasic[[2]]))
+set.seed(42)
+valCpp <- cppDE(n, maxIt, function(...) Rastrigin(...))
+#print(str(valCpp[[2]]))
+stopifnot( all.equal(valBasic[[1]], valCpp[[1]]) )
+
+cat("# Done ", format(Sys.time()), "\n")
+
+
+
+
+
+
+


Property changes on: pkg/RcppDE/scripts/check.r
___________________________________________________________________
Added: svn:executable
   + *

Copied: pkg/RcppDE/scripts/compBenchmark.r (from rev 2423, pkg/RcppDE/compBenchmark.r)
===================================================================
--- pkg/RcppDE/scripts/compBenchmark.r	                        (rev 0)
+++ pkg/RcppDE/scripts/compBenchmark.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -0,0 +1,5 @@
+#!/usr/bin/r -t
+
+svnver <- system("svnversion", intern=TRUE)
+cat("# compiled benchmark at SVN", svnver, "\n")
+source("demo/CompiledBenchmark.R")

Copied: pkg/RcppDE/scripts/openmp.r (from rev 2423, pkg/RcppDE/openmp.r)
===================================================================
--- pkg/RcppDE/scripts/openmp.r	                        (rev 0)
+++ pkg/RcppDE/scripts/openmp.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -0,0 +1,28 @@
+#!/usr/bin/r -t
+#
+# with OpenMP we do not get the same uniform random number draws as we act in parallel, so just compare results (and timings)
+
+suppressMessages(library(DEoptim)) 	# the original, currently 2.0.7
+suppressMessages(library(RcppDE))    	# the contender
+
+Genrose <- function(x) { 	## One generalization of the Rosenbrock banana valley function (n parameters)
+    n <- length(x)
+    1.0 + sum (100 * (x[-n]^2 - x[-1])^2 + (x[-1] - 1)^2)
+}
+
+
+maxIt <- 500                           # not excessive but so that we get some run-time on simple problems
+n <- 40
+
+set.seed(42)
+print(system.time( {
+    res <- RcppDE::DEoptim(fn=Genrose, lower=rep(-25, n), upper=rep(25, n), control=list(NP=10*n, itermax=maxIt, trace=FALSE))
+    print(res[[1]])
+}))
+
+set.seed(42)
+print(system.time( {
+    res <- DEoptim::DEoptim(fn=Genrose, lower=rep(-25, n), upper=rep(25, n), control=list(NP=10*n, itermax=maxIt, trace=FALSE))
+    print(res[[1]])
+}))
+

Copied: pkg/RcppDE/scripts/profile.r (from rev 2423, pkg/RcppDE/profile.r)
===================================================================
--- pkg/RcppDE/scripts/profile.r	                        (rev 0)
+++ pkg/RcppDE/scripts/profile.r	2010-11-08 23:43:23 UTC (rev 2425)
@@ -0,0 +1,14 @@
+#!/usr/bin/r -t
+
+suppressMessages(library(RcppDE))
+
+Genrose <- function(x) { 	## One generalization of the Rosenbrock banana valley function (n parameters)
+    n <- length(x)
+    1.0 + sum (100 * (x[-n]^2 - x[-1])^2 + (x[-1] - 1)^2)
+}
+
+
+maxIt <- 2500                            # not excessive but so that we get some run-time on simple problems
+n <- 100
+
+RcppDE::DEoptim(fn=Genrose, lower=rep(-25, n), upper=rep(25, n), control=list(NP=10*n, itermax=maxIt, trace=FALSE))



More information about the Rcpp-commits mailing list