hydroPSO: hydroPSO:
A A
Versatile Versatile Particle Particle Swarm Swarm Optimisation Optimisation Calibration Calibration of of Environmental Environmental Models Models
R R
Package Package
for for
EGU2012-10950 Session: HS3.3 Apr 25th, 2012
Mauricio Mauricio Zambrano-Bigiarini Zambrano-Bigiarini and and Rodrigo Rodrigo Rojas Rojas
1) Motivation
5) Fine-tuning Options
Parameter optimisation techniques are generally implemented in customised pieces of (proprietary) software, which have to be strongly modified to set up the calibration of alternative environmental models. The latter deprives the user of the flexibility to easily reuse existing calibration codes without having to invest considerable time and effort.
2) Aim To present and illustrate the application of hydroPSO, a new global optimisation R package specifically designed to calibrate complex real-world environmental models.
● ● ●
●
● ●
●
●
● ●
Model-independent Multi-platform (GNU/Linux, Windows, Mac OS X) State-of-the-art Particle Swarm Optimisation (PSO) as calibration engine Minimal user intervention to interface the model code with the calibration engine Easy plotting of results Sensitivity analysis by using the Latin-Hypercube Onefactor-At-a-Time (LH-OAT, van Griensven et al., 2006) Calibration engine validated against the Standard PSO 2007 (SPSO 2007, Clerc 2011) Several fine-tuning options and PSO variants to tackle different kinds of optimisation problems Open-source code (GPL >=2) Binaries, user manual, and vignette (tutorial) are available on http://www.rforge.net/hydroPSO/
Function
Value(s)
ω
use.IW IW.type
linear, non-linear, adaptive inertia weight factor (aiwf), global-local best ratio, random
c1
c1,use.TVc1, TVc2.type
linear, non-linear, global-local best ratio
read_results()
c2
c2,use.TVc2, TVc2.type
linear, non-linear
read_velocities()
Boundary condition
boundary.wall
absorbing, invisible, reflecting, damping
read_out()
Regrouping
use.RG
TRUE/FALSE
read_convergence()
Initial positions
Xini.type
random, lhs
Initial velocites
Vini.type
random, lhs, zero
Updates
best.update
Maximum velocity
3) hydroPSO: Key Features
6) hydroPSO Main Functions
hydroPSO Option
PSO Parameter
synchronous, asynchronous
use.TVlambda, linear, non-linear TVlambda.type
Topology
topology
PSO variant
method
gbest, lbest, vonNeumann, random pso, fips, wfips, ipso
Joint Research Centre
lhoat() hydromod() hydroPSO() read_particles()
Short Description Sensitivity analysis using LH-OAT (van Griensven et al.,2006) Run the model code to be calibrated Platform- and model-independent PSO calibration engine Reading hydroPSO() results. It is a wrapper to: Reading ”Particles.txt” output file Reading ”Velocities.txt” output file Reading ”Model_output.txt” output file
Reading ”ConvergenceMeasures.txt” output file read_GofPerParticle() Reading ”Particles_GofPerIter.txt” output file plot_results()
Plotting hydroPSO()results. It is a wrapper to:
plot_particles()
Plotting sampled parameters (histograms, dotty plots, ...) Plotting evolution of particle velocities Plotting model outputs against observations Plotting convergence measures (optimum and swarm radious)
plot_velocities() plot_out() plot_convergence()
plot_GofPerParticle() Plotting the evolution of the goodness-of-fit per each particle verification() Runs the model code with one or more parameter sets test_functions()
Fig 02. Dotty plots showing the model performance versus parameter values, for three selected parameters (SWAT-2005 case study). Vertical red line indicates the optimum parameter value.
Six n-dimensional benchmark functions included: Sphere, Rosenbrock, Rastrigin, Griewank, Ackley and Schaffer F6. Useful to test the PSO configuration performance for different types of calibration problems.
7) Case Studies
Fig 01. Interactions among the main hydroPSO functions. User-defined files ParamRanges.txt and ParamFiles.txt defines which parameters are to be calibrated and where they have to be modified, respectively. R functions out.FUN() and gof.FUN() are used along with observations to read model outputs and to assess model performance, respectively. Light-blue shaded boxes indicate some user intervention.
Application Feature Platform Type of model
SWAT-2005 GNU/Linux Semi-distributed, surface hydrology
Modflow-2005 Windows 7 Fully-distributed, groundwater
hydroPSO-model interface
Basic, through available R functions
Advanced, through user-defined R functions
Executable model code Single file (swat2005.out) Simulated model outputs Continuous-time, single-site Goodness-of-fit measure Pre-defined Nash-Sutcliffe efficiency
Fig 03. Evolution of parameter values along number of model evaluations for three selected parameters (SWAT-2005 case study).
Sequential batch file (*.bat) Steady-state, multi-site User-defined Gaussian Likelihood
8) Concluding Remarks 4) Particle Swarm Optimisation (PSO)
●
PSO (Kennedy and Eberhart, 1995) is a population-based stochastic optimisation technique inspired by the social behaviour of bird flocking.
●
●
●
Each individual of the population adjuts its flying trajectory around the multi-dimensional search space according to its own flying experience (local search) and that of neighbouring particles (global search):
●
●
global search
local search
V i t 1 = V i t c1 U 1t P 1 − X it c2 U 2t G − X i t
9) Ongoing research:
X i t 1 = X i t V i t 1 ●
●
●
●
X i t : i-th particle position at iteration t t
V i : i-th particle velocity at iteration t P i : i-th particle best-known position G
: neighbourhood best-known position
●
ω : inertia weigth
●
c1 : cognitive aceleration coefficient
●
c2 : social aceleration coefficient
U 1 t, U 2 t: independent and uniformly distributed random vectors
●
www.jrc.europa.eu
hydroPSO provides an efficient and ready-to-use global optimisation engine for the calibration of different environmental models hydroPSO allows to carry out a typical modelling exercise: sensitivity analysis, model calibration and assessment of results For specific problems, a customised PSO configuration will have a significant impact on the optimisation results Results in two case studies show that hydroPSO is effective and efficient in finding optimal solutions compared to intensive MCMC-based techniques hydroPSO shows an outstanding flexibility to tackle several types of optimisation problems commonly faced by the modelling community (see point 7) Given the versatility added by the R environment and the large amount of packages available, we believe hydroPSO can be applied to a wide class of environmental models requiring some form of parameter optimisation
Fig 04. Evolution of the global optimum (Gaussian likelihood) and the normalised swarm radious (δnorm) along the iterations (Modflow-2005 case study).
● ●
Multi-core/parallel support, to alleviate the computational burden Multi-objective implementation, to tackle a wider class of optimisation problems
References: Fig 05. Gaussian likelihood response surface projected onto the parameter space (pseudo 3D-dotty plots) for selected parameters. Panels show “behavioural” samples with L > 3.8x10-2. For a subset of parameters (Modflow-2005 case study).
Mauricio Zambrano-Bigiarini and Rodrigo Rojas European Commission • Joint Research Centre • Institute for Environment and Sustainability Tel. +39 0332 789588 • Email:
[email protected]
●
Zambrano-Bigiarini, M., and R. Rojas (2012), hydroPSO: A model-independent particle swarm optimization software for calibration of environmental models, Environmental Modelling & Software, submitted
●
● ●
Kennedy, J., and R. Eberhart (1995), Particle swarm optimization, in Proceedings IEEE International Conference on Neural Networks, 1995, vol. 4, pp. 1942– 1948, doi: 10.1109/ICNN.1995.488968. Clerc, M., 2011. Standard particle swarm optimisation. http://clerc.maurice.free.fr/pso/SPSO_descriptions.pdf. [Online; last accessed Apr-2011]. van Griensven, A., T. Meixner, S. Grunwald, T. Bishop, M. Diluzio, and R. Srinivasan (2006), A global sensitivity analysis tool for the parameters of multivariable catchment models, Journal of Hydrology, 324 (1–4), 10–23, doi: 10.1016/j.jhydrol.2005.09.008.