[Rcpp-commits] r2343 - pkg/RcppDE/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 19 16:52:16 CEST 2010
Author: edd
Date: 2010-10-19 16:52:16 +0200 (Tue, 19 Oct 2010)
New Revision: 2343
Modified:
pkg/RcppDE/src/de4_0.cpp
Log:
added one set of curlies for local declaration on i_pbest
Modified: pkg/RcppDE/src/de4_0.cpp
===================================================================
--- pkg/RcppDE/src/de4_0.cpp 2010-10-19 14:48:54 UTC (rev 2342)
+++ pkg/RcppDE/src/de4_0.cpp 2010-10-19 14:52:16 UTC (rev 2343)
@@ -233,7 +233,7 @@
} while ((::unif_rand() < f_cross) && (++k < i_D));
break;
- case 6: // ---DE/current-to-p-best/1 (JADE)--------------------------------------------
+ case 6: { // ---DE/current-to-p-best/1 (JADE)--------------------------------------------
int i_pbest = sortIndex[static_cast<int>(::unif_rand() * p_NP)]; // select from [0, 1, 2, ..., (pNP-1)]
j = static_cast<int>(::unif_rand() * i_D); // random parameter
do { // add fluctuation to random target
@@ -241,7 +241,7 @@
j = (j + 1) % i_D;
} while ((::unif_rand() < f_cross) && (++k < i_D));
break;
-
+ }
default: // ---variation to DE/rand/1/bin: either-or-algorithm--------------------------
j = static_cast<int>(::unif_rand() * i_D); // random parameter
if (::unif_rand() < 0.5) { // differential mutation, Pmu = 0.5
More information about the Rcpp-commits
mailing list