# Optimizing Water Distribution through Explainable AI and Rule-Based Control

^{1}

^{2}

^{*}

^{†}

## Abstract

**:**

## 1. Introduction

- The extraction of a rule-based model that allows us to predict the future status of the network (e.g., pressure constraints will not be fulfilled/energy consumption will be excessive/a good status of the network);
- The use of the extracted model to generate controls to change the status of the pumps in order to match rules that predicted the desired status of the network.

## 2. Materials and Methods

- Application area: The application area of RBC is “pump operation”, like the largest portion of the paper analyzed by Mala-Jetmarova (40%).
- Optimization model: The optimization model used in this work considers a single objective (pump energy consumption) like the vast majority of models according to Mala-Jetmatova (84%). The test case considered 3 constraints (demand satisfied, nodes pressure, tanks level) but RBC allows us to deal with any number of constraints by changing the quality indicator.
- Solution methodology: The RBC solution methodology is hybrid: the rule extraction step is stochastic, whereas the control step is deterministic. (in the literature, deterministic methods are 45.5% of the total).
- Test network: For what concerns the test network, we used a mid-size network with approximately 400 demand nodes, whereas 80% of papers used a network with fewer than 100 nodes.

#### 2.1. Optimization Model

#### 2.2. Optimization Methods

#### 2.3. Genetic Algorithms

## 3. Theory/Calculation

#### 3.1. Modeling

- The efficiency indicator ${y}^{\mathrm{eff}}$ that corresponds to the cost in the unconstrained case, i.e., it is related to the energy consumption.
- The quality indicator ${y}^{\mathrm{qlt}}$ that represents the observed value of a penalty function accounting for the fulfillment of constraints.

- Bad quality of the service ($\mathrm{Bad}\mathrm{QoS}$) is the worst class and indicates that the constraints are poorly respected ${y}_{i}^{\mathrm{st}}=\mathrm{Bad}\mathrm{QoS}\phantom{\rule{4.pt}{0ex}}\mathrm{if}\phantom{\rule{4.pt}{0ex}}{y}_{i}^{\mathrm{qlt}}>{Q}_{{y}^{\mathrm{qlt}}}({\mathcal{S}}_{H},q)$;
- Bad energy efficiency ($\mathrm{Bad}\mathrm{Eff}$) is an intermediate class corresponding to fulfilled constraints but a high cost function ${y}_{i}^{\mathrm{st}}=\mathrm{Bad}\mathrm{Eff}\phantom{\rule{4.pt}{0ex}}\mathrm{if}\phantom{\rule{4.pt}{0ex}}{y}_{i}^{\mathrm{qlt}}\le {Q}_{{y}^{\mathrm{qlt}}}({\mathcal{S}}_{H},q)\phantom{\rule{4.pt}{0ex}}\mathrm{and}\phantom{\rule{4.pt}{0ex}}{y}_{i}^{\mathrm{eff}}>{Q}_{{y}^{\mathrm{eff}}}({\mathcal{S}}_{H}^{*},q)$;
- Good energy efficiency ($\mathrm{Good}\mathrm{Eff}$) is the best class in which constraints are respected and the efficiency indicator is low ${y}_{i}^{\mathrm{st}}=\mathrm{Good}\mathrm{Eff}\phantom{\rule{4.pt}{0ex}}\mathrm{if}\phantom{\rule{4.pt}{0ex}}{y}_{i}^{\mathrm{qlt}}\le {Q}_{{y}^{\mathrm{qlt}}}({\mathcal{S}}_{H},q)\phantom{\rule{4.pt}{0ex}}\mathrm{and}\phantom{\rule{4.pt}{0ex}}{y}_{i}^{\mathrm{eff}}\le {Q}_{{y}^{\mathrm{eff}}}$.

#### 3.2. Control

Algorithm 1: Function RuleBasedControl that implements the control strategy based on rules. |

Data: $\mathit{x}$, ${\mathcal{R}}_{\mathit{x},E}$, $\mathit{w}$, EResult: ${\mathit{x}}^{M}$${\mathcal{R}}_{\mathit{x},E}^{+}=\{r\mid r\in {\mathcal{R}}_{\mathit{x},E}\phantom{\rule{4.pt}{0ex}}\mathrm{and}\phantom{\rule{4.pt}{0ex}}{w}_{O\left(r\right)}<0\};$ |

Algorithm 2: Hierarchical Rule Based Control that iteratively implements RBC changing the target class. |

Data: $\mathit{x},$${\mathcal{R}}_{\mathit{x},E},$$\mathit{w},$EResult: ${\mathit{x}}^{M},$${C}^{-}=\{c\in C\mid {w}_{c}>0\};$ ${C}^{+}=C\setminus {C}^{-}$ |

## 4. Results

## 5. Discussion

## Author Contributions

## Funding

## Data Availability Statement

## Conflicts of Interest

## References

- Ghorbanian, V.; Karney, B.; Guo, Y. Pressure standards in water distribution systems: Reflection on current practice with consideration of some unresolved issues. J. Water Resour. Plan. Manag.
**2016**, 142, 04016023. [Google Scholar] [CrossRef] [Green Version] - Stinson, M.; Vitasovic, Z. Real time control of sewers: US EPA manual. In Proceedings of the World Environmental and Water Resource Congress 2006: Examining the Confluence of Environmental and Water Concerns, Omaha, NE, USA, 21–25 May 2006; American Society of Civil Engineers (ASCE): Reston, VA, USA, 2006; pp. 1–8. [Google Scholar]
- Mala-Jetmarova, H.; Sultanova, N.; Savic, D. Lost in Optimisation of Water Distribution Systems? A Literature Review of System Design. Water
**2018**, 10, 307. [Google Scholar] [CrossRef] [Green Version] - Eusuff, M.M.; Lansey, K.E. Optimization of water distribution network design using the shuffled frog leaping algorithm. J. Water Resour. Plan. Manag.
**2003**, 129, 210–225. [Google Scholar] [CrossRef] - De Corte, A.; Sörensen, K. An iterated local search algorithm for water distribution network design optimization. Networks
**2016**, 67, 187–198. [Google Scholar] [CrossRef] - Creaco, E.; Franchini, M. A new algorithm for real-time pressure control in water distribution networks. Water Sci. Technol. Water Supply
**2013**, 13, 875–882. [Google Scholar] [CrossRef] - Page, P.R.; Creaco, E. Comparison of flow-dependent controllers for remote real-time pressure control in a water distribution system with stochastic consumption. Water
**2019**, 11, 422. [Google Scholar] [CrossRef] [Green Version] - Page, P.R.; Abu-Mahfouz, A.M.; Mothetha, M.L. Pressure management of water distribution systems via the remote real-time control of variable speed pumps. J. Water Resour. Plan. Manag.
**2017**, 143, 04017045. [Google Scholar] [CrossRef] [Green Version] - Mosetlhe, T.; Hamam, Y.; Du, S.; Monacelli, E. A Survey of Pressure Control Approaches in Water Supply Systems. Water
**2020**, 12, 1732. [Google Scholar] [CrossRef] - Singh, M.K.; Kekatos, V. Optimal scheduling of water distribution systems. IEEE Trans. Control. Netw. Syst.
**2019**, 7, 711–723. [Google Scholar] [CrossRef] [Green Version] - Bunn, S.M.; Reynolds, L. The energy-efficiency benefits of pump-scheduling optimization for potable water supplies. IBM J. Res. Dev.
**2009**, 53, 5:1–5:13. [Google Scholar] [CrossRef] - Rao, Z.; Alvarruiz, F. Use of an artificial neural network to capture the domain knowledge of a conventional hydraulic simulation model. J. Hydroinform.
**2007**, 9, 15–24. [Google Scholar] [CrossRef] [Green Version] - Rao, Z.; Salomons, E. Development of a real-time, near-optimal control process for water-distribution networks. J. Hydroinform.
**2006**, 9, 25–37. [Google Scholar] [CrossRef] [Green Version] - Rylander, S.; Gotshall, B. Optimal population size and the genetic algorithm. In Proceedings of the World Scientific and Engineering Academy and Society (WSEAS) International Conference on Soft Computing, Optimization, Simulation and Manufacturing Systems (SOSM 2002), Shanghai, China, 10–14 June 2002. [Google Scholar]
- Mala-Jetmarova, H.; Sultanova, N.; Savic, D. Lost in Optimisation of Water Distribution Systems? A Literature Review of System Operation. Environ. Model. Softw.
**2017**, 93, 209–254. [Google Scholar] [CrossRef] [Green Version] - Lopez-Ibanez, M.; Devi Prasad, T.; Paechter, B. Multi-objective optimisation of the pump scheduling problem using SPEA2. In Proceedings of the 2005 IEEE Congress on Evolutionary Computation, Edinburgh, UK, 2–5 September 2005; Volume 1, pp. 435–442. [Google Scholar] [CrossRef] [Green Version]
- Murphy, L.; Dandy, G.; Simpson, A. Optimum Design and Operation of Pumped Water Distribution Systems. In Proceedings of the 1994 Conference on Hydraulics in Civil Engineering, Brisbane, Australia, 15–17 February 1994. [Google Scholar]
- Stokes, C.S.; Simpson, A.R.; Maier, H.R. A computational software tool for the minimization of costs and greenhouse gas emissions associated with water distribution systems. Environ. Model. Softw.
**2015**, 69, 452–467. [Google Scholar] [CrossRef] - Patriksson, M.; Bagloee, S.; Asadi, M. Minimization of water pumps’ electricity usage: A hybrid approach of regression models with optimization. Expert Syst. Appl.
**2018**, 107. [Google Scholar] [CrossRef] - Hornik, K. Approximation capabilities of multilayer feedforward networks. Neural Netw.
**1991**, 4, 251–257. [Google Scholar] [CrossRef] - Rossman, L.A. EPANET 2 Users Manual; U.S. Environmental Protection Agency (EPA): Washington, DC, USA, 2000; Volume 38.
- Muselli, M. Switching Neural Networks: A New Connectionist Model for Classification. In Proceedings of the 16th Italian Workshop on Neural Nets, WIRN 2005, International Workshop on Natural and Artificial Immune Systems (NAIS 2005), Vietri sul Mare, Italy, 8–11 June 2005; Apolloni, B., Marinaro, M., Nicosia, G., Tagliaferri, R., Eds.; Springer: Berlin/Heidelberg, Germany, 2006; pp. 23–30. [Google Scholar]
- Muselli, M.; Ferrari, E. Coupling Logical Analysis of Data and Shadow Clustering for Partially Defined Positive Boolean Function Reconstruction. IEEE Trans. Knowl. Data Eng.
**2011**, 23, 37–50. [Google Scholar] [CrossRef] - Quinlan, J.R. Induction of decision trees. Mach. Learn.
**1986**, 1, 81–106. [Google Scholar] [CrossRef] [Green Version] - Breiman, L. Random Forests. Mach. Learn.
**2001**, 45, 5–32. [Google Scholar] [CrossRef] [Green Version] - Monteiro, A.J.; Salomons, E.; Ostfeld, A.; Kapelan, Z.; Simpson, A.; Zecchin, A.; Maier, H.; Wu, Z.; Elsayed, S.M.; Song, Y.; et al. Battle of the Water Networks II. J. Water Resour. Plan. Manag.
**2014**, 140, 04014009. [Google Scholar] [CrossRef] [Green Version]

**Figure 4.**The performance of the three approaches considering the indicator that takes into account both quality of the service and energy optimization.

**Figure 6.**The time needed by RBC and GAs as a function of the complexity of the network (logarithmic scale).

$\mathbf{Bad}\mathbf{QoS}$ | $\mathbf{Bad}\mathbf{Eff}$ | $\mathbf{Good}\mathbf{Eff}$ | |
---|---|---|---|

No Action | $40.73\%$ | $29.84\%$ | $29.43\%$ |

Genetic Algorithms | $44.82\%$ | $1.77\%$ | $53.41\%$ |

Rule Based Control | $32.91\%$ | $4.39\%$ | $62.70\%$ |

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**

Ferrari, E.; Verda, D.; Pinna, N.; Muselli, M.
Optimizing Water Distribution through Explainable AI and Rule-Based Control. *Computers* **2023**, *12*, 123.
https://doi.org/10.3390/computers12060123

**AMA Style**

Ferrari E, Verda D, Pinna N, Muselli M.
Optimizing Water Distribution through Explainable AI and Rule-Based Control. *Computers*. 2023; 12(6):123.
https://doi.org/10.3390/computers12060123

**Chicago/Turabian Style**

Ferrari, Enrico, Damiano Verda, Nicolò Pinna, and Marco Muselli.
2023. "Optimizing Water Distribution through Explainable AI and Rule-Based Control" *Computers* 12, no. 6: 123.
https://doi.org/10.3390/computers12060123