Learn R Programming

hydroPSO (version 0.1-58)

hydroPSO: Enhanced Particle Swarm Optimisation algorithm

Description

Particle Swarm Optimisation algorithm to calibrate environmental models. It includes a series of controlling options and PSO variants to improve the performance of the algorithm and customize it to different calibration problems

Usage

hydroPSO(par, fn= "hydromod", ..., method=c("pso", "ipso", "fips", "wfips"),
         lower=-Inf, upper=Inf, control=list(), 
         model.FUN=NULL, model.FUN.args=list() )

Arguments

par
OPTIONAL. numeric with a first guess for the parameters to be optimised (n, number of parameters and dimension of the solution space) All the particles are randomly initialised according to the value of Xini.type. If the user prov
fn
character, name of a valid R function to be optimised (minimized or maximized) or the character value 'hydromod'. -) When fn!='hydromod', the first argument of fn has to be a vector of parameters over which opti
...
OPTIONAL. Only used when fn!='hydromod'. further arguments to be passed to fn.
method
character, variant of the PSO algorithm to be used. Valid values are in c('pso', 'ipso', 'fips', 'wfips'): pso: at each iteration particles are attracted to its own best-known personal and to the best-known global position. Each p
lower
numeric, lower boundary for each parameter Note for optim users: in hydroPSO the length of lower and upper are used to defined the dimension of the solution space
upper
numeric, upper boundary for each parameter Note for optim users: in hydroPSO the length of lower and upper are used to defined the dimension of the solution space
control
a list of control parameters. See Details
model.FUN
OPTIONAL. Used only when fn='hydromod' character, valid R function representing the model code to be calibrated/optimised
model.FUN.args
OPTIONAL. Used only when fn='hydromod' list with the arguments to be passed to model.FUN

Value

  • A list, compatible with the output from optim, with components:
  • paroptimum parameter set found
  • valuevalue of fn corresponding to par
  • countsthree-element vector containing the number of function evaluations, number of iterations, and number of regrouping
  • convergenceinteger code where 0 indicates that the algorithm terminated by reaching the absolute tolerance, otherwise: [object Object],[object Object],[object Object]
  • messagecharacter string giving human-friendly information about convergence

Details

By default the hydroPSO function performs minimization of fn, but it will maximize fn if MinMax='max' The default control arguments in hydroPSO implements the Standard PSO 2007 - SPSO2007 (see Clerc 2005; Clerc et al., 2010). At the same time, hydroPSO function provides options for clamping the maximal velocity, regrouping strategy when premature convergence is detected, time-variant acceleration coefficients, time-varying maximum velocity, (non-)linear / random / adaptive / best-ratio inertia weight definitions, random or LHS initialization of positions and velocities, synchronous or asynchronous update, 4 alternative neighbourhood topologies among others

The control argument is a list that can supply any of the following components: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

References

Kennedy, J. and R. Eberhart. Particle Swarm Optimization. in proceedings IEEE international conference on Neural networks. pages 1942-1948. 1995. doi: 10.1109/ICNN.1995.488968 Kennedy, J.; Mendes, R.. Population structure and particle swarm performance. Evolutionary Computation, 2002. CEC '02. Proceedings of the 2002 Congress on , vol.2, no., pp.1671-1676, 2002. doi: 10.1109/CEC.2002.1004493

Kennedy, J.; Mendes, R.; , Neighborhood topologies in fully-informed and best-of-neighborhood particle swarms. Soft Computing in Industrial Applications, 2003. SMCia/03. Proceedings of the 2003 IEEE International Workshop on , vol., no., pp. 45- 50, 23-25 June 2003. doi: 10.1109/SMCIA.2003.1231342

Kennedy, J.; Small worlds and mega-minds: effects of neighborhood topology on particle swarm performance. Evolutionary Computation, 1999. CEC 99. Proceedings of the 1999 Congress on , vol.3, no., pp.3 vol. (xxxvii+2348), 1999. doi: 10.1109/CEC.1999.785509 Clerc, M and J Kennedy. The particle swarm - explosion, stability, and convergence in a multidimensional complex space. IEEE Transactions On Evolutionary Computation, 6:58-73, 2002. doi:10.1109/4235.985692

Clerc, M. Particle Swarm Optimization. ISTE, 2005

Clerc, M. From Theory to Practice in Particle Swarm Optimization, Handbook of Swarm Intelligence, Springer Berlin Heidelberg, 3-36, Eds: Panigrahi, Bijaya Ketan, Shi, Yuhui, Lim, Meng-Hiot, Hiot, Lim Meng, and Ong, Yew Soon, 2010, doi: 10.1007/978-3-642-17390-5_1

Clerc, M., Stagnation Analysis in Particle Swarm Optimisation or what happens when nothing happens. Technical Report. 2006. http://hal.archives-ouvertes.fr/hal-00122031

Clerc, M. Standard Particle Swarm. 2011. (SPSO-2007, SPSO-2011). clerc.maurice.free.fr/pso/SPSO_descriptions.pdf. Last visited [25-Jan-2012]

Chatterjee, A. and Siarry, P. Nonlinear inertia weight variation for dynamic adaptation in particle swarm optimization, Computers & Operations Research, Volume 33, Issue 3, March 2006, Pages 859-871, ISSN 0305-0548, DOI: 10.1016/j.cor.2004.08.012

Eberhart, R.C.; Shi, Y.; Comparing inertia weights and constriction factors in particle swarm optimization. Evolutionary Computation, 2000. Proceedings of the 2000 Congress on , vol.1, no., pp.84-88 vol.1, 2000. doi: 10.1109/CEC.2000.870279

Evers, G.I.; Ben Ghalia, M. Regrouping particle swarm optimization: A new global optimization algorithm with improved performance consistency across benchmarks. Systems, Man and Cybernetics, 2009. SMC 2009. IEEE International Conference on , vol., no., pp.3901-3908, 11-14 Oct. 2009. doi: 10.1109/ICSMC.2009.5346625

Huang, T.; Mohan, A.S.; , A hybrid boundary condition for robust particle swarm optimization. Antennas and Wireless Propagation Letters, IEEE , vol.4, no., pp. 112-117, 2005. doi: 10.1109/LAWP.2005.846166

Liu, B. and L. Wang, Y.-H. Jin, F. Tang, and D.-X. Huang. Improved particle swarm optimization combined with chaos. Chaos, Solitons & Fractals, vol. 25, no. 5, pp.1261-1271, Sep. 2005. doi:10.1016/j.chaos.2004.11.095

Mendes, R.; Kennedy, J.; Neves, J. The fully informed particle swarm: simpler, maybe better. Evolutionary Computation, IEEE Transactions on , vol.8, no.3, pp. 204-210, June 2004. doi: 10.1109/TEVC.2004.826074

Ratnaweera, A.; Halgamuge, S.K.; Watson, H.C. Self-organizing hierarchical particle swarm optimizer with time-varying acceleration coefficients. Evolutionary Computation, IEEE Transactions on , vol.8, no.3, pp. 240- 255, June 2004. doi: 10.1109/TEVC.2004.826071

Robinson, J.; Rahmat-Samii, Y.; Particle swarm optimization in electromagnetics. Antennas and Propagation, IEEE Transactions on , vol.52, no.2, pp. 397-407, Feb. 2004. doi: 10.1109/TAP.2004.823969

Shi, Y.; Eberhart, R. A modified particle swarm optimizer. Evolutionary Computation Proceedings, 1998. IEEE World Congress on Computational Intelligence. The 1998 IEEE International Conference on , vol., no., pp.69-73, 4-9 May 1998. doi: 10.1109/ICEC.1998.699146

Schor, D.; Kinsner, W.; Anderson, J.; , A study of optimal topologies in swarm intelligence. Electrical and Computer Engineering (CCECE), 2010 23rd Canadian Conference on , vol., no., pp.1-8, 2-5 May 2010. doi: 10.1109/CCECE.2010.5575132

Yong-Ling Zheng; Long-Hua Ma; Li-Yan Zhang; Ji-Xin Qian. On the convergence analysis and parameter selection in particle swarm optimization. Machine Learning and Cybernetics, 2003 International Conference on , vol.3, no., pp. 1802-1807 Vol.3, 2-5 Nov. 2003. doi: 10.1109/ICMLC.2003.1259789

Zhao, B. An Improved Particle Swarm Optimization Algorithm for Global Numerical Optimization. In Proceedings of International Conference on Computational Science (1). 2006, 657-664

Neighborhood Topologies, http://tracer.uc3m.es/tws/pso/neighborhood.html. Last visited [15-Feb-2012]

See Also

optim

Examples

Run this code
# Number of dimensions of the optimisation problem (for all the examples)
nparam <- 3

# Setting the home directory of the user as working directory 
setwd("~")
   
################################ 
# Example 1. Basic use         #
################################ 

# Setting the seed (for reproducible results)         
set.seed(100)

# Basic use. Rastrigin function (non-linear and multimodal with many local minima)
hydroPSO(fn="rastrigrin", lower=rep(-5.12, nparam), upper=rep(5.12, nparam) )

# Plotting the results
plot_results(MinMax="min") 

# Plotting the results and saving then into PNG files
plot_results(MinMax="min", do.png=TRUE)         

################################ 
# Example 2. More advanced use #
################################ 

# Setting the seed (for reproducible results)         
set.seed(100)

# Defining the swarm size ('npart'), the relative tolerance ('reltol'),
# the absolute tolerance ('abstol') and the frequency of report messages printed 
# to the screen ('REPORT')
hydroPSO( fn="rastrigrin", lower=rep(-5.12, nparam), upper=rep(5.12, nparam),    
        control=list(npart=15, reltol=1e-15, abstol=1e-14, REPORT=10) )
        
        
################################ 
# Example 3. Gbest Topology    #
# (or why is not recommended ) #
################################ 

# Setting the seed (for reproducible results)         
set.seed(100)

# Same as Example 2, but setting the topology to global gest ('topology="gbest"')
hydroPSO( fn="rastrigrin", lower=rep(-5.12, nparam), upper=rep(5.12, nparam),    
         control=list(npart=15, reltol=1e-15, abstol=1e-14, REPORT=10, 
                      topology="gbest") )
                      
                      
################################ 
# Example 4. Asynchronus update#
################################ 

# Setting the seed (for reproducible results)         
set.seed(100)

# Same as Example 3, but using asynchronus update of previus and local best 
# ('best.update="async"')
hydroPSO( fn="rastrigrin", lower=rep(-5.12, nparam), upper=rep(5.12, nparam),    
        control=list(npart=15, reltol=1e-15, abstol=1e-14, REPORT=10,
                     topology="gbest", best.update="async") ) # dontrun END

Run the code above in your browser using DataLab