1 Introduction

Efficient use of existing water resources is imperative and critical due to industrialization, population growth, global warming and high-water consumptions. Utilities globally face the water losses and energy inefficiencies. Failures that occur in WDSs due to factors that are hydraulic, physical, environmental and operating, cause inefficient operation of the network, poor service quality and high operating and investment costs (Pearson 2019). The optimum design, renewal and rehabilitation of WDSs and water loss reduction are quite critical for sustainable infrastructure management (Babu and Vijayalakshmi 2013). The methods of the active leakage control (Azevedo and Saurin 2018; Gupta and Kulat 2018), minimum night flow (MNF) (Farah and Shahrour 2017; Marzola et al. 2021) and pressure management (AL-Washali et al. 2020), have been applied for ensuring the water and energy efficiency. Mutikanga et al. (2013) reviewed the methods and tools applied for WLM in detail. The recommendations that are the improvement of the data quality and implementation of leakage reduction and performance evaluation practices, were listed. Moreover, the works related to customer meter management (Fontanazza et al. 2015), and the performance assessment (Marzola et al. 2021) were proposed for sustainable WLM. These studies were generally implemented by considering the system’s characteristics such as hydraulic, network, customer, environmental and operational characteristics. Therefore, it is important to develop a model that analyzes all the components in WLM and determines the appropriate method for WLM. The water losses couldn’t be reduced to zero neither technically nor economically. Leakage reduction generally involve costly and time-consuming processes (Yilmaz et al. 2022). The water losses should be accurately assessed and prioritized (AL-Washali et al. 2020). Water utilities work hard to reduce water losses with high costs. The components should first be identified correctly in order to control water losses. Next, the costs that will be incurred to reduce water loss components should be analyzed (Moslehi et al. 2021). The most appropriate strategy for leakage management should be planned to ensure water and energy efficiency. (Bozkurt et al. 2022a) proposed an assessment system to evaluate the data quality and current implementation level of leakage management components.

Optimization algorithms have been used for urban water management. Molinos-Senante et al. (2014) developed an optimization model that considers the water resources and user profiles in order to maximize the revenue water. The optimization algorithm contributed to the solution of complex WDSs. Techniques (2021) used multivariate techniques and optimization algorithm to provide strategic planning of water resources. The results provide solutions closer to the optimum solution. Monsef et al. (2019) applied the non-dominated sorting genetic algorithm II, multi-objective differential evolution and multi-objective PSO algorithms for the optimum design of WDSs. Mathematical test functions were used to evaluate the performance of algorithms. Shende and Chau (2019) used the simple Benchmarking Algorithm which is a meta-heuristic algorithm, in order to provide reconfigurations in WDS networks with minimum cost. The results showed that SBA is better at achieving the lowest possible cost with rapid convergence.

Bilal and Pant (2020) proposed a combinatorial optimization study in order to optimize the total construction cost of the system. A hybrid metaheuristic algorithm was created by integrating the simulation with EPANET. Khalifeh et al. (2020) optimized the WDS with the HHO algorithm using water demand and storage data. The work provides the optimum network design with lower cost. Ezzeldin and Djebedjian (2020) presented the whale optimization technique for optimum design of WDSs with the lowest cost. The results of optimization were tested using a total of 14 different optimization techniques. Awe et al. (2019) reviewed different optimization methods in WDSs in order to minimize the cost or maximize revenue and system performance. Helmi et al. (2021) examined the problem of restructuring WDSs using the HHO algorithm in order to increase the efficiency of WDSs and to minimize energy losses. A new metaheuristic method using the HHO algorithm is proposed to obtain the optimal configurations.

In this study, a novel WLM model was developed to improve the WLM practices, to define the most appropriate and applicable targets and to determine the components that need to be improved primarily using the Harris Hawk Optimization (HHO) algorithm. The novelty of this study is that the current technical, equipment, financial and equipment capacity and the current implementation levels of WLM practices in the utility are considered. HHO, which is based on the hunting strategies of the Harris Hawk, is an effective method for parameter setting. Thus, the optimization model defines the most appropriate targets based on the current status. The developed model was tested with real data in three utilities. The current status of the utilities is scored between 0 and 5 with CSAS which consists of 8 main categories and 144 components, proposed by (Bozkurt et al. 2022b).

In the literature, water loss reduction and control studies are implemented in pilot areas using different methods within the scope of WLM. However, not every method can be applied in every system or region. Moreover, the same target cannot be set for every utility. Moreover, WLM components cannot be improved at the same level in every utility. The current status of the utility has a direct impact on the implementation and improvement of the components. The model proposed in this study, unlike the literature, considers the WLM components simultaneously and defines the most appropriate target according to the current situation.

In this study, firstly, the current state of the system is analyzed in the proposed algorithmic structure. Then, optimization constraints were determined according to system constraints. Recently, various engineering problems have been solved with stochastic/deterministic optimization algorithms. The model structure in this study is novel and innovative in solving it with a numerical optimization algorithm. Numerical optimization methods can be applied for different engineering problems. The Enhanced equilibrium optimization algorithm is designed with a fractional and integer degree controller (Ates 2021). The optimum power flow problem was solved with the HHO algorithm (Akdağ et al. 2020). Similarly, a controller was designed for the 3 DOF hover system with the modified monarch butter fly optimization algorithm (Ates and Akpamukcu 2022). Finally, controllers were designed for the systems by increasing the performance of optimization algorithms with the optimization to optimization (OtoO) approach (Ates and Akpamukcu 2021). In this study, the parameters for simulation and real-time systems were optimized with the HHO algorithm and the results were presented comparatively.

2 Development of Optimization Model

Water use efficiency, leakage reduction and service quality improvement are critical issues for sustainable water management. Implementation of general approaches for WLM is difficult, costly and time consuming for all networks where the characteristic, environmental, operational and hydraulic behavior of each system differs. Therefore, the methods should be chosen by considering the economic, feasibility and current situation. Moreover, it is quite important to develop a model that considers and analyzes all components-actors and offers the most appropriate alternative. (Bozkurt et al. 2022b) proposed a model that evaluates the current implementation levels of WLM practices. This model includes the matrices of the CCAS, data quality, performance evaluation, and method. The CSAS consisting of 144 components comprising the WLM, evaluates the data quality of components (Bozkurt et al. 2022b). The main components are; Utility Management, Basic Data, Information Systems, Water Balance, Apparent Loss, Real Loss, Performance Monitoring and Economic Analysis (Bozkurt et al. 2022b).

2.1 Objective Function for Optimization Algorithm

There is a need for a model that defines appropriate targets for components by considering the current situation of the utility. In this study, an optimization model was developed to improve the components in CSAS proposed by (Bozkurt et al. 2022b). The most appropriate targets were identified using the HHO algorithm based on the scores. The objective function was created for optimization model. There are a total of 144 components that affect each other in CCAS. It is extremely difficult to develop a strategy with basic algorithmic queries in this space of alternatives. Each component affects system performance at different levels.

The steps of the optimization model are (i) scoring the components in CSAS, (ii) determining the model with the field data, (iii) optimizing the model parameters, and (iv) testing the model accuracy. WLM involves a large number of methods, data and information systems. These components affect each other directly/indirectly. Therefore, a coefficient expressed as the impact level or weight was defined for the components. The CSAS and data matrices in the model proposed by Bozkurt et al. (2022b) were considered. The components that each component in the CSAS affects in the CSAS matrix and data matrices were determined. For example, system flowrate is the main component in WLM. The measurement of this component directly affects the practices of analyzing water balance, performance and efficiency. The impact of this component in WLM model should be different from other components. Therefore, the effects of each component in the CSAS were determined (Table 1). The optimization model was established with this perspective. The data matrix (VMat) which are associated according to a linear structure, is expressed in Eq. (1).

$$V_{mat} = \left[ {\begin{array}{*{20}c} {V_{mat(1,1)} } & {V_{mat(1,2)} } & \cdots & {V_{mat(1,i)} } \\ {V_{mat(2,1)} } & {V_{mat(2,2)} } & \cdots & \vdots \\ \vdots & \vdots & \cdots & \vdots \\ \vdots & \vdots & \cdots & \vdots \\ \vdots & \vdots & \cdots & \vdots \\ \vdots & \vdots & \cdots & \vdots \\ {V_{mat(18,1)} } & {V_{mat(18,1)} } & \cdots & {V_{mat(j,i)} } \\ \end{array} } \right]{\text{i}} = {1},{2},..{8}\,\,\,{\text{j}} = {1},{2},{3} \ldots {18}$$
(1)
Table 1 Weights used in the analyzes

There is a linear relationship between the components in the CCAS by considering this impact level and logical structure. A linear model is proposed based on the linear relationship. The efficiency of the linear model is increased with weights (Eq. (2)).

$$a_{mat} = \left[ {\begin{array}{*{20}c} {a_{mat(1,1)} } & {a_{mat(1,2)} } & \cdots & {a_{mat(1,i)} } \\ {a_{mat(2,1)} } & {a_{mat(2,2)} } & \cdots & \vdots \\ \vdots & \vdots & \cdots & \vdots \\ \vdots & \vdots & \cdots & \vdots \\ \vdots & \vdots & \cdots & \vdots \\ \vdots & \vdots & \cdots & \vdots \\ {a_{mat(18,1)} } & {a_{mat(18,1)} } & \cdots & {a_{mat(j,i)} } \\ \end{array} } \right]{\text{i}} = {1},{2},..{8}\,\,\,{\text{j}} = {1},{2},{3} \ldots {18}$$
(2)

amat : the weight matrix. The system matrix (SMat) is formed by combining these matrices and performing mathematical operations. The calculation process of the objective function starts in the optimization processes. The coefficient matrix is optimized according to the calculation of the objective function. The values that the result matrix can take are defined according to the level of the variable.

$${\text{SMat}} = \sum\limits_{i = 1}^{144} {AMat(i)VMat(i)}$$
(3)

The constraints for optimization model are shown in Table 2. The optimization algorithm searches the parameter space according to its search terminology. The results are checked at each iteration. The algorithm proceeds to the next iteration whether the result is accepted or not according to the suitability of these conditions.

Table 2 The constaints for optimization model

The difficulties, impact levels, requirements, and costs of the components in CCAS were considered in defining the conditions. The scores in CCAS are defined between 0 and 5 in the design of the mathematical form. Bringing each component to the value of 5 may not be economically and technically possible under the current conditions.

A certain target for each utility is determined according to its current value. The configurations are calculated with optimization. Integer values between 0 and 5 are assigned recursively for each cell in the CCAS. Then, the objective function is calculated by considering the initial value of the component.

The current score and the value assigned by the algorithm is compared. If the current score is 0 or 1 and the value assigned by the algorithm is 2 or 3. Smat is multiplied by the transition1. If the current score is 0 or 1 is the value assigned by the algorithm, the Smat is multiplied by the transition1+ transition2. If the current score is 0 and 1, the value of the algorithm is 5, then the Smat is multiplied by the transition1+ transition2+ transition3.

In this way, in the current status, the transition from 0 and 1 to 2 or 3, from 2 or 3 to 4, and from 4 to 5 is planned to be unequal. Due to the nature of the problem, it is more difficult to bring a component from 4 to 5 than to bring the component from 0 or 1 to 2 or 3. The transitions in the model, also contribute to defining the difficulty level in the nature of this problem. The coefficients of transitions (transition1=1 transition2=3 and transition3=5 was determined as a result of continuous tests. The objective function (AF) used during the optimization was calculated by Eq. (4).

$${\mathrm{AF}} = \, ({\mathrm{HD}} - \sum\limits_{i = 1}^{144} {\left( {(tran_{1} + tran_{2} + tran_{3} )AMat(i)VMat(i)} \right)} /\sum\limits_{i = 1}^{144} {AMat(i)} )$$
(4)

HD: Target value, tran1= transition1, tran2= transition2 and tran3= transition3.

In each iteration of the optimization, a candidate solution is proposed. AF is calculated according to these structures. Then, the compatibility of the proposed solution is tested based on the conditions given in Table 2. If these conditions are met, the algorithm accepts this solution, if it does not, it passes to another parameter vector space.

The following algorithmic structure was used to determine the transitions during the optimization. YVMat(i) is the new value suggested by the optimization algorithm. If the current score is 0, 1, 2, 3, the function given below is used to determine the transition.

$$G(tran_{1} ,tran_{2} ,tran_{3} ) = \left\{ {\begin{array}{*{20}l} { tran_{1} = 0; \, tran_{2} = 0;\,tran_{3} = 0; \, \left( {YVMat\left( i \right) = 0 \, || \, YVMat\left( i \right) = = 1} \right)} \hfill \\ {tran_{1} = 1; \, tran_{2} = 0;\,tran_{3} = 0; \, \left( {YVMat\left( i \right) = 2 \, || \, YVMat\left( i \right) = = 3} \right)} \hfill \\ {\,tran_{1} = 1; \, tran_{2} = 3;\,tran_{3} = 0; \, \left( {YVMat\left( i \right) = 4} \right)} \hfill \\ {tran_{1} = 1; \, tran_{2} = 3;\,tran_{3} = 5; \, \left( {YVMat\left( i \right) = 5} \right)} \hfill \\ \end{array} } \right\}$$
$$G(tran_{1} ,tran_{2} ,tran_{3} ) = \left\{ {\begin{array}{*{20}l} { tran_{1} = 0; \, tran_{2} = 0;\,tran_{3} = 0; \, \left( {YVMat\left( i \right) = 0 \, || \, YVMat\left( i \right) = = 1} \right)} \hfill \\ {tran_{1} = 0; \, tran_{2} = 0;\,tran_{3} = 0; \, \left( {YVMat\left( i \right) = 2 \, || \, YVMat\left( i \right) = = 3} \right)} \hfill \\ {tran_{1} = 0; \, tran_{2} = 3;\,tran_{3} = 0; \, \left( {YVMat\left( i \right) = 4} \right)} \hfill \\ {tran_{1} = 0; \, tran_{2} = 3;\,tran_{3} = 5; \, \left( {YVMat\left( i \right) = 5} \right)} \hfill \\ \end{array} } \right\}$$

If the current score is 4, the function given below is used to determine the transition coefficient.

$${\text{G(tran}}_{{1}} {\text{,tran}}_{{2}} {\text{,tran}}_{{3}} {) = }\left\{ {\begin{array}{*{20}l} {{\text{ tran}}_{{1}} {\text{ = 0; tran}}_{{2}} {\text{ = 0;tran}}_{{3}} { = 0;\,}\left( {{\text{YVMat}}\left( {\text{i}} \right){\text{ = 0 || YVMat}}\left( {\text{i}} \right){ = = 1}} \right)} \hfill \\ {{\text{tran}}_{{1}} {\text{ = 0; tran}}_{{2}} {\text{ = 0;tran}}_{{3}} { = 0;\,}\left( {{\text{YVMat}}\left( {\text{i}} \right){\text{ = 2 || YVMat}}\left( {\text{i}} \right){ = = 3}} \right)} \hfill \\ {\,{\text{tran}}_{{1}} {\text{ = 0; tran}}_{{2}} {\text{ = 0;tran}}_{{3}} { = 0;\,}\left( {{\text{YVMat}}\left( {\text{i}} \right){ = 4}} \right)} \hfill \\ {{\text{tran}}_{{1}} {\text{ = 0; tran}}_{{2}} {\text{ = 0;tran}}_{{3}} { = 5; }\left( {{\text{YVMat}}\left( {\text{i}} \right){ = 5}} \right)} \hfill \\ \end{array} } \right\}$$

A current score of 5 indicates that there is no need for optimization. The transitions are transition1=0; pass2=0; pass3=0; taken in the form. It is not possible for any value to go back during the optimization process for the real-time model of the system. Transitions are assigned as (pass1=0; pass2=0; pass=0) so that the back-off states do not get stuck in local points of the algorithm in order to provide this terminology.

2.2 Optimization of WLM Parameters with HHO Algorithm

The HHO algorithm is an optimization algorithm proposed by Heidari, inspired by the behavior of Harris hawks, which are good hunters in nature (Heidari et al. 2019; Akdağ et al. 2020; Akdag 2021). Harris hawks called an intelligent swarm-based algorithm, act as a flock while hunting rabbits. There are various phases that are the discovery, the transition from exploration to attack, and the attack. The optimization of the Vmat was made with objective function and constraints.

Discovery phase shows the initial solution of the algorithm. Harris hawks wait in the desert and are constantly observing. These observers are part of the flock. Others await the next mission if there is hunt. It is tried to find the most suitable points by making some kind of random suggestions (Heidari et al. 2019; Akdağ et al. 2020).

$$V_{mat} (t + 1) = \left\{ \begin{gathered} V_{{mat_{rand} }} (t) - r_{1} |\,V_{{mat_{rand} }} (t) - 2r_{2} V_{mat} (t)|, \hfill \\ (V_{{mat_{rabbit} }} (t) - xV_{{mat_{m} }} (t)) - r_{3} (AL - r_{4} (U L - AL)),\,q < 0.5 \hfill \\ \end{gathered} \right.$$
(5)

\(V_{mat} (t + 1)\): the position vector, \(V_{{mat_{rabbit} }} (t)\): the hunt position vector, \({V}_{ma{t}_{rand}}\left(t\right)\) : the hawk randomly selected hawk at the current population, \({V}_{ma{t}_{m}}(t)\) : the average position of current hawk position, \(V_{mat} (t + 1)\): the current position of hawk, (\({{\text{r}}}_{1}\),\({{\text{r}}}_{2}\),\({{\text{r}}}_{3}\),\({{\text{r}}}_{4}\) ve \({\text{q}}\) ) the random numbers (0,1). \({\text{AL}}\), and \(\mathrm{\ddot{U} }{\text{L}}\): the lower and upper values, respectively (Heidari et al. 2019; Akdağ et al. 2020).

$$Vmat_{m} (t) = \frac{1}{N}\sum\limits_{i = 1}^{N} {Vmat_{i} (t)}$$
(6)

The transition from exploration to attack: Harris hawks can switch to different attack styles according to the energy of the hunt. After the hunt is detected, the task of a group of hawks in the flock is to reduce the energy of the hunt.

$$E=2{E}_{0}(1-\frac{t}{T})$$
(7)

E: energy of escaped hunt, E0 : initial energy of hunt, \(N\); the number of hawks, T: maximum number of iterations.

The Attack is determined according to the strategies of soft, hard, soft with progressive rapid dives, and hard with progressive rapid dives (Heidari et al. 2019; Akdağ et al. 2020).

Soft surround: The Harris hawk aims to reduce the energy of the hunt with sudden attacks. \((r\ge 0.5, E\ge 0.5)\).

$$\mathrm{Vmat(t+1)=\Delta Vmat(t)-E}\left|{\text{JVmat}}_{\text{rabbit}}\text{(t)-Vmat(t)}\right|$$
(8)
$$\Delta{\mathrm{Vmat(t)=Vmat}}_{\text{rabbit}}\text{-Vmat(t)}$$
(9)

Hard surround: It is a situation where the energy of the hunt is considerably reduced. \((r\ge 0.5, \left|E\right|\le 0.5)\).

$${\text{DVmat(t + 1) = Vmat}}_{{{\text{rabbit}}}} {\text{(t) - E}}\left| {\text{DVmat(t)}} \right|$$
(10)

Soft surround with progressive rapid dives: Hunt has enough energy. The Harris hawk aims to lower the energy of the hunt with sudden attacks.

$$\text{Y=Vma}{\text{t}}_{\text{rabbit}}(t)\text{-E}\left|\Delta{\mathrm{Vmat}}(t)\right|\text{-Vmat}(t)$$
(11)

\(\Delta{\text{Vmat}}(t)\) : the difference between the current position in tth iteration and the current position of the hunt. It is compared to previous dives to check if the move is a good move. If not suitable, sudden dives are continued. Levy flight distribution structure is used in the decision-making process.

$$\text{Z=Y+S*LF}(D)$$
(12)

D: the problem size, S is a random vector of size 1xD, LF: the levy functions.

$$\begin{aligned}\mathrm{LF(x)}=0.001\mathrm{x}\left(\frac{\mu \mathrm{x}{\sigma}}{|\mu|^{\frac{1}{\beta}}}\right),\sigma=\left[\frac{\Gamma\left(1+\beta\right)\mathrm{xsin}\left(\frac{\pi \beta}{2}\right)}{\Gamma\frac{\left(1+\beta\right)}{2}\mathrm{x}\beta\mathrm{x}2^{\left(\frac{\beta-1}{2}\right)}}\right]\end{aligned}$$
(13)

u, v : the random number (0,1), β : 1.5. Equation (15) is used to update the positions of the hawks in the soft surround.

$${\text{V}}_{{{\text{mat}}}} {\text{(t + 1) = }}\left\{ \begin{gathered} {\text{Y}}\,\,{\text{if}}\,{\text{F(Y) < f(V}}_{{{\text{mat}}}} {\text{(t))}} \hfill \\ {\text{Z}}\,{\text{if}}\,{\text{F(Z) < F(V}}_{{{\text{mat}}}} {\text{(t))}} \hfill \\ \end{gathered} \right\}$$
(14)

Hard surround with progressive rapid dives: The hunt does not have enough energy. Because of this, the Harris hawk makes a tough surround.

$${\text{V}}_{{{\text{mat}}}} {\text{(t + 1) = }}\left\{ \begin{gathered} {\text{Y}}\,\,{\text{if}}\,{\text{F(Y) < f(V}}_{{{\text{mat}}}} {\text{(t))}} \hfill \\ {\text{Z}}\,{\text{if}}\,{\text{F(Z) < F(V}}_{{{\text{mat}}}} {\text{(t))}} \hfill \\ \end{gathered} \right\}$$
(15)
$${\text{Y = Vmat}}_{{{\text{rabbit}}}} {\text{(t) - E}}\left| \Delta{\mathrm{JVmat(t)}} \right|{\text{ - Vmat(t)}}$$
(16)
$${\text{Z = Y + SXLF(D)}}$$
(17)

2.3 Finding the Vmat Matrix with the HHO Algorithm

The following steps were applied to optimize the Vmat matrix with the HHO algorithm (Fig. 1).

Fig. 1
figure 1

Flow chart for proposed model and state definition

  • Step 1: VMat are entered into the algorithm. The target, constraints and transitions (transition1=1; transition2=3; transition3=5) are determined.

  • Step 2: The parameters of N, T, AL and ÜL are defined.

  • Step 3: The location of each hawk is determined in each iteration according to N. Vmat matrix is created according to the constraints.

$$\sum\limits_{{\text{i = 1}}}^{{{144}}} {\left( {{\text{(tran}}_{{1}} {\text{ + tran}}_{{2}} {\text{ + tran}}_{{3}} {\text{)AMat(i)VMat(i)}}} \right)} {/}\sum\limits_{{\text{i = 1}}}^{{{144}}} {\text{AMat(i)}}))$$
  • Step 4: The new value of the Vmat matrix is determined by considering the current situation.

  • Step 5: The position of the rabbit corresponding to minimizing the best Objective Function intended is calculated.

  • Step 6: The initial energy of the hunt is compared with the fitness. If the fitness is smaller than the initial energy; the initial energy of the hunt is equalized to the fitness.

  • Step 7: The energy of the hunt is modeled.

  • Step 8: When E is greater than or equal to 1, the position vector is updated using Eq. 1.

  • Step 9: If E is less than 1, whichever of the following situations is provided, go to that step.

  • Step 9.1: When (|E| ≥0.5andr ≥ 0.5) the position is updated using Eq. 4.

  • Step 9.2: ((\(|E| \ge 0.5\) and \(r< 0.5\)) the position is updated using Eq. 6.

  • Step 9.3: (\(\left|E\right|<0.5\) and \(r \ge 0.5\)) the position is updated using Eq. 10.

  • Step 9.4: (\(\left|E\right|<0.5\) and \(r< 0.5\)) the position is updated using Eq. 11.

  • Step 10: Step 5 is repeated until the stopping criteria are reached.

  • Step 11: Find the location of the prey and its fitness.

3 Simulation Results of HHO Algorithm

3.1 Testing the Algorithm with Sample Data

The most appropriate target for the utility is suggested in mathematical form according to the current situation. Sample data sets were produced in accordance with the score logic of the basic, moderate and advanced components in the CCAS (Fig. 2). Then, the algorithm was tested with these data sets. The components in the CSAS are divided into three subgroups that are the basic, moderate and advanced level, based on the technical and economic requirements for the implementation of the components. Each component in the CSAS was scored to create a sample data set based on these criteria. These data do not reflect the situation of any utility. It was created solely for the purpose of developing and testing the model.

Fig. 2
figure 2figure 2

a The result matrices for sample data sets defined by HHO algorithm b Current scores and optimization results in pilot utilities

The components at basic level should be performed in utilities. The implementation of moderate level components is generally more difficult than basic level. Moreover, the advanced level components are more costly and time-consuming than basic and moderate levels. Accordingly, it was predicted that (i) basic level scores were higher than moderate and advanced level, (ii) moderate level scores could be higher than advanced level. The targets were defined for each data matrix by considering the arithmetic average of scores.

The target provides the current average of the utility to a higher score class. Sample datasets were created as poor, moderate and good performance. The current scores and target for Data Set-I are 1.7222 and 2-3, respectively. The current scores and target for Data Set-II are 2.4931 and 4-5, respectively. The current scores and target for Data Set-III are 3.1667 and 4-5, respectively. The parameters were optimized in order to increase the score of the datasets. Random experiments are implemented to determine the target. If the score reaches the target, this is the sought value. If the target cannot be reached, the experiment is continued.

The parameters of N, T and target are defined based on the CCAS. After determining the targets, the target is kept constant and appropriate values of N and T are determined. Since there are 144 components in the matrix, the N must be at least 144. After the target and N are determined, these values are taken as constant. The tests are continued by changing the T parameter. The current situation is analyzed in low and high iterations. Appropriate iteration intervals are determined for each data set (Table 3). The purpose here is; (i) to determine the optimal range of target, N and T in order to increase the current score to the targe, (ii) to develop a mathematical model that reveals the relationship between the current and the target scores.

Table 3 The optimization parameters and targets for sample data sets and field data sets

Targeto; the target for dataset, Current_mean; the current mean score of datasets; A_mean_new; the new average score defined by optimization. Thus, the data sets (Fig. 2) were analyzed with the HHO algorithm (Fig. 3). The algorithm updates the parameters and reaches the optimal value even if the sample data does not work. The error function was minimally solved to achieve the goal, considering the system dynamics.

Fig. 3
figure 3

Objective function values during to optimization for data sets1 b objective function values during to optimization for data sets2 c objective function values during to optimization for data sets3 d objective function values during to optimization for utilities 1 e objective function values during to optimization for utilities 2 f objective function values during to optimization for utilities 3

3.2 Study Area

Three utilities in Turkey (Utility I: Bursa, Utility II: Kayseri, Utility III: Malatya) are the study area (Fig. 4) to test the optimization model. Utility I located in the west of Turkey is the fourth most populous city with a population of 3,139,744. The number of customers is 1,250,000. The network length is approximately 7,100 km. Utility II located in the Central Anatolia region has a population of 1,434,357, and customers of 550,000. The network length is approximately 12,321 km. Utility III located in the east of Turkey, has a population of 808,692, with a total customer of 350,000. The network length is approximately 2,500 km.

Fig. 4
figure 4

Study area

3.3 Optimization Results for Field Data Matrices

The current status of the utilities was defined with scoring system and CSAS (Fig. 2). To make an objective evaluation, the components in this matrix are scored between 0 and 5 by experts outside the institution. The departments of water management, information technology, customer management, Geographic Information System and SCAD were visited in in the utilities. Data, reports, activity documents and databases in the utility are taken as basis for scoring each component.

The utilities have different score classes. It is necessary to determine the appropriate target for each utility. The model was run using the component’s scores in utilities. Targets were found according to the current average of utility. After the basic components reach to the target, the other levels are improved. Thus, the gradual structure was dynamically defined. The result matrices for the utilities are given in Fig. 3.

3.3.1 Evaluation for Utility I

The current status is at good level. The appropriate target and new average are 0.8 and 4.4097, respectively. The HHO algorithm has optimized 144 parameters by reducing the error function.

The basic components currently have score of 2 or higher. Three components at moderate level are 0 and 1. Seven components at advanced level are 0 or 1. The components with a high weight and the components with 0 and 1 were improved. Then, the improvement levels of moderate components were determined by the model according to the current score. The new scores recommended for the moderate components in this utility are at higher level than in other utilities. The main reason is that the current scores in the utility are at better than other utilities. Thus, the current scores of the utility are considered by the model. Similarly, the new scores recommended by the optimization are higher than other utilities.

3.3.2 Evaluation for Utility II

The appropriate target and new average are 0.5 and 4.3958, respectively. A consistent optimization process was obtained to reach the target by the HHO. Three components at basic level, seven components at moderate level and eight components at advanced level are 0 and 1 in current status. The components with a high weight and the components with 0 and 1 were improved by the model. The components in the basic level are generally suggested as good or quite good in result matrix. The current scores of basic components should meet the necessary conditions in order to apply the components in moderate and advanced level. It is thought that the target scores suggested by the model are in accordance with the natural structure of the problem.

3.3.3 Evaluation for Utility III

The appropriate target and new average are 0.07 and 3.2292, respectively. A total of 22 components at basic level, 30 components at moderate level and 37 components at advance level are 0 or 1. These components were firstly improved in result matrix. Since the current scores in the utility are generally at poor level. The improvements suggested by the model were more limited than other utilities. The new targets for moderate and advanced components include gradual improvement based on current scores.

3.4 Definition of the Current Situation and Target Relationship

In the previous sections, the relationship between the current average and target values obtained was presented. The optimization model was run a large number of times to define the relationship between the current situation and the target score (Table 3).

The table presents the current score, target mean value, targeto value, and A_mean_new values representing the new mean in the result matrix.

A control matrix (comparison matrix) was established to check the optimization conditions. Moreover, a control counter was added to the algorithm. Analysis is carried out by defining a value for the control counter, depending on how many of the conditions are desired to be met. For example, utility’s current score is 3.416 and the target average is between 4-5 according to the score classes.

The target, which will increase the average of this utility to the band of 4-5, was found as 0.8. In this way, the targets that will increase the current average of each utility to the target average were found by testing and the diagram given above was obtained.

The target averages differ since the current situation of each utility is at different levels. A curve was fitted with linear regression to the target values obtained by the tests. This equation shows the relationship between the current mean and target value. The accuracy of the obtained equation is high. In this way, the target can be calculated for the utility based on the current score and the optimization algorithm works by targeting this value.

As a result, the current situation was analyzed by applying the scoring system and an optimization model was proposed according to the dynamic structure of utility. The priority components in improvement were determined. This novel model will contribute to the prevention of time-consuming and costly processes and reduction of construction costs by determining the most appropriate method.

4 Conclusion

A novel optimization model was proposed using the HHO algorithm to define the most appropriate strategy based on the CSAS. A unique scoring system was applied in three utilities. The current status of utilities I, II and III were at good, moderate and poor level, respectively. The developed model was first tested with virtual datasets and then tests were conducted with real datasets. Since each utility’s current score was at different level at the beginning, a dynamic improvement system was used for each utility’s target. The current scores in utility I were 4.0625, 3.3958, and 2.7917, respectively. In utility I, the optimization results for basic, moderate and advanced levels were 4.6667, 4.4792 and 4.0833, respectively. The current scores in utility II were 3.5417, 2.9717, 2.6042, respectively. In utility II, the optimization results for basic, moderate and advanced levels were 44.7083, 4.1667 and 4.3125, respectively. Finally, the current scores of components in utility III were 1.6042, 1.1875, 0.6875, respectively. In utility III, the optimization results for basic, moderate and advanced levels were 4.167, 2.9792 and 2.5417, respectively. Optimization results were supported by error function graphs according to the target value being reached. The model and algorithmic structure presented in this way are valid for the proposed model and that results consistent with the field can be produced.

It is very important to define the most appropriate management strategy, since WLM involves quite complex and costly processes. This model proposed in this study provides important gains for technical personnel in utilities, in terms of planning WLM activities and identifying the components that need to be improved primarily. Additionally, it will contribute to practitioners in terms of revealing the most appropriate improvement targets on a system-wide or component basis.

The optimization model suggested the graded scores according to the current score and dynamic structure of the utility. As a result, the model developed within the scope of the study suggested new levels in accordance with the nature of the problem, considering the current scores of the components in utilities.