diff --git a/DESCRIPTION b/DESCRIPTION index c55e340ff78f5ffd15daadf8050a19522c9cb956..ee24579cff5d968769f6c9c928f8b5e6ae52561e 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: hydroPSO Type: Package Title: Model-Independent Particle Swarm Optimisation for Environmental Models -Version: 0.1-58-5 -Date: 2012-09-23 +Version: 0.1-58-6 +Date: 2012-09-24 Author: Mauricio Zambrano-Bigiarini [aut, cre] and Rodrigo Rojas [ctb] Authors@R: c(person("Mauricio", "Zambrano-Bigiarini", email="mzb.devel@gmail.com", role=c("aut","cre")), person("Rodrigo", "Rojas", email="Rodrigo.RojasMujica@gmail.com", role=c("ctb")) ) Maintainer: Mauricio Zambrano-Bigiarini <mzb.devel@gmail.com> diff --git a/NEWS b/NEWS index 8ded1ed33ff3cfa6e5892179ce96ecd3082fddaa..268a8ea8556bc6a8a25d090e77e6dd3957a3f27b 100755 --- a/NEWS +++ b/NEWS @@ -33,6 +33,13 @@ NEWS/ChangeLog for hydroPSO -) in the documentation, default values are now mentioned for each argument of 'control'. -) the 'PSO_logfile.txt' now contains information about: 'best.update', 'random.update', 'Xini.type', 'Vini.type'. In addition, information about 'IW.type' and 'IW.exp' is now written only when 'length(IW.w) > 1' + -) fixed velocity equation for 'boundary.wall="reflecting"' : + ver <= 0.1-58 -> ver >= 0.1-59 + v[t+1] : v[t] -> -v[t] (when x[t+1] > x_max | x[t+1] < x_min ) + -) changed velocity equation for 'boundary.wall="damping"' : + ver <= 0.1-58 -> ver >= 0.1-59 + v[t+1] : v[t] -> -v[t] (when x[t+1] > x_max | x[t+1] < x_min ) + o Running 'hydroPSO' >= 0.1-59 with default settings will produce DIFFERENT RESULTS from those obtained with 'hydroPSO' <= 0.1-58, due to the following changes in default values: @@ -40,11 +47,13 @@ NEWS/ChangeLog for hydroPSO -) npart : 10+2*[sqrt(n)] -> 40 -) Vini.type : 'lhs2007' -> 'random2011' -) boundary.wall: 'reflecting' -> 'absorbing2011' - + -) TVc1.type : 'non-linear' -> 'linear' (no effect, because 'use.TVc1=FALSE' by default) -) TVc2.type : 'non-linear' -> 'linear' (no effect, because 'use.TVc2=FALSE' by default) -) TVlambda.type: 'non-linear' -> 'linear' (no effect, because 'use.TVlambda=FALSE' by default) + -) boundary.wall: 'reflecting' in hydroPSO ver <= 0.1-58 is not longer equivalent to 'reflecting' in hydroPSO ver >= 0.1-58 + o 'test_functions': -) new benchmark functions: shifted sphere ('ssphere'), shifted Rosenbrock ('srosenbrock'), shifted Rastrigin ('srastrigin'), shifted Griewank ('sgriewank') and shifted Ackley ('sackley') diff --git a/R/PSO_v2012.R b/R/PSO_v2012.R index 042c4655ec13ee98e25ad351f9d66cd64639c444..3e78bd1c8ab66048da3f15301edb85a5caa8cd21 100755 --- a/R/PSO_v2012.R +++ b/R/PSO_v2012.R @@ -544,14 +544,14 @@ position.update.and.boundary.treatment <- function(x, v, x.MinMax, boundary.wall v.new[byd.min.pos] <- 0*v[byd.min.pos] } else if ( boundary.wall == "reflecting") { x.new[byd.min.pos] <- 2*x.min[byd.min.pos] - x.new[byd.min.pos] - v.new[byd.min.pos] <- v[byd.min.pos] + v.new[byd.min.pos] <- -v[byd.min.pos] } else if ( boundary.wall == "invisible") { x.new[byd.min.pos] <- x[byd.min.pos] v.new[byd.min.pos] <- v[byd.min.pos] } else if ( boundary.wall == "damping") { L <- abs( x.min[byd.min.pos] - x.new[byd.min.pos] ) x.new[byd.min.pos] <- x.min[byd.min.pos] + runif(1)*L - v.new[byd.min.pos] <- v[byd.min.pos] + v.new[byd.min.pos] <- -v[byd.min.pos] }# ELSE end } # IF end @@ -565,14 +565,14 @@ position.update.and.boundary.treatment <- function(x, v, x.MinMax, boundary.wall v.new[byd.max.pos] <- 0*v[byd.max.pos] } else if ( boundary.wall == "reflecting") { x.new[byd.max.pos] <- 2*x.max[byd.max.pos] - x.new[byd.max.pos] - v.new[byd.max.pos] <- v[byd.max.pos] + v.new[byd.max.pos] <- -v[byd.max.pos] } else if ( boundary.wall == "invisible") { x.new[byd.max.pos] <- x[byd.max.pos] v.new[byd.max.pos] <- v[byd.max.pos] } else if ( boundary.wall == "damping") { L <- abs( x.new[byd.max.pos] - x.max[byd.max.pos]) x.new[byd.max.pos] <- x.max[byd.max.pos] - runif(1)*L - v.new[byd.max.pos] <- v[byd.max.pos] + v.new[byd.max.pos] <- -v[byd.max.pos] }# ELSE end } # IF end @@ -2308,13 +2308,13 @@ hydroPSO <- function( ########################################################################## - if (normalise) X <- X * (upper.mat - lower.mat) + lower.mat + ifelse(normalise, Xn <- X * (upper.mat - lower.mat) + lower.mat, Xn <- X) # 3.a) Evaluate the particles fitness if ( fn.name != "hydromod" ) { # Evaluating an R Function - GoF <- apply(X, fn, MARGIN=1, ...) + GoF <- apply(Xn, fn, MARGIN=1, ...) Xt.fitness[iter, 1:npart] <- GoF ModelOut[1:npart] <- GoF ###