From 389251032044c11d3c9245a53a41d9f97e4f0251 Mon Sep 17 00:00:00 2001
From: Mauricio Zambrano-Bigiarini <hzambran@users.noreply.github.com>
Date: Thu, 25 Oct 2012 16:46:34 +0000
Subject: [PATCH] 'hydroPSO' function: fixed computation of velocity for
 'method=canonical'

---
 R/PSO_v2012.R | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/R/PSO_v2012.R b/R/PSO_v2012.R
index 0bbcc59..619ae7f 100755
--- a/R/PSO_v2012.R
+++ b/R/PSO_v2012.R
@@ -252,7 +252,7 @@ compute.veloc <- function(x, v, w, c1, c2, CF, Pbest, part.index, gbest,
       
       #vn <- CF * (w*v + gx + alea.sphere(G=gx + x, radius=enorm(gx) ) )
   
-  } else if ( method=="spso2007" ) {
+  } else if ( method %in% c("spso2007", "canonical") ) {
   
            ifelse(part.index != localBest.pos,  
                   vn <- CF * ( w*v + r1*c1*(pbest-x) + r2*c2*(localBest-x) ),
-- 
GitLab