From 9b61304e1892bb153ad76e8bdf351df97d4b047a Mon Sep 17 00:00:00 2001
From: Mauricio Zambrano-Bigiarini <hzambran@users.noreply.github.com>
Date: Wed, 7 Nov 2012 13:21:40 +0000
Subject: [PATCH] hydroPSO.R: 'MinMax' and 'pbest.fit' removed as arguments of
 'ComputeSwarmRadiusAndDiameter'

---
 R/PSO_v2012.R | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/R/PSO_v2012.R b/R/PSO_v2012.R
index 8c1263c..c26d0ce 100755
--- a/R/PSO_v2012.R
+++ b/R/PSO_v2012.R
@@ -1063,19 +1063,17 @@ UpdateNgbest <- function(pbest.fit, ngbest, MinMax) {
 # Author : Mauricio Zambrano-Bigiarini
 # Started: 12-Jan-2011
 # Updates: 12-Jan-2011 ; 28-Oct-2011
-#          06-Nov-2012
+#          06-Nov-2012 ; 07-Nov-2012
 ################################################################################
-# Purpose: Function for computing the sarm radius, for detecting premature 
+# Purpose: Function for computing the swarm radius, for detecting premature 
 #          convergence, in order to avoid stagnation 
 ################################################################################
 # X      : matrix, with the current parameter values for all the particles
 # gbest  : numeric, with the parameter values for the best particle in the swarm
-# MinMax : character, indicating if PSO have to find a minimum or a 
-#          maximum for the fitness function.
 #          Valid values are in: c('min', 'max')
-# Lmax   : 
+# Lmax   : vector with the range of the search space in each dimension
  
-ComputeSwarmRadiusAndDiameter <- function(x, gbest, Lmax, MinMax, pbest.fit) {
+ComputeSwarmRadiusAndDiameter <- function(x, gbest, Lmax) {
   
   # number of parameters
   n <- ncol(x)
@@ -2617,12 +2615,10 @@ hydroPSO <- function(
 	gbest.fit.rate <- abs( ( gbest.fit - gbest.fit.prior ) / gbest.fit.prior )
       } else gbest.fit.rate <- +Inf
 
-      out <- ComputeSwarmRadiusAndDiameter(x=X.bak, gbest= X.best.part[gbest.pos, ], Lmax=Lmax, 
-					   MinMax=MinMax, pbest.fit=pbest.fit) 
+      out <- ComputeSwarmRadiusAndDiameter(x=X.bak, gbest= X.best.part[gbest.pos, ], Lmax=Lmax) 
       swarm.radius    <- out[["swarm.radius"]] 
       swarm.diameter  <- out[["swarm.diameter"]]
       NormSwarmRadius <- swarm.radius/swarm.diameter
-      #v.radius        <- out[["v.radius"]]
 
       if ( (verbose) & ( iter/REPORT == floor(iter/REPORT) ) ) 
 	   message( "iter:", format(iter, width=6, justify="right"), 
-- 
GitLab