[Rcpp-devel] Patch to RcppDE vignette -- Refs

Christian Gunning xian at unm.edu
Thu Jan 6 08:17:27 CET 2011


Attached is a small diff to the RcppDE vignette.  I added 2 well-cited
primary lit papers that are helpful (and internet available)
introductions to DE.  While I was at it, I ran the doc through the
spell-checker :).

-Christian
-------------- next part --------------
Index: RcppDE.Rnw
===================================================================
--- RcppDE.Rnw	(revision 2835)
+++ RcppDE.Rnw	(working copy)
@@ -89,12 +89,17 @@
 \pkg{DEoptim}
 \citep{MullenArdiaEtAl:2009:DEoptim,ArdiaBoudtCarlEtAl:2010:DEoptim,CRAN:DEoptim}
 provides differential evolution optimisation for the \proglang{R} language
-and statistical environement.  Differential optimisation is one of several
-evolutionary computing approaches; genetic algorithns and simulated annealing
-are two other ones.  Differential optimisation is reasonably close to genetic
+and statistical environment.  Differential evolution 
+\citep{StornPrice:1997:Differential} is one of several
+evolutionary computing approaches to the global optimisation of arbitrary 
+objective functions; genetic algorithms and simulated annealing
+are two others.  Differential evolution is reasonably close to genetic
 algorithms but differs in one key aspect: parameter values are encoded as
-floating point values (rather than sequences of binary digits) which makes it
-particular suitable for real-valued optimisation problems.
+floating point values (rather than sequences of binary digits), which makes it
+particular suitable for real-valued optimisation problems. The relative
+performance of differential evolution compared to other global optimisation
+algorithms, as well as optimal parametrization, is reviewed in 
+\citet{StornPrice:1997:Differential} and \citet{VesterstromThomsen:2004:Comparative}.
 
 \pkg{DEoptim} is based on an implementation by Storn
 \citep{PriceStornLampinen:2006:DE}. It was originally implemented as an
@@ -133,7 +138,7 @@
   covers other aspects such as the automatic type conversion offered by
   \pkg{Rcpp} as well as the automatic memory management: by replacing
   allocation and freeing of heap-based dynamic memory, a consistent source of
-  programmer error would be elimnated---plus we are not trying `short and
+  programmer error would be eliminated---plus we are not trying `short and
   incomprehensible' in the APL-sense but aim for possible improvements on
   \textsl{both} the length and the ease of comprehension without trading one
   off against the other;
@@ -149,10 +154,10 @@
 \end{itemize}
 
 This paper is organised as follows. The next sections describes the structure
-of \pkg{DEoptim} which \pkg{RcppDE} shadows closesly. The following two
+of \pkg{DEoptim} which \pkg{RcppDE} shadows closely. The following two
 section compare differences at the \proglang{R} and \proglang{C++} level,
-respectively. Next, changes in auxiliarry files are discussed before we
-review changes in perfomance. A summary concludes. The appendix contains a
+respectively. Next, changes in auxiliary files are discussed before we
+review changes in performance. A summary concludes. The appendix contains a
 list of figures contrasting the two implementations.
 
 \section[DEoptim structure]{\pkg{DEoptim} structure}
@@ -205,7 +210,7 @@
 routine) and \verb|permute()| (which is a helper function used to shuffle
 indices).
 
-The evalution function has been replaced by a base class and two virtual
+The evaluation function has been replaced by a base class and two virtual
 classes. These can now make use of objective functions written in
 \proglang{R} (as in \pkg{DEoptim}) as well as ones written in
 \proglang{C++}. Using compiled objective functions can lead to substantial
@@ -279,12 +284,12 @@
   types corresponding to base typed \verb|int|, \verb|double| etc. Also of
   note is how one matrix object (\texttt{initialpom} for seeding a first
   population of parameter values) is initialized directly from a parameter.
-\item Paremeter lookup is by a string value but done using the \pkg{Rcpp} lookup
+\item Parameter lookup is by a string value but done using the \pkg{Rcpp} lookup
   of elements in the \verb|list| type (which corresponds to the \proglang{R}
   list passed in) rather than via a (functionally similar but ad-hoc) function
   \verb|getListElement| that hence is not longer needed in \pkg{RcppDE}.
 \item Here as in later code examples, care was taken to ensure that variable
-  names and types correpond closely between both variants.
+  names and types correspond closely between both variants.
 \end{enumerate}
 
 \paragraph{Part 2: Middle of \texttt{DEoptim()}} The second part,
@@ -300,7 +305,7 @@
 \begin{enumerate}
 \item Matrix objects are created in \proglang{C} by first allocating a vector
   of pointers to pointers, which is followed by a loop in which each each
-  column is allocated as vector of approrpriate length.
+  column is allocated as vector of appropriate length.
 \item In \proglang{C++}, allocating a matrix is a single statement. Memory is
   managed by reference counting and is freed when objects go out of
   scope. This removes a \textsl{significant} portion of programmer errors.
@@ -362,7 +367,7 @@
 \paragraph{Part 1: Start of \texttt{devol()}} The first part concerns the
 beginning of the \verb|devol()|. The display (in
 figure~\ref{fig:devol_start}) of panels A and B differs mostly in minor
-ascpects:
+aspects:
 \begin{enumerate}
 \item The \proglang{C} version contains a declaration of a number of loop
   variable that are either not needed at all in the \proglang{C++} version,
@@ -372,7 +377,7 @@
 \item The \proglang{C++} version has an additional short block to set up the
   proper evaluation class for the user supplied function, depending on
   whether an external pointer object is passed (in which case we expect a
-  compiled functin) or not in which case an \proglang{R} routine is used,
+  compiled function) or not in which case an \proglang{R} routine is used,
   just like in \pkg{DEoptim}.
 \item The \texttt{sortIndex} vector is filled with index only in case
   strategy six has been selected as it is not used otherwise.
@@ -415,12 +420,12 @@
 \item Intermediate populations are stored directly in a list, after being
   transposed to account for our design choice of operating column-wise. In
   the \proglang{C} code, the matrices are somewhat awkwardly `serialised'
-  into a single vector using the counter \texttt{popcnt} that incremened
+  into a single vector using the counter \texttt{popcnt} that incremented
   position by position.
-\item Several other vector copies are each excecuted in a single statement rather
+\item Several other vector copies are each executed in a single statement rather
   than in an explicit loop.
 \item At the beginning of the population loop, a vector is once more stored
-  in a temporary variable and the permuation algoritm is called to pick
+  in a temporary variable and the permutation algorithm is called to pick
   suitable indices which will be used next.
 \end{enumerate}
 
@@ -471,7 +476,7 @@
 
 \paragraph{Part 8: End  of  \texttt{devol()}}
 
-Finallt, figure~\ref{fig:devol_return} contains the final portion of the
+Finally, figure~\ref{fig:devol_return} contains the final portion of the
 \verb|devol()| function. The population and its fitness value are saved. If
 the \texttt{checkWinner} option of the control structure has been changed by
 the user from the default value of false, a possible re-evaluation of the
@@ -492,7 +497,7 @@
 \pkg{RcppDE} is much longer than the code in \pkg{DEoptim}.  This is due to a
 key main extension in \pkg{RcppDE}: the ability to use not only an
 \proglang{R} function to describe the objective function to be
-minimmized---but also a compiled function.
+minimized---but also a compiled function.
 
 This is implemented by means of common \proglang{C++} idiom: an abstract base
 class, here called \texttt{EvalBase}. This is an empty class which contains
@@ -533,7 +538,7 @@
   auxiliary arguments to the function in the same way the variable arguments
   would.
 \item \pkg{RcppDE} therefore has an additional argument \texttt{env} for the
-  user-supplied environement, as well as an additional creation of a default
+  user-supplied environment, as well as an additional creation of a default
   environment if none was supplied.
 \item Population matrices are passed from \proglang{C++} to \proglang{R} as
   matrix objects; no copy or rearrangement has to be undertaken.  This saves
@@ -559,7 +564,7 @@
 Three standard test functions (Wild, Rastrigin, Genrose) are run for four
 sets of parameter vector sizes---for both \pkg{RcppDE} and
 \pkg{DEoptim}. This ensures that results are identical between both
-implenations.
+implementation.
 
 Adding full regression testing is left for a future version of \pkg{RcppDE}.
 
@@ -739,8 +744,8 @@
 \end{figure}
 
 Figure~\ref{fig:largeResults} display results from the running the same three
-test functions for larger paramters vectors of size fifty, one hundred and
-two hundred, respetively.
+test functions for larger parameters vectors of size fifty, one hundred and
+two hundred, respectively.
 
 As in the preceding figure~\ref{fig:smallResults}, using \pkg{RcppDE} rather
 than \pkg{DEoptim} on these optimization problems provides a consistent
@@ -817,7 +822,7 @@
 functions used were written in \proglang{R}.
 
 This paper also introduces a performance gain with allows the analysts to
-deplay differential evolution optimisation within  \proglang{R}, but via a
+deploy differential evolution optimisation within  \proglang{R}, but via a
 compiled objective function.  This approach can yield more dramatic gains as
 was seen in section~\ref{subsec:compiled}.  Of course, the `No Free Lunch'
 theorem still holds: writing such an objective function may well be more
@@ -834,7 +839,7 @@
 The \pkg{RcppDE} package presented in this paper started from a simple
 question.  Could we start from \pkg{DEoptim} and, by relying on the
 \pkg{Rcpp} and \pkg{RcppArmadillo} packages, achieve what the the quip
-\textsl{Shorter, Faster, Easier: Pick Any Three} alludes to: simulataneous
+\textsl{Shorter, Faster, Easier: Pick Any Three} alludes to: simultaneous
 improvements in code length, expressiveness (while maintaining
 comprehensibility) and at the same time gain in performance?
 
@@ -855,7 +860,7 @@
 Section~\ref{sec:performance} presented results of consistent performance
 gains of \pkg{Rcpp} over \pkg{DEoptim} across all test functions and all
 parameters vector sizes that were examined in this paper. Particularly
-noteworthy improvements in performancen were obtained with the compiled
+noteworthy improvements in performance were obtained with the compiled
 objective functions that are possible with \pkg{RcppDE}.
 
 As for the third part and whether this makes using or extending the code
@@ -867,7 +872,7 @@
 investigation.  In the meantime, the relative ease with which the extension
 for compiled objective function has been added may be an indication of the
 possible benefits from using \proglang{C++}. So this is not yet fully proven,
-but some benefits have already been demostrated.
+but some benefits have already been demonstrated.
 
 Concluding, we can score the approach presented here at a careful \textsl{2
   1/2 out of 3 possible points}. Going from \pkg{DEoptim} to \pkg{RcppDE} has
@@ -1332,7 +1337,7 @@
     \tiny
     \begin{CodeChunk}
       \begin{CodeInput}
-  /* initialize initial popuplation */
+  /* initialize initial population */
   for (int i = 0; i < i_NP; i++) {
     for (int j = 0; j < i_D; j++) {
       initialpop[i][j] = 0.0;
@@ -1434,7 +1439,7 @@
 
     \begin{CodeChunk}
       \begin{CodeInput}
-    initialpop.zeros();                         // initialize initial popuplation
+    initialpop.zeros();                         // initialize initial population
     d_bestmemit.zeros();                        // initialize best members
     d_bestvalit.zeros();                        // initialize best values
     d_pop.zeros();                              // initialize best population
@@ -2225,7 +2230,7 @@
 	    }
 	private:
 	    SEXP fcall, env;
-	    double defaultfun(SEXP par) { 		// essentialy the same as the old evaluate
+	    double defaultfun(SEXP par) { 		// essentially the same as the old evaluate
 		SEXP fn = ::Rf_lang2(fcall, par); 	// this could be done with Rcpp
 		SEXP sexp_fvec = ::Rf_eval(fn, env);	// but is still a lot slower right now
 		double f_result = REAL(sexp_fvec)[0];
Index: RcppDE.bib
===================================================================
--- RcppDE.bib	(revision 2835)
+++ RcppDE.bib	(working copy)
@@ -91,6 +91,32 @@
   note =	 {ISBN 3540209506}
 }
 
+ at conference{VesterstromThomsen:2004:Comparative,
+  title =   {A comparative study of differential evolution, particle swarm optimization, and evolutionary algorithms on numerical benchmark problems},
+  author =  {Vesterstrom, J. and Thomsen, R.},
+  booktitle =   {Evolutionary Computation, 2004. CEC2004. Congress on},
+  volume =  {2},
+  pages =   {1980--1987},
+  isbn =    {0780385152},
+  year =    {2004},
+  url = "http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=1331139",
+  organization =    {IEEE}
+}
+
+ at article{StornPrice:1997:Differential,
+  title =    {Differential evolution--a simple and efficient heuristic for global optimization over continuous spaces},
+  author =  {Storn, R. and Price, K.},
+  journal = {Journal of global optimization},
+  volume =  {11},
+  number =  {4},
+  pages =   {341--359},
+  issn =    {0925-5001},
+  year =    {1997},
+  url =     "http://www.springerlink.com/content/x555692233083677/fulltext.pdf",
+  publisher =   {Springer}
+}
+
+
 @TechReport{Sanderson:2010:Armadillo,
   author =	 {Conrad Sanderson},
   title =	 {{Armadillo}: {An} open source {C++} Algebra Library


More information about the Rcpp-devel mailing list