hydropso: a versatile particle swarm optimisation r package for calibration of environmental models...

1
hydroPSO: A Versatile Particle Swarm Optimisation R Package for hydroPSO: A Versatile Particle Swarm Optimisation R Package for Calibration of Environmental Models Calibration of Environmental Models hydroPSO: A Versatile Particle Swarm Optimisation R Package for hydroPSO: A Versatile Particle Swarm Optimisation R Package for Calibration of Environmental Models Calibration of Environmental Models Mauricio Zambrano-Bigiarini and Rodrigo Rojas Mauricio Zambrano-Bigiarini and Rodrigo Rojas EGU2012-10950 Session: HS3.3 Apr 25 th , 2012 Mauricio Zambrano-Bigiarini and Rodrigo Rojas European Commission • Joint Research Centre • Institute for Environment and Sustainability Tel. +39 0332 789588 • Email: [email protected] www.jrc.europa.eu Joint Research Centre 1) Motivation 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. 3) hydroPSO: Key Features 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 One- factor-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/ 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. References: 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 multi- variable catchment models, Journal of Hydrology, 324 (1–4), 10–23, doi: 10.1016/j.jhydrol.2005.09.008. 8) Concluding Remarks 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 9) Ongoing research: Multi-core/parallel support, to alleviate the computational burden Multi-objective implementation, to tackle a wider class of optimisation problems 6) hydroPSO Main Functions Function Short Description lhoat() Sensitivity analysis using LH-OAT (van Griensven et al.,2006) hydromod() Run the model code to be calibrated hydroPSO() Platform- and model-independent PSO calibration engine read_results() Reading hydroPSO() results. It is a wrapper to:     read_particles() Reading Particles.txtoutput file     read_velocities() Reading Velocities.txt” output file     read_out() Reading Model_output.txtoutput file     read_convergence() Reading ConvergenceMeasures.txtoutput 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, ...)     plot_velocities() Plotting evolution of particle velocities     plot_out() Plotting model outputs against observations     plot_convergence() Plotting convergence measures (optimum and swarm radious)     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() 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 Application Feature SWAT-2005 Modflow-2005 Platform GNU/Linux Windows 7 Type of model Semi-distributed, surface hydrology Fully-distributed, groundwater hydroPSO-model interface Basic, through available R functions Advanced, through user-defined R functions Executable model code Single file (swat2005.out) Sequential batch file (*.bat) Simulated model outputs Continuous-time, single-site Steady-state, multi-site Goodness-of-fit measure Pre-defined Nash-Sutcliffe efficiency User-defined Gaussian Likelihood 4) Particle Swarm Optimisation (PSO) 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): PSO (Kennedy and Eberhart, 1995) is a population-based stochastic optimisation technique inspired by the social behaviour of bird flocking. ω : inertia weigth c 1 : cognitive aceleration coefficient c 2 : social aceleration coefficient U 1 t , U 2 t : independent and uniformly distributed random vectors X i t : i-th particle position at iteration t V i t : i-th particle velocity at iteration t P i : i-th particle best-known position G : neighbourhood best-known position V i t 1 = V i t c 1 U 1 t P 1 X i t c 2 U 2 t G X i t X i t 1 = X i t V i t 1 local search global search 5) Fine-tuning Options PSO Parameter hydroPSO Option Value(s) ω use.IW IW.type linear, non-linear, adaptive inertia weight factor (aiwf), global-local best ratio, random c 1 c1,use.TVc1, TVc2.type linear, non-linear, global-local best ratio c 2 c2,use.TVc2, TVc2.type linear, non-linear Boundary condition boundary.wall absorbing, invisible, reflecting, damping Regrouping use.RG TRUE/FALSE Initial positions Xini.type random, lhs Initial velocites Vini.type random, lhs, zero Updates best.update synchronous, asynchronous Maximum velocity use.TVlambda, TVlambda.type linear, non-linear Topology topology gbest, lbest, vonNeumann, random PSO variant method pso, fips, wfips, ipso 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. Fig 03. Evolution of parameter values along number of model evaluations for three selected parameters (SWAT-2005 case study). Fig 04. Evolution of the global optimum (Gaussian likelihood) and the normalised swarm radious (δnorm) along the iterations (Modflow-2005 case study). 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. 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).

Upload: mauricio-zambrano-bigiarini

Post on 18-Jul-2015

1.031 views

Category:

Education


3 download

TRANSCRIPT

Page 1: hydroPSO: A Versatile Particle Swarm Optimisation R Package for Calibration of Environmental Models (EGU 2012)

hydroPSO: A Versatile Particle Swarm Optimisation R Package for hydroPSO: A Versatile Particle Swarm Optimisation R Package for Calibration of Environmental ModelsCalibration of Environmental Models

hydroPSO: A Versatile Particle Swarm Optimisation R Package for hydroPSO: A Versatile Particle Swarm Optimisation R Package for Calibration of Environmental ModelsCalibration of Environmental Models

Mauricio Zambrano-Bigiarini and Rodrigo RojasMauricio Zambrano-Bigiarini and Rodrigo RojasEGU2012-10950Session: HS3.3Apr 25th, 2012

Mauricio Zambrano-Bigiarini and Rodrigo RojasEuropean Commission • Joint Research Centre • Institute for Environment and SustainabilityTel. +39 0332 789588 • Email: [email protected]

JointResearchCentre

1) MotivationParameter 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.

3) hydroPSO: Key Features

● 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 One-

factor-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/

2) AimTo present and illustrate the application of hydroPSO, a new global optimisation R package specifically designed to calibrate complex real-world environmental models.

References:● 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 multi-

variable catchment models, Journal of Hydrology, 324 (1–4), 10–23, doi: 10.1016/j.jhydrol.2005.09.008.

8) Concluding Remarks● 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

9) Ongoing research:● Multi-core/parallel support, to alleviate the computational burden● Multi-objective implementation, to tackle a wider class of optimisation problems

6) hydroPSO Main FunctionsFunction Short Descriptionlhoat() Sensitivity analysis using LH-OAT (van Griensven et al.,2006)hydromod() Run the model code to be calibratedhydroPSO() Platform- and model-independent PSO calibration engineread_results() Reading hydroPSO() results. It is a wrapper to:

    read_particles() Reading ”Particles.txt” output file    read_velocities() Reading ”Velocities.txt” output file    read_out() Reading ”Model_output.txt” output file

    read_convergence() Reading ”ConvergenceMeasures.txt” output file    read_GofPerParticle() Reading ”Particles_GofPerIter.txt” output fileplot_results() Plotting hydroPSO()results. It is a wrapper to:

    plot_particles() Plotting sampled parameters (histograms, dotty plots, ...)    plot_velocities() Plotting evolution of particle velocities    plot_out() Plotting model outputs against observations    plot_convergence() Plotting convergence measures (optimum and swarm radious)

    plot_GofPerParticle() Plotting the evolution of the goodness-of-fit per each particleverification() Runs the model code with one or more parameter setstest_functions() 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 StudiesApplication Feature SWAT-2005 Modflow-2005

Platform GNU/Linux Windows 7

Type of model Semi-distributed, surface hydrology

Fully-distributed, groundwater

hydroPSO-model interface

Basic, through available R functions

Advanced, through user-defined R functions

Executable model code Single file (swat2005.out) Sequential batch file (*.bat)

Simulated model outputs Continuous-time, single-site Steady-state, multi-site

Goodness-of-fit measure Pre-defined Nash-Sutcliffe efficiency

User-defined Gaussian Likelihood

4) Particle Swarm Optimisation (PSO)

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):

PSO (Kennedy and Eberhart, 1995) is a population-based stochastic optimisation technique inspired by the social behaviour of bird flocking.

● ω : inertia weigth

● c1

: cognitive aceleration coefficient

● c2

: social aceleration coefficient

● U1

t, U2

t: independent and uniformly

distributed random vectors

● Xi

t : i-th particle position at iteration t

● Vi

t : i-th particle velocity at iteration t

● Pi : i-th particle best-known position

● G : neighbourhood best-known position

V it1 = V i

t c1 U 1t P 1−X i

t c2 U 2t G−X i

t

X it1

=X itV i

t1

local search global search

5) Fine-tuning Options

PSO ParameterhydroPSO

OptionValue(s)

ωuse.IWIW.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

c2

c2,use.TVc2, TVc2.type linear, non-linear

Boundary condition

boundary.wall absorbing, invisible, reflecting, damping

Regrouping use.RG TRUE/FALSE

Initial positions Xini.type random, lhs

Initial velocites Vini.type random, lhs, zero

Updates best.update synchronous, asynchronous

Maximum velocity

use.TVlambda,TVlambda.type linear, non-linear

Topology topologygbest, lbest, vonNeumann, random

PSO variant method pso, fips, wfips, ipso

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.

Fig 03. Evolution of parameter values along number of model evaluations for three selected parameters (SWAT-2005 case study).

Fig 04. Evolution of the global optimum (Gaussian likelihood) and the normalised swarm radious (δnorm) along the iterations (Modflow-2005 case study).

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.

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).