# Automatic SWMM Parameter Calibration Method Based on the Differential Evolution and Bayesian Optimization Algorithm

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Materials and Methods

#### 2.1. Differential Evolution Algorithm

- (1)
- Mutation. The DE algorithm employs the disparity between two individual vectors to induce mutation in the existing individuals, which subsequently utilize this mutation vector to generate new offspring individuals. Upon initializing the population, the individuals undergo mutation operations to form mutation vectors. The equation of the mutation process is as follows:

- (2)
- Crossover. The DE algorithm employs a certain probability to select the mutated vector of the offspring, thereby generating experimental individuals to enhance the population diversity and promote structural differentiation.

- (3)
- Selection. The DE algorithm employs a greedy selection strategy, where the individuals are selected based on the values of the sought-after fitness function; the optimal candidates are selected from both offspring and parent classes.

#### 2.2. Bayesian Optimization Algorithm

#### 2.3. Improvement of the DE-BOA Algorithm

- (1)
- Building upon the foundation of the DE algorithm, we introduce the Gaussian process regression model from the BOA algorithm. This model captures the posterior distribution of the target function based on existing sample points. Using the collection function to guide the selection of the following sampling points, we combine the global search capability of the DE algorithm with the local search capability of the BOA algorithm. This hybrid optimization approach prevents the parameters from becoming trapped in local optima during the calibration process, so it achieves a high-precision parameter estimation for the SWMM model. Please refer to Figure 1 for the detailed algorithmic structure.

- (2)
- Using an adaptive weight allocation strategy, we tailor the distribution proportions of the DE algorithm and BOA algorithm, based on the balance between the constraints and the objective function of each specific SWMM model. During the initial stages of optimization, when the initial population exhibits good dispersion, we leverage the randomness of the initial population by assigning higher weights to the DE algorithm. By invoking the DE algorithm multiple times in the early phases, we enhance the exploration for the global optimum. However, as the optimization progresses, to avoid falling into local optima, we dynamically adjust the weights and increase the frequency of utilizing the BOA algorithm. Leveraging the characteristics of the BOA algorithm, which consider a more significant amount of historical data, we enhance the precision of SWMM model calibration and more thoroughly explore the global optimum. Please refer to Figure 2 for the detailed algorithmic flow.

#### 2.4. Case Study

#### 2.4.1. Overview of the Study Area

^{2}, and its location is illustrated in Figure 3a. Water systems, green spaces, and buildings intertwine in a mosaic-like distribution within the region, while primary and secondary roads crisscross, which creates a diverse urban land structure. Among them, impervious surfaces cover an area of 0.3 km

^{2}, which accounts for 36.6%, while pervious surfaces cover an area of 0.52 km

^{2}, which accounts for 63.4% (the land use types are depicted in Figure 4).

#### 2.4.2. Analysis of Rainfall Events

#### 2.4.3. SWMM Model Parameters

#### 2.4.4. SWMM Optimization Calculation

- 1.
- Formulate the objective function

- 2.
- Simulation procedure
- (1)
- The SWMM model of the study area was simulated using the Horton infiltration model and the dynamic wave method. Four rainfall events (R3, R4, R7, and R13) were set aside for subsequent model validation, while the remaining 16 rainfall events were utilized as input conditions to calibrate the model parameters.
- (2)
- The population was initialized and the fundamental parameters of the DE-BOA algorithm were set, based on the experience of multiple iterations of trial and error in the previous sensitivity analysis: population size = 20; mutation factor = 0.8; crossover factor = 0.7; maximum iteration count = 100. Bayesian iteration factors were chosen as 5 and 2, respectively. Batch import and export of SWMM parameters was implemented using the Python language.
- (3)
- Three solutions were randomly selected from the initial population and trial individuals were generated using the mutation and crossover formulas. The Python language was utilized to invoke the SWMM calculation engine for simulation computation and to obtain simulated water depths at the monitoring locations.
- (4)
- The *.out file generated by the SWMM simulation was retrieved; the objective function values were calculated after simulation; a greedy selection strategy was employed; and the optimal value was selected as the calibrated parameter value. The *.inp file was modified to serve as the input file for the next round of SWMM simulation.
- (5)
- At the early stage of the algorithm, the BOA algorithm was applied every five generations based on the optimal value to locally optimize it. As the algorithm progressed, an adaptive strategy to increase the proportion of the BOA algorithm was used and the influence factor of the optimal historical value on the computation was adjusted. Multiple rounds of local optimization were performed based on the optimal value and a greedy selection strategy was applied to the results.
- (6)
- The calibrated *.inp file was generated as output.

- 3.
- Evaluation criteria

## 3. Results and Discussion

#### 3.1. Parameter Calibration Results

^{2}, and PE than the other methods to various degrees. The RMSE and R

^{2}values indicate that, when calibrated using the DE-BOA algorithm, there is a good fit between observed and simulated flows. The PE value indicates that even in extreme circumstances, the DE-BOA algorithm maintains a commendable level of simulation performance.

#### 3.2. Model Verification

## 4. Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- Hossain, S.; Hewa, G.A.; Wella-Hewage, S. A Comparison of Continuous and Event-Based Rainfall–Runoff (RR) Modelling Using EPA-SWMM. Water
**2019**, 11, 611. [Google Scholar] [CrossRef] - Tsihrintzis, V.A.; Hamid, R. Runoff Quality Prediction from Small Urban Catchments Using SWMM. Hydrol. Process.
**1998**, 12, 311–329. [Google Scholar] [CrossRef] - Jang, S.; Cho, M.; Yoon, J.; Yoon, Y.; Kim, S.; Kim, G.; Kim, L.; Aksoy, H. Using SWMM as a Tool for Hydrologic Impact Assessment. Desalination
**2007**, 212, 344–356. [Google Scholar] [CrossRef] - Yao, L.; Chen, L.; Wei, W. Assessing the Effectiveness of Imperviousness on Stormwater Runoff in Micro Urban Catchments by Model Simulation. Hydrol. Process.
**2016**, 30, 1836–1848. [Google Scholar] [CrossRef] - Guan, M.; Sillanpää, N.; Koivusalo, H. Storm Runoff Response to Rainfall Pattern, Magnitude and Urbanization in a Developing Urban Catchment. Hydrol. Process.
**2016**, 30, 543–557. [Google Scholar] [CrossRef] - Sun, N.; Hong, B.; Hall, M. Assessment of the SWMM Model Uncertainties within the Generalized Likelihood Uncertainty Estimation (GLUE) Framework for a High-Resolution Urban Sewershed. Hydrol. Process.
**2014**, 28, 3018–3034. [Google Scholar] [CrossRef] - Zaghloul, N.A. Sensitivity Analysis of the SWMM Runoff-Transport Parameters and the Effects of Catchment Discretisation. Adv. Water Resour.
**1983**, 6, 214–223. [Google Scholar] [CrossRef] - Barco, J.; Wong, K.M.; Stenstrom, M.K. Automatic Calibration of the U.S. EPA SWMM Model for a Large Urban Catchment. J. Hydraul. Eng.
**2008**, 134, 466–474. [Google Scholar] [CrossRef] - Del Giudice, G.; Padulano, R. Sensitivity Analysis and Calibration of a Rainfall-Runoff Model with the Combined Use of EPA-SWMM and Genetic Algorithm. Acta Geophys.
**2016**, 64, 1755–1778. [Google Scholar] [CrossRef] - Kim, S.W.; Kwon, S.H.; Jung, D. Development of a Multiobjective Automatic Parameter-Calibration Framework for Urban Drainage Systems. Sustainability
**2022**, 14, 8350. [Google Scholar] [CrossRef] - Tscheikner-Gratl, F.; Zeisl, P.; Kinzel, C.; Leimgruber, J.; Ertl, T.; Rauch, W.; Kleidorfer, M. Lost in Calibration: Why People Still Do Not Calibrate Their Models, and Why They Still Should—A Case Study from Urban Drainage Modelling. Water Sci. Technol.
**2016**, 74, 2337–2348. [Google Scholar] [CrossRef] - Gulbaz, S.; Kazezyilmaz-Alhan, C.M. Calibrated Hydrodynamic Model for Sazlidere Watershed in Istanbul and Investigation of Urbanization Effects. J. Hydrol. Eng.
**2013**, 18, 75–84. [Google Scholar] [CrossRef] - Jin, X.; Jiang, Y.; Wu, W.; Jin, J. Automatic Calibration of SWMM Model with Adaptive Genetic Algorithm. In Proceedings of the 2011 International Symposium on Water Resource and Environmental Protection, Xi’an, China, 20–22 May 2011; Volume 2, pp. 891–895. [Google Scholar]
- Wan, B.; James, W. SWMM Calibration Using Genetic Algorithms. In Global Solutions for Urban Drainage; American Society of Civil Engineers: Reston, VA, USA, 2012; pp. 1–14. [Google Scholar] [CrossRef]
- Gao, X.; Yang, Z.; Han, D.; Huang, G.; Zhu, Q. A Framework for Automatic Calibration of SWMM Considering Input Uncertainty. Hydrol. Earth Syst. Sci. Discuss.
**2020**, 1–25. [Google Scholar] [CrossRef] - Perin, R.; Trigatti, M.; Nicolini, M.; Campolo, M.; Goi, D. Automated Calibration of the EPA-SWMM Model for a Small Suburban Catchment Using PEST: A Case Study. Env. Monit Assess
**2020**, 192, 374. [Google Scholar] [CrossRef] - Shahed Behrouz, M.; Zhu, Z.; Matott, L.S.; Rabideau, A.J. A New Tool for Automatic Calibration of the Storm Water Management Model (SWMM). J. Hydrol.
**2020**, 581, 124436. [Google Scholar] [CrossRef] - Azad, A.; Manoochehri, M.; Kashi, H.; Farzin, S.; Karami, H.; Nourani, V.; Shiri, J. Comparative Evaluation of Intelligent Algorithms to Improve Adaptive Neuro-Fuzzy Inference System Performance in Precipitation Modelling. J. Hydrol.
**2019**, 571, 214–224. [Google Scholar] [CrossRef] - Farzin, S.; Valikhan Anaraki, M. Optimal Construction of an Open Channel by Considering Different Conditions and Uncertainty: Application of Evolutionary Methods. Eng. Optim.
**2021**, 53, 1173–1191. [Google Scholar] [CrossRef] - Sambito, M.; Freni, G. Strategies for Improving Optimal Positioning of Quality Sensors in Urban Drainage Systems for Non-Conservative Contaminants. Water
**2021**, 13, 934. [Google Scholar] [CrossRef] - Storn, R.; Price, K. Differential Evolution: A Simple and Efficient Adaptive Scheme for Global Optimization Over Continuous Spaces. J. Glob. Optim.
**1995**, 23, 1–15. [Google Scholar] - Bai, Y.; Lu, W.; Li, J.; Chang, Z.; Wang, H. Groundwater Contamination Source Identification Using Improved Differential Evolution Markov Chain Algorithm. Env. Sci Pollut Res
**2022**, 29, 19679–19692. [Google Scholar] [CrossRef] - Smith, T.J.; Marshall, L.A. Bayesian Methods in Hydrologic Modeling: A Study of Recent Advancements in Markov Chain Monte Carlo Techniques. Water Resour. Res.
**2008**, 44, 1–9. [Google Scholar] [CrossRef] - McDonnell, B.E.; Ratliff, K.; Tryby, M.E.; Wu, J.J.X.; Mullapudi, A. PySWMM: The Python Interface to Stormwater Management Model (SWMM). J. Open Source Softw.
**2020**, 5, 2292. [Google Scholar] [CrossRef] - Zhang, X.; Srinivasan, R.; Zhao, K.; Liew, M.V. Evaluation of Global Optimization Algorithms for Parameter Calibration of a Computationally Intensive Hydrologic Model. Hydrol. Process.
**2009**, 23, 430–441. [Google Scholar] [CrossRef] - Brest, J.; Greiner, S.; Boskovic, B.; Mernik, M.; Zumer, V. Self-Adapting Control Parameters in Differential Evolution: A Comparative Study on Numerical Benchmark Problems. IEEE Trans. Evol. Comput.
**2006**, 10, 646–657. [Google Scholar] [CrossRef] - Shao, Z.; Xu, L.; Chai, H.; Yost, S.A.; Zheng, Z.; Wu, Z.; He, Q. A Bayesian-SWMM Coupled Stochastic Model Developed to Reconstruct the Complete Profile of an Unknown Discharging Incidence in Sewer Networks. J. Environ. Manag.
**2021**, 297, 113211. [Google Scholar] [CrossRef] - Muleta, M.K.; McMillan, J.; Amenu, G.G.; Burian, S.J. Bayesian Approach for Uncertainty Analysis of an Urban Storm Water Model and Its Application to a Heavily Urbanized Watershed. J. Hydrol. Eng.
**2013**, 18, 1360–1371. [Google Scholar] [CrossRef] - Yazdi, J.; Yoo, D.G.; Kim, J.H. Comparative Study of Multi-Objective Evolutionary Algorithms for Hydraulic Rehabilitation of Urban Drainage Networks. Urban Water J.
**2017**, 14, 483–492. [Google Scholar] [CrossRef] - Yin, L.; Chen, X.; Chen, Z.; Shuai, W.; Zhang, M.; Liu, H. Study on Storm Pattern of Typical Rainfall Station in Guangzhou. J. Water Resour. Res.
**2013**, 2, 409. [Google Scholar] [CrossRef] - Zhong, B.; Wang, Z.; Yang, H.; Xu, H.; Gao, M.; Liang, Q. Parameter Optimization of SWMM Model Using Integrated Morris and GLUE Methods. Water
**2023**, 15, 149. [Google Scholar] [CrossRef] - Lenhart, T.; Eckhardt, K.; Fohrer, N.; Frede, H.-G. Comparison of Two Different Approaches of Sensitivity Analysis. Phys. Chem. Earth Parts A/B/C
**2002**, 27, 645–654. [Google Scholar] [CrossRef] - Morris, M.D. Factorial Sampling Plans for Preliminary Computational Experiments. Technometrics
**1991**, 33, 161–174. [Google Scholar] [CrossRef]

**Figure 3.**Location and model structure of the study area: (

**a**) geographical location of the study area; (

**b**) SWMM pipe network mode.

ID | Start Time | End Time | Total Rainfall (mm) | Rainfall Duration (h) | Rainfall Scale |
---|---|---|---|---|---|

R1 | 30 April 2022 16:00 | 1 May 2022 0:00 | 14.02 | 8 h | Moderate rain |

R2 | 1 May 2022 4:10 | 1 May 2022 20:20 | 36.02 | 16.17 h | Heavy rain |

R3 | 7 May 2022 7:40 | 7 May 2022 18:20 | 19.87 | 10.67 h | Moderate rain |

R4 | 10 May 2022 1:50 | 11 May 2022 0:00 | 48.47 | 22.17 h | Heavy rain |

R5 | 11 May 2022 0:00 | 12 May 2022 0:00 | 81.26 | 24 h | Rainstorm |

R6 | 12 May 2022 10:30 | 13 May 2022 20:20 | 24.65 | 9.84 h | Moderate rain |

R7 | 13 May 2022 0:00 | 14 May 2022 0:00 | 80.75 | 24 h | Rainstorm |

R8 | 21 May 2022 13:40 | 22 May 2022 0:00 | 26.91 | 11.67 h | Heavy rain |

R9 | 6 June 2022 10:10 | 6 June 2022 22:50 | 26.73 | 12.67 h | Heavy rain |

R10 | 7 June 2022 9:30 | 7 June 2022 19:10 | 43.70 | 9.67 h | Heavy rain |

R11 | 9 June 2022 7:20 | 10 June 2022 12:30 | 32.78 | 5.17 h | Heavy rain |

R12 | 12 June 2022 8:00 | 12 June 2022 18:30 | 25.18 | 10.5 h | Heavy rain |

R13 | 13 June 2022 1:40 | 13 June 2022 16:50 | 35.09 | 15.17 h | Heavy rain |

R14 | 15 June 2022 8:20 | 15 June 2022 20:50 | 34.64 | 12.5 h | Heavy rain |

R15 | 17 June 2022 4:30 | 17 June 2022 17:10 | 32.30 | 12.67 h | Heavy rain |

R16 | 19 June 2022 1:20 | 19 June 2022 14:20 | 23.78 | 13 h | Moderate rain |

R17 | 2 July 2022 0:00 | 2 July 2022 22:40 | 46.73 | 22.67 h | Heavy rain |

R18 | 6 July 2022 11:40 | 6 July 2022 19:40 | 30.94 | 8 h | Heavy rain |

R19 | 3 August 2022 15:10 | 3 August 2022 18:40 | 23.00 | 3.5 h | Moderate rain |

R20 | 10 August 2022 8:00 | 10 August 2022 16:30 | 27.09 | 8.5 h | Heavy rain |

Rainfall Pattern | Frequency (Times) | Proportion |
---|---|---|

Single peak ahead (type I) | 1 | 5% |

Single peak back (type II) | 5 | 25% |

Single peak centered (type III) | 5 | 25% |

Uniform distribution (type IV) | 1 | 5% |

Distribution before and after bimodal (type V) | 1 | 5% |

Bimodal distribution (type VI) | 4 | 20% |

Bimodal mid-post distribution (type VII) | 3 | 15% |

Calibration Parameters | Parameter Meaning | $\overline{\mathit{S}}$ | Ranges |
---|---|---|---|

N-Imperv | Manning coefficient of impermeable area | 0.069567 | 0.01~0.05 |

N-Perv | Manning coefficient of permeable area | 0.054767 | 0.05~0.4 |

S-Imperv/mm | Depression volume in impermeable area | 0.054133 | 0.2~10 |

S-Perv/mm | Depression storage volume in permeable area | 0.0879 | 2~20 |

MinRate/(mm·h^{−1}) | Minimum infiltration rate | 0.051633 | 1~20 |

MaxRate/(mm·h^{−1}) | Maximum infiltration rate | 0.053167 | 20~100 |

Decay/h^{−1} | Permeation attenuation coefficient | 0.072767 | 2~7 |

Method | BOA | DE | Manual | DE-BOA |
---|---|---|---|---|

RMSE | 0.0071 | 0.0075 | 0.0070 | 0.0052 |

R^{2} | 0.9300 | 0.9216 | 0.9339 | 0.9644 |

PE | 0.0727 | 0.0605 | 0.0768 | 0.0161 |

Parameters | Initial Empirical Value | Rate Value | |
---|---|---|---|

Manual Calibration | DE-BOA Calibration | ||

N-Imperv | 0.012 | 0.01 | 0.01 |

N-Perv | 0.2 | 0.4 | 0.3528 |

S-Imperv/mm | 0.45 | 0.2 | 0.2 |

S-Perv/mm | 2 | 20 | 17.3671 |

MinRate/(mm·h^{−1}) | 12.7 | 18 | 11.0311 |

MaxRate/(mm·h^{−1}) | 200 | 90 | 49.8109 |

Decay/h^{−1} | 4 | 3 | 2.9728 |

ID | Total Rainfall (mm) | Rainfall Duration (h) | Rainfall Scale | Rainfall Pattern |
---|---|---|---|---|

R3 | 19.87 | 10.67 h | Moderate rain | IV |

R4 | 48.47 | 22.17 h | Heavy rain | VII |

R7 | 80.75 | 24 h | Rainstorm | II |

R13 | 35.09 | 15.17 h | Heavy rain | V |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Gao, J.; Liang, J.; Lu, Y.; Zhou, R.; Lu, X.
Automatic SWMM Parameter Calibration Method Based on the Differential Evolution and Bayesian Optimization Algorithm. *Water* **2023**, *15*, 3582.
https://doi.org/10.3390/w15203582

**AMA Style**

Gao J, Liang J, Lu Y, Zhou R, Lu X.
Automatic SWMM Parameter Calibration Method Based on the Differential Evolution and Bayesian Optimization Algorithm. *Water*. 2023; 15(20):3582.
https://doi.org/10.3390/w15203582

**Chicago/Turabian Style**

Gao, Jiawei, Ji Liang, Yu Lu, Ruilong Zhou, and Xin Lu.
2023. "Automatic SWMM Parameter Calibration Method Based on the Differential Evolution and Bayesian Optimization Algorithm" *Water* 15, no. 20: 3582.
https://doi.org/10.3390/w15203582