[Rcpp-commits] r2324 - pkg/RcppDE/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Oct 17 00:13:19 CEST 2010


Author: edd
Date: 2010-10-17 00:13:19 +0200 (Sun, 17 Oct 2010)
New Revision: 2324

Modified:
   pkg/RcppDE/src/de4_0.cpp
Log:
save one extra layer of initialpop copying for now reason


Modified: pkg/RcppDE/src/de4_0.cpp
===================================================================
--- pkg/RcppDE/src/de4_0.cpp	2010-10-16 22:10:24 UTC (rev 2323)
+++ pkg/RcppDE/src/de4_0.cpp	2010-10-16 22:13:19 UTC (rev 2324)
@@ -96,7 +96,7 @@
 void devol(double VTR, double f_weight, double f_cross, int i_bs_flag,
            arma::rowvec & fa_minbound, arma::rowvec & fa_maxbound, SEXP fcall, SEXP rho, int i_trace,
            int i_strategy, int i_D, int i_NP, int i_itermax,
-           arma::mat & initialpopm, int i_storepopfrom, int i_storepopfreq, 
+           arma::mat & initialpop, int i_storepopfrom, int i_storepopfreq, 
            int i_specinitialpop, int i_check_winner, int i_av_winner,
            arma::mat &ta_popP, arma::mat &ta_oldP, arma::mat &ta_newP, 
 	   arma::rowvec & t_bestP, arma::rowvec & ta_popC, arma::rowvec & ta_oldC, arma::rowvec & ta_newC, 
@@ -116,8 +116,6 @@
     int i_xav, popcnt, bestacnt, same; 		// lazy cnters 
     double f_jitter, f_dither, t_bestitC, t_tmpC, tmp_best, tempC; 
     
-    arma::mat initialpop(i_NP, i_D); 
-
     int i_pbest;    				// vars for DE/current-to-p-best/1 
     int p_NP = round(i_pPct * i_NP);  		// choose at least two best solutions 
     p_NP = p_NP < 2 ? 2 : p_NP;
@@ -130,23 +128,12 @@
 
     ta_popP.at(0,0) = 0;
     
-    initialpop.zeros();		 		// initialize initial popuplation 
     d_bestmemit.zeros();    			// initialize best members
     d_bestvalit.zeros();			// initialize best values 
     d_pop.zeros();				// initialize best population
     d_storepop.zeros();				// initialize stored populations 
     i_nstorepop = (i_nstorepop < 0) ? 0 : i_nstorepop;
       
-    if (i_specinitialpop > 0) {    		// if initial population provided, initialize with values 
-	// k = 0;
-	// for (j = 0; j < i_D; j++) { 		// FIXME: should really have a matrix passed in ! 
-	//     for (i = 0; i < i_NP; i++) {
-	// 	initialpop.at(i,j) = initialpopv[k];
-	// 	k += 1;
-	//     }
-	// }
-	initialpop = initialpopm;
-    }
     l_nfeval = 0;    				// number of function evaluations (this is an input via DEoptim.control, but we over-write it?) 
 
     for (i = 0; i < i_NP; i++) {		// ------Initialization-----------------------------



More information about the Rcpp-commits mailing list