Optimization of water distribution of network systems using the Harris Hawks optimization algorithm (Case study: Homashahr city)

In this article applies the Harris Hawks Optimization Algorithm for optimization of the water distribution network of the Homashahr located in Iran for a period of one month (from 30 September 2018 to 30 October 2019). The utilized time-series data included water demand, reservoir storage. In this article, a model based on the Harris Hawks Optimization Algorithm (HHO) was developed for the optimization of the water distribution network. The analysis showed that the best solutions achieved by the Harris Hawks Optimization Algorithm (HHO) were 35,508 $. The results revealed that the HHO algorithm was well in the optimal design of water supply networks problem. At the end, about 12% of the optimization was done by this algorithm.• In this article applied the Harris Hawks Optimization Algorithm for optimization of the water distribution network of the Homashahr located in Iran.• The method presented in this article can be useful for managers of water and wastewater companies, water resource facilities and water distribution system managing director for optimal network design to reduce costs.• The present algorithm performs better than the other algorithms in the discussion of the optimization of water distribution networks.

The Harris Hawks Algorithm (HHO) is a one of the new meta-heuristic algorithms which be used in the different optimization subjects. So far, many researchers have been used this algorithm to solve some problems. Kurtulu ¸s et al., (2020) was used the hybrid Harris hawks and simulated annealing algorithm (HHOSA) to optimize the design variables of the highway guardrails [17] . Yıldız et al., (2019) utilized the HHO in comparison with the grasshopper optimization algorithm (GOA) and the multi-verse optimization algorithm (MVO) for solving the manufacturing optimization problems [15] . Moayedi et al., (2019) compared the HHO related to the dragonfly algorithm to assess the bearing capacity of two-layer foundation soils [18] . Bao et al., (2019) introduced a novel hybrid HHO and differential evolution (DE) for color image multilevel thresholding segmentation [19] . Yıldız et al., (2019) compared some meta-heuristic algorithm including the HHO to optimize structural design of vehicle components [20] . Also, some other researches have been conducted in the field of engineering [21][22][23] .

Method description
In this paper, a model based on the Harris Hawks Algorithm (HHO) was developed for the optimization of the water distribution network (WDN) of the Homashahr located in Iran, which is effective in designing.
The HHO algorithm is coupled with the water distribution network analyze software, EPANET 2. After analyzing the model by EPANET 2, the pressure for each node and velocity of flow in each pipe are resulted then the values are compared to constraint limits.
The optimal design of water distribution systems is regarded as a problem at which the minimum cost is considered, and the diameter of pipes is considered as the main optimization parameter.
In the present paper, the time series Hydraulic dataset consists of Specifications of the nodes, pipe and, reservoir storage for a period of 1 year (2018). Also, all data is available in the Mendeley Data (https://data.mendeley.com/datasets/269dd3ywf2/draft?a = 4b1596dc-f4 4e-4 420-9b00-21c1ad32849b).
In the following, the methodology employed in this article, containing the WDN model, cost function, and optimization algorithms are explained in detail.

The Harris Hawks algorithm
In this paper, the Harris Hawks Optimizer (HHO) algorithm as a nature-inspired optimization paradigm, is proposed to solve optimization problems by Heidari et al. in 2019 [14] . This algorithm is a population-based search that is implemented in three main phases. In each iteration, search factors update its position using the three search operators for hunt (exploration phase), a transition from exploration to exploitation (extraction phase) and exploitation.
The basic steps of the HHO algorithm are described as follows ( Fig. 1 ):

Exploration phase
The observation and discovery of prey by the Harris Hawks is performed at this step. Usually, the Harris Hawks is on high trees to hunt prey. A mathematical model is introduced to stimulate the searching process of Harris Hawks such as ( 1 ), Where the Harris Hawks perch close to the hunt if q < 0.5 or perch on a random high trees if q ≥ 0.5, where q is a random number between 0 and 1.
Where X iter is the current location of candidate solution (hawks), X rand is the randomly chosen hawk among the available population, X rabit is the rabbit location, iter denotes the present iteration, r1, r2, r3, r4 and q are random numbers ranging in [0-1], LB and UB indicate the upper and lower values of the variables Xm displays the mean location of current hawks population and is computed as follows: In which X i shows the location of each hawks and N represents the size of hawks' population.

Transition from exploration to exploitation phase
The HHO computes the running energy of the bait (E) using Eq. (3) , where T is the maximum number of iteration and E 0 is the initial energy. The running energy may be changed the exploration and exploitation.
The E 0 varies randomly between [ −1, 1] then E is changing from [ −2, 2], but it decreases with the iteration increases as in ( 3 ). Therefore, if the fleeing energy of prey big (|E| ≥ 1) then the Harris Hawks are searching for fleeing prey (exploration stage), otherwise ((|E| < 1) then the Harris Hawks are trying to hunt the tired fleeing rabbits (exploitation stage).

Exploitation phase
Based on escaping states of the rabbit and different tracking plans of the hawks, four possible solutions have obtained. These solutions have changed by variation of the running energy of the bait and the besiege strategies of the hawks.
The hawks may perform a soft or hard attack to hunt the bait from different path. The "r" describes the running chance of the bait. When the running chance of the bait is less than 0.5 ( r < 0.5), the bait escape successfully, otherwise, the bait will be Caught. Moreover, when the running energy of the bait is more than 0.5 (|E| ≥0.5), the HHO performs a soft encircling maneuver, and otherwise, a hard attack is applied by the hawk. It is worth mentioning that a successful running of the bait, not only depends on the escaping energy, but also the running chance is effective parameter. Meanwhile, the process of trapping depends on both the hunt escaping and hawk besiege strategy [14] .

Optimization model formulation
There are several methods to optimize the water distribution network (WDN), which is defined in this paper the objective function of the cost reduction approach based on the reduction of the diameters by the permissible pressure in the nodes.
These problems are restrained by specified pressure head for nodes and sometimes specified velocity in pipe flow that can warranty service and secure flow with specified node demand. In this paper, the HHO algorithm is used for the optimization of water supply networks in order to minimize cost by changing pipe size. The equations for optimization can be written as: [24][25][26][27] Min Subject to: In which, C ( Di ) is the cost for unit length of diameter D for pipe i and L i is the length of pipe i and n p is the number of pipes used in the network. Continuity Equation is presented in Eq. (5) displays that the amount of water is being carried into the network should be consumed in nodal demands. There are different formulas for computing head loss and the Hazen Williams equation is one of the best known formulas regularly used for head loss calculation. The Equation used in this paper is Hazen-Williams formula as presented in Eq. (6) : where, in SI system σ = 10.67, β = 1.85, ɣ = 4.87, Q is the flow (m 3 /s), C is the Hazen-Williams roughness coefficient which equal 150, D is the diameter of pipe (m), and L is pipe length (m), [25] .
Excellent value for σ increases head loss and network needs larger diameter to deliver that amount of water because these can violate requirements for minimum pressure. Therefore, higher value for σ requires a more costly the water distribution network (WDN) design. The algorithm initiates the design process by selecting initial values for calculating design variables. Then, the algorithm checks the pressure head and velocity at each node and pipe and calculates the cost of the network. After processing a model, the pressure of each node is obtained and these values are compared to the allowable limits to compute the penalty functions as equations of ( 7 ) and ( 8 ): In this way, the objective function is defined by introducing the cost function as: Here, the constant parameters are chosen considering the detection and operation rate of the search amplitude. ε 1 is set to unity and ε 2 choose in a way that it reduces the penalties and the values of the variables, as well. Thus, in the first steps of the search process, ε 2 is set to 0.5 and ultimately increased to 1.05.

Simulation
The HHO algorithm is coupled with the water distribution network analyze software, EPANET 2. After analyzing the model by EPANET 2, the pressure for each node and velocity of flow in each pipe are resulted then the values are compared to constraint limits. The software usage process implemented in MATLAB and optimization runs were carried out on a computer. A brief description of the stags that are taken for optimization of network is given below: (1) Generate N CPs for starting analysis in MATLAB with random numbers. Each of the CPs is a possible combination of pipelines that indicates network to be solved. (2) Compute the network cost for each population and sort them for analyzes mentioned in the HHO algorithm. (3) Update the input file of the problem to be solved. In this type of optimization only pipe diameters are changed. (4) Processes network using EPANET 2 for determining pipe flow velocities and node pressures. (5) Generate penalty function and use it in determining the objective function.

Case study
The Hamashahr network model, which was analyzed by Khalife et al. [28] in Sirjan, is shown in Fig. 2 . As well as the Hamashahr network map is shown in Fig. 3 . In 2018, Khalife et al. [28] used the Darwin Designer operator in Water Gems software, which was based on a genetic algorithm to optimize Hamashahr's water distribution network in Iran. While, in this article, the new Harris Hawks algorithm (2019) which has a stronger performance for optimization, is used for this purpose. This algorithm has also been used for the first time in optimizing the distribution network.
Another difference between this method and the previous method is writing code in MATLAB software, while the previous method of optimizing the water distribution network was done only with the Water Gems software itself.
The cost of available pipe sizes that are determined for consumption in this network are {63, 90, 110, 160, 200, 250, 315; in mm} that cost {0.95, 0.995, 1.0 6 6, 1.387, 1.445, 1.725, 2.137; in Dollar/meter}. The characteristics for pipes and nodes are presented and before optimizing in Table 1 . The water required in this network is much higher than the accustomed demands for other ones, so for satisfying these demands, the maximum velocity limitation is set to 2 m/s. The pressure limit for nodes are minimum of 55 m and length of pipes are shown in Table 2 [29] . Brief description of the model in the following:      Fig. 2 shows the location of the Homashahr city in the geographical map. Fig. 3 Shows that the Homashahr network plan layout. Table 1 gives the main characteristics of the city's water distribution network Pipes before the optimization. Table 2 displays the Nodal Pressure head for the Homashahr network. Table 3 describes the objective Values of used algorithms parameters for the problem. Table 4 Show the Economic analysis after optimization with HHO. The Homashahr water distribution systems. Fig. 4 shows to converging in HHO Algorithm.

Results and discussion
The analyses of this paper displayed that the best solution achieved the algorithm presented in this paper achieved the best solution answer for this network, which equals 35,508$ by 60 0 0 iterations. It means convergence speed of this algorithm in achieving the minimum solution answer is good.
Constrain and nodal head pressure is presented in Fig. 4 . The speeds of the algorithm id good enough and it is shown in Fig. 5 that the best costs for the new algorithm can be obtained in lower iterations. The HHO algorithm reached 35,508 (13.6% away from best reached answer) after 600 iterations.
All analyses of this research for the HHO algorithm are presented in Tables 3 and Figs. 2

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.