*Article* **An Improved Genetic Algorithm for Optimal Layout of Flow Meters and Valves in Water Network Partitioning**

#### **Yu Shao 1, Huaqi Yao 1, Tuqiao Zhang 1, Shipeng Chu <sup>1</sup> and Xiaowei Liu 1,2,\***


Received: 3 April 2019; Accepted: 16 May 2019; Published: 24 May 2019

**Abstract:** The paradigm of "divide and conquer" has been well used in Water Distribution Systems (WDSs) zoning planning in recent years. Indeed, Water Network Partitioning (WNP) has played an irreplaceable role in leakage control and pressure management; meanwhile it also has certain drawbacks, such as reduction of the supply reliability of the pipe network system and increased terminal dead water, as a result of the closure of the pipe section. In this paper, an improvement is made to the method proposed by Di Nardo et al. (2013) for optimal location of flow meters and valves. Three improvements to the genetic algorithm are proposed in this work for better and faster optimization in the dividing phase of WNP: preliminary hydraulic analysis which reduces the number of decision variables; modifications to the crossover mechanism to protect the superior individuals in the later stage; and boundary pipe grouping and mutation based on the pipe importance. The objective function considers the master–subordinate relationship when minimizing the number of flow meters and the difference of hydraulic state compared to original WDS. Another objective function of minimizing the deterioration of water quality compared to original WDS is also evaluated. The proposed method is applied for the WNP in a real WDS. Results show that it plays an effective role in the optimization of layout of the flow meters and valves in WNP.

**Keywords:** water network partition; genetic algorithm; hydraulic; water quality

#### **1. Introduction**

As one of the most crucial municipal infrastructures, Water Distribution Systems (WDSs) play an irreplaceable role in social and economic development. In older design philosophy of WDSs, we blindly pursued greater pipe redundancy (i.e., complicated looped system) to enhance the system's ability to protect against potential risks (e.g., pipe bursts or fire demand). There was no doubt that it brought higher reliability of supply service but meanwhile we cannot ignore the management inconvenience, especially the difficulty of water loss evaluation in such a complicated WDS, resulting in failure to detect leaks and pipe bursts in time, which were extremely harmful to the sustainable development of the social ecology [1].

Consequently, in recent years, researchers around the world have focused on finding a new approach aimed at simplifying the management of WDSs. The paradigm of "divide and conquer" was hence vigorously promoted, along with a new management model of WDSs, called District Metered Areas (DMAs), which can significantly improve the management level through real-time monitoring of inlet and outlet flows in each subsystem (i.e., water balance analysis); certainly, DMAs play broader

roles than water metering. The creation of DMAs can also help the implementation of pressure management [2] with the use of Pressure-Reducing Valves (PRVs), allowing a low level of leakage to be kept in the whole network system; additionally, replacing the PRVs with PATs (Pumps as Turbines) in the water distribution network has proven to be useful for energy recovery [3,4], which has huge application prospects in the future. Furthermore, some studies have shown that the division of DMAs do have a function of protecting the system from water contamination [5] and a better detection of pipe bursting [6].

The two main issues of DMA design are how to shape and dimension the network sub-zones (clustering phase) and where to locate meters and gate valves (dividing phase). Presently, considerable theoretical methods can be used in the clustering phase of DMA design and divide into four categories: graph theory algorithm [7–10], cluster analysis [11–13], community structure [14–17], and multi-agent algorithm [18–20]. The graph theory algorithm is first introduced to solve the WNP problems by Tzatchkov et al. [7]. They used breadth-first search (BFS) and depth-first (DFS) algorithms to find feasible partitioning solutions, and later many graph theoretic heuristic techniques were combined to better address the problems, such as Dijkstra's shortest path algorithm [9] and recursive bisection method [21], but sometimes this method cannot effectively control the number of boundary pipes, resulting in an increase in investment costs; Cluster analysis is a traditionally used method in WDS; the similarity between nodes is used to cluster the sub-zones. Perelman et al. [22] used a bottom-up hierarchical clustering algorithm, which, based on the Euclidean distance between nodes, partitioned the whole network; however, since the Euclidean distance measure does not consider the connectivity of nodes, the internal connectivity of each cluster should be verified; and lately a spectral clustering algorithm [11,12] was widely applied in the WNP issues because of its reliability in minimizing the number of edge-cuts and balancing the number of nodes for each district. Diao et al. [15] first applied the community structure algorithm, based on the concept of 'modularity' to detect the group characteristics of the WDS. This method is also widely used due to its high speed and reliability in decomposition of large-scale, complex systems [23], but the balance between DMAs is not so well, and an improved version of this method is proposed by Giustolisi and Ridolfi [24] which considers the attributes of nodes and pipes. A comprehensive comparison of the methods described above was done by Sela Perelman et al. [22] and Di Nardo et al. [17].

The DMA boundary pipes are determined after the clustering phase, and then the layout of the flow meters (i.e., open pipes) and gate valves (i.e., closed pipes) among the boundary pipes is optimized in the dividing phase to minimize the number of flow meters or the hydraulic performance deterioration [25,26], etc. Simulated Annealing algorithm [27], iterative method [12,15,16], and single-objective or multi-objective optimization based on economic [25], energy and water quality [28,29] issues can be used in this phase. The iterative method is a simple method that suitable for all sizes of WDS [15]. Through the initial analysis of the importance of each pipe (according to diameter or flow rate, etc.), the least important pipe is iteratively closed until normal hydraulic conditions cannot be met. At this point the number of flow meters reaches the minimum. The iterative method is still an empirical method in essence, and it cannot consider the joint effect caused by simultaneous closure of multiple pipes, so there is a certain gap between the results and those obtained by the heuristic algorithm [30]. The heuristic algorithms globally search the layout of the flow meter and valve position based on the hydraulic performance of the water distribution network. However, the heuristic algorithm also has its own drawback, i.e., when the number of decision variables increases, the convergence efficiency drops significantly because the search space grows exponentially.

In this study, the main work is done to improve the optimization performance and efficiency of the genetic algorithm (GA) in the dividing phase of WNP, which consists of selection, crossover, and mutation operations, developed by Goldberg et al. [31]. The contributions of this work are listed below: 1) Changing the dual-objective problem to a single-objective problem by considering the master–subordinate relationship of the two objective function, which improved the computational efficiency; 2) Three improvements integrated in the GA, including preliminary analysis of boundary pipes, modified crossover and mutation mechanism, and the case study verified the superiority of this strategy, especially in terms of stability of output and convergence speed. The objective functions to consider the network resilience and the water quality impact caused by WDS partition were tested independently. As a result, a high similarity in the locations of flow meters and gate valves for these two objective functions are found.

#### **2. Methodology**

The framework of the whole partitioning methodology is shown in Figure 1. In the clustering stage, a modularity-based algorithm [32] is applied to deal with the problem of sectorization, and the adjacency matrix *Aij* of topology structure and total number of pipes m is needed as initial parameters; then the GA is used in the optimization procedure of the dividing stage.

**Figure 1.** Flowchart of the whole methodology.

#### *2.1. Network Clustering*

Similar to many physical and social processes (e.g., business and academic circles) in the world, a water distribution system can also be naturally characterized by a simple topological graph G = G(V,E), where V represents n nodes (consumers, sources, and tanks) and E represents m edges (pipes, valves, and pumps) in a WDS. The approach adopted in this phase owns a bottom-up merge process and is based on the concept of 'modularity', which can quantify the quality of WDS partition [23,32,33], called the Fast-Newman algorithm. The modularity *Q* is expressed in Equation (1), and *Q* ≥ 0.3 indicates a good division into communities [16].

$$Q = \frac{1}{2m} \sum\_{vw} \left( A\_{vw} - \frac{k\_v k\_w}{2m} \right) \delta(c\_v, c\_w) \quad Q \in [-0.5, 1) \tag{1}$$

where *m* represents the total number of links in the network; *v* and *w* are vertexes indexes; *kv* (*kw*) is the sum of the number of edges connected to vertex *v (w)*; *Avw* = 1 if there is a link connecting the vertexes *v* and *w*; *Avw* = 0 otherwise; *cv*, *cw* is the communities which the vertexes *v* and *w* belong to; δ*(cv,cw )* = 1 if vertexes *v* and *w* are in the same community, 0 otherwise. The brief steps of the algorithm are described below:


$$
\Delta Q\_{vw} = \begin{cases}
\frac{1}{2m} - \frac{k\_v k\_w}{\left(2m\right)^2}, & \text{if } v, w \text{ are connected} \\
& 0, \quad \text{otherwise}
\end{cases}
\tag{2}
$$

The partition scheme with highest *Q* value represents its sub-systems that have stronger internal than external connections, but is not necessarily the best solution because the DMA size needs to be controlled between 500–5000 customer connections according to the guidelines [34]. It becomes much more difficult to control water losses and locate the new bursts when a DMA contains more than 5000 customers [27]; meanwhile more investment will be spent if the size of DMA is too small. Therefore, what we indeed need is the scheme with highest *Q* value given the premise of satisfying the size constraint. More detail about the Fast-Newman algorithm can be found in previous literature [15,24].

#### *2.2. Network Dividing*

For the dividing stage of WNP (Water Network Partitioning), Di Nardo et al. [25] proposed a method based on GA with the following objective function, to protect the hydraulic performance of the original system as much as possible:

$$OF1 = \max\left(P\_D = \gamma \sum\_{i=1}^{n} Q\_i H\_i\right) \tag{3}$$

where γ is the specific weight of water, *Qi* and *Hi* are the water demand and head at each network node, and *PD* is the total node power of the network. Generally, partitioning schemes with more flow meters (i.e., closing fewer pipes) would have a higher objective value *PD*, hence the optimal solution is the case that all the boundary pipes are installed with flow meters (i.e., remain open). However, it is not the answer we truly need as more flow meters lead to a less convenient management and higher cost. Therefore Di Nardo et al. [25] tried to solve the above problem by determining the number of flow meters in advance, but it is difficult to decide how many flow meters should be installed as a trade-off between the hydraulic performance and cost, especially for large-scale WDN. Therefore, the number of flow meters should be considered to be one of the objective functions instead of being a predetermined value. Thus, it forms a dual-objective problem as Equation (4):

$$OF2 = \begin{cases} \min\limits(N\_{fm})\\ \max\limits(P\_D) \end{cases} \tag{4}$$

At this point, the NSGA-II algorithm [35] is generally used to optimize this dual-objective problem. It is feasible but not the optimal selection—in the previous literature, almost all researchers agree that the number of flow meters should be reduced as much as possible in the dividing phase of WNP under the premise of meeting normal hydraulic conditions (i.e., all demand nodes should meet the minimum service pressure) [15,16]. If possible, the best solution would be each district own just one single inflow meter [25], because fewer flow meters can not only simplify the calculation of the synchronous water balance and improve the reliability of flow monitoring, but also reduce the costs of initial investment and later operation and maintenance costs. Therefore, we would like the second objective function in Equation (4) to be subjected to the first one; in other words, we would give the priority to the choice of the scheme with fewer flow meters, and then consider the role of the second objective function. However, the NSGA-II algorithm cannot embody this relationship between the two objective functions, resulting in a lot of time wasted on optimizing solutions (Pareto frontier).

To address above problem, this paper proposes a new objective function form shown in Equation (5), which can not only combine the two objective functions together, but also embodies the primary and secondary relations of the two objective functions. The purpose of the first term is to minimize the number of flow meters (its value is an integer) and the second term is to search the solution that has less impact on the hydraulic performance compared to original WDN. The value of the second term is between 0 and 1, ensuring that the latter one is subject to the former one.

$$OF3 = \min\left(N\_{fm} + \frac{P\_{D0} - P\_D}{P\_{D0}}\right) \tag{5}$$

where *Nfm* is the number of flow meters, *PD0* is the total node power of the network before WNP and *PD* is the total node power after WNP.

The fitness function, Equation (6), is obtained using the boundary construction method, by changing the minimum optimization into the maximum optimization, and the fitness value can be ensured larger than zero.

$$Fit = N\_p - OF3 = N\_p - N\_{fm} - \frac{P\_{D0} - P\_D}{P\_{D0}} = N\_{\mathbb{S}^\upsilon} - \frac{P\_{D0} - P\_D}{P\_{D0}} \tag{6}$$

where *Np* is the number of boundary pipes, *Ngv* represents the number of gate valves

To adjust the selective pressure effectively, a rank-based fitness assignment method [36,37] is adopted to better distinguish the fitness between individuals, especially in the later stage of optimization. The specific fitness assignment function is shown in Equation (7)

$$Fit(i) = 2 - SP + \frac{2(SP - 1)(i - 1)}{n - 1}, \text{ SP\varepsilon}[1.0, 2.0] \tag{7}$$

where *i* is the rank of an individual in the population, *SP* is the selection pressure and set *SP* = 1.5 in this work, and *n* is the size of the population. A simple example (the population size *n* adopts 5) is given to better understand the role of the rank-based fitness assignment method in this work as shown in Table 1. The real fitness values are firstly calculated with Equation (6), then rank the individuals in the following way: the best one has rank *n* and the worst one has rank 1.


**Table 1.** A simple example of rank-based fitness assignment method.

Another objective function is adopted in this paper which considers minimizing the deterioration of water quality caused by WNP. The water velocity of pipes is used as an indicator to evaluate the water quality change before and after WNP. Giving the objective function in Equation (8).

$$\text{OF4} = \min \left( \text{N}\_{fm} + \frac{\sum\_{i=1}^{p} \text{VO}\_{i} \Delta v\_{i} \delta(m\_{1}, m\_{2})}{\sum\_{i=1}^{p} \text{VO}\_{i} v\_{i}} \right) \tag{8}$$

where *p* is the number of pipes; *VO* is the pipe volume; *v* is the pipe velocity before WDP; *m1* representing the event that the pipe velocity after WDP is lower than before, *m2* representing the event that the pipe velocity after WDP is lower than 0.1 m/s, and δ *(m1, m2)* = 1 if both events *m1* and *m2* are true at the same time, 0 otherwise; *vi* is the flow velocity difference before and after WNP.

#### *2.3. Improvements for Better Optimization*

The binary coding is used to encode the chromosomes (i.e., individual), one chromosome is composed of a sequence of genes. Gene *i* assumes 0 if a flow meter installed in *i*-th pipe; otherwise, the value is 1 if a gate valve installed. As mentioned by other scholars, the efficiency of GA is obviously affected by the number of decision variables (i.e., boundary pipes) in the optimization process of dividing phase [15]. There are two main reasons: first, the increasing number of decision variables inevitably leads to an exponential growth in search space, significantly affecting the optimization efficiency and making the entire optimization process more time-consuming. Second, binary coding cannot truly reflect the relationship between genes [38], which are not really independent of each other (e.g., for a DMA without water source, all the boundary pipes connecting it cannot be closed at the same time otherwise no water will be supplied in this area). Moreover, the common crossover mechanism has great damage to individuals especially for those superior individuals in the later stage of optimization because of the direct break of chromosomes, though in the earlier stage it helps to maintain the diversity of the population. This drawback becomes more apparent when the length of the chromosome increases. To address the above-mentioned issue, three improvements are proposed in this work

Step 1: Reduce the number of decision variables through preliminary analysis

In fact, there are several pipes among the boundary pipes that are not necessary to participate in gene coding, because the closure of any one of them will result in local pressure deficit or even water supply disruption (e. g. main water transmission pipes or a unique inflow pipe for one specific DMA). The gene points corresponding to those pipes must be installed with flow meters can hence be deleted from the chromosome. In this way, the search space is greatly reduced.

The specific method in the procedure is as follows: Each time close one boundary pipe (all other boundary pipes should be open except the selected one) and then run the hydraulic simulation to find the pipes where the minimum pressure is lower than the normal service pressure, i.e., this boundary pipe must be opened to satisfy the minimum pressure and can be removed from the decision variables (the chromosome). All the pipes to be removed from the chromosome can be found by repeating this procedure for all the boundary pipes.

#### Step 2: Modify the crossover mechanism

A new crossover mechanism is proposed to better protect the individuals in the later stages of optimization; at the same time, it enhances the local search ability of the algorithm. The pseudo-code of new crossover mechanism is described in Figure 2b, where *gn* represents the current generation, *GN* represents the total operation generations which should be determined in advance, *pc* is the first crossover probability with a fixed value of 0.8 meanwhile *pc1* is the second crossover probability, which is related to the current generation *gn*. As shown in Figure 2a, mode 1 is the traditional crossover method meanwhile mode 2 is a new crossover method that exchanges the positions of two gene points, one coded 1, another coded 0; both of them are randomly selected (the physical meaning is to change the location of one randomly chosen flow meter meanwhile the total number of flow meters remains unchanged). As the generation (i.e., *gn*) increases, the probability of the mode 1 becomes smaller and the mode 2 becomes larger because of the declining value of *pc1.* The crossover method of mode 2 can better prevent the superior individuals not being damaged.

**Figure 2.** The crossover mechanism: (**a**) schematic diagram; (**b**) the pseudo-code.

#### Step 3: Improve the mutation parameter

Through assigning 'mutation parameter' to each gene point, the importance level of each boundary pipe can hence be embodied and mutually distinguished in the optimization procedure, effectively accelerating the convergence velocity. At the same time, it will not lose the ability to search for potentially better solution such as the iterative method because of the absolute ordering relationship.

The boundary pipes are first divided into subgroups based on the flow direction under the peak demand hour. To better illustrate the method, an example is shown in Figure 3a; pipe 1, 3, 5 are classified together because they are all the inflow pipes belonging to DMA1 and pipe 2, 6 are grouped together likewise. The pipes classified in the same subgroup play an identical role in the WDS (i.e., supply water for the same DMA), hence they are substitutes for each other and can be classified together for comparison to show the distinction in importance.

Then we determine the 'mutation parameter' for each boundary pipe according to Equation (9). Taking Figure 3a as an example, for DMA1, the flow rates of three inflow pipes 1, 3, 5 are 35 L/s, 136

L/s, 12 L/s respectively, and the corresponding 'mutation parameters' are 0.4290, 0.7049, 0.3661 as calculated by Equation (9).

$$Pa\_{i,j} = 0.5 + \frac{0.5(Q\_{i,j} - Mean\_i)}{Sum\_i} \tag{9}$$

where *Pai,j* is the 'mutation parameter' of *j*th pipe in *i*th group; *Qi,j* is the flow rate of *j*th pipe in *i*th group; *Meani* is the average flow rate of *i*th group; *Sumi* is the sum of the flow rate of all pipes in *i*th group. The 0.5 in Equation (9) means the boundary pipes have the same possibility to install flow meters or gate valves if we do not consider any hydraulic characteristics, and the second term in RHS of Equation (9) considers their hydraulic importance (the 0.5 in the second term ensures *Pai,j* less than 1).

As we can see, the more important pipe owns larger values of 'mutation parameter' such that it has greater possibility of being an inflow pipe with the flow meter installed (Figure 3b shows the pseudo-code). Taking pipe 3 as an example, it is the most important one of the three and owns the highest value 0.7049. Then, when its corresponding gene point is selected as the mutation point, if a randomly generated number (ranging from 0 to 1) is greater than 0.7049, the gene value becomes 1 (i.e., install the valve), otherwise it becomes 0 (i.e., install the flow meter). In this way the more important pipe has a larger opportunity to become an inflow pipe outside of being closed.

**Figure 3.** Mutation based on boundary pipes grouping: (**a**) illustration example of grouping; (**b**) the pseudo-code of the mutation mechanism.

#### **3. Results and Discussion**

We test the proposed methodology in a medium-size water distribution system located in southern China, H Town [39], which owns one fixed-head reservoir, 898 demand nodes, and 1012 pipes. Under the peak hour demand scenario, a minimum service pressure of 24 m is required-more details can be referred to Table 2.


In the clustering stage of WNP, the Fast-Newman algorithm is used to create the sub-zones (results shown in Figure 4). The characteristics of DMAs are shown in Table 3. All DMAs satisfy the size constraint mentioned above and the value of modularity Q is 0.713, a fairly high value because of the relatively obvious community characteristics the WDS owns.


**Table 3.** Characteristics of H town's DMAs.

**Figure 4.** Final DMA configuration of H town.

After the above procedure, a set of boundary pipes containing 48 pipes (corresponding to 48 decision variables) is obtained, and then the layout of the flow meters and gate valves among these boundary pipes is optimized using GA with objective function *OF3* (a population of 50 individuals, 200 generations, *P*corss = 0.8, *P*mut = 0.1). Hydraulic simulation is carried out during the peak water demand and a minimum service pressure of 24 m is required. *MATLAB*, combined with the well-known hydraulic simulator EPANET 2 (Rossman, 2000), is used in this optimization procedure.

The results of five runs (GA without any improvement strategy) are shown in Figure 5a and Table 4. We can clearly see that the results are not good as even the number of minimum flow meters cannot be stably obtained, let alone finding a solution that has the least impact on hydraulic performance under the premise of the minimum number of flow meters. There are non-negligible differences of the locations of flow meters between the solutions (a similar situation exists even if runs 500 generations).

**Figure 5.** Comparison of optimization results: (**a**) GA without improvements; (**b**) GA with improvements.

**Table 4.** Results comparison of 5 runs between original GA and improved GA for *OF3*.


Note: # The difference of pipe index (marked in bold) installed with flow meters, compared with the best solution (trials 1b, 3b, 4b are thought to be the best solution founded so far).

To improve the optimization efficiency, the GA with the improvements described in Section 2.3 is applied in this case study. Table 5 shows the eight pipes excluded by the preliminary hydraulic analysis. The first five pipes are obviously the main transmission pipes, meanwhile the last three are the crucial inflow pipes for the special DMAs. These flow meter install locations are shown in Figure 4 marked in red. The search space is hence reduced from 248 to 240.

**Table 5.** The excluded 8 pipes by preliminary hydraulic analysis.


The optimization results with improved GA are shown in Figure 5b and Table 4. The hydraulic performance comparison of the ten trials is given in Table 6. The performance indices include minimum pressure *Pmin*, mean pressure *Pmean*, resilience index *Ir*, total node power *PD*, the number of flow meters *Nfm* and gate valves *Ngv*. Compared to the original GA, the improved GA converges faster, because the original GA needs at least 100 generations to converge while the improved GA needs 50 generations except the trial 1b needs about 80 generations. The solutions of the improved GA are much better than that of the original GA, since the average fitness increased from 28.55 to 28.98; the average pressure *Pmean* increased from 32.28 m to 33.55 m and the average resilience index *Ir* increased from 0.6371 to 0.7114. The solutions of the improved GA are more stable than that of the original GA. As shown in the bottom half part of Table 4, trials 1b, 3b, 4b obtain the same result (fitness = 28.98079, the corresponding locations of flow meters and valves are also shown in Figure 4 marked in black), which indicate the best solution found so far. Trial 2b, 5b are just slightly worse than the best solution.


**Table 6.** Performance comparison of 10 trials (*OF3*).

They have only one different flow meter location (marked in red) compared with the best layout scheme, far better than the results obtained by original GA without improvement (the differences are also marked in red), which has four differences on average compared with the best scheme. The worst one has six differences. Taking trial 4a and 4b as an example, even though the scheme of trial 4a owns one more flow meter than the trial 4b, the deterioration of the hydraulic performance of the WDS is unexpectedly more than three times compared with the trial 4b (*PD* declines by 6.4% versus 1.9%). The comparison of pressure distribution between the original network and the best WNP scheme is shown in Figure 6a; there is a minor pressure drop compared to the original network and most of the nodes remain the previous pressure level (i.e., 34 m).

To further prove the superiority and practicality of the proposed method, the objective function *OF4* is also tested in this work. The optimization results using GA before and after improvements are shown in Table 7. The performance to the search optimal solution is also improved a lot, much like solving objective function *OF3*. The flow velocity distribution before and after the WNP is shown in Figure 6b (only counts the flow velocity less than 0.1 m/s); we can clearly see that there is a marked increase in water volume when the flow velocity is between 0.01 m/s and 0.06 m/s, but the total amount of water with a flow velocity less than 0.1 m/s is approximately equal, indicating that the velocity distribution becomes more uneven after the WNP.

Through a comparison between two final optimal schemes based on different objective functions, we find there are just two different flow meter locations (*OF3*: pipe index of 277, 698; *OF4*: pipe index of 488, 749). Here we run the optimization procedures independently based on *OF3* or *OF4*. Their solutions gave the same number of the flow meters. Certainly, it is possible to yield a trade-off between

the hydraulic performance and water quality through combining the two objective functions together. The two solutions are the two points of the Pareto frontier if we run multi-objective optimization.

**Figure 6.** Comparison of pressure and velocity distribution before and after WNP: (**a**) Pressure distribution; (**b**) Velocity distribution with velocity < 0.10 m/s.


**Table 7.** Results comparison of 5 runs between original GA and improved GA for *OF4*.

Note: # The difference of pipe index (marked in bold) installed with flow meters, compared with the best solution (trial 1b is thought to be the best solution founded so far).

#### **4. Conclusions**

A new objective function proposed in this article combined with the rank-based fitness assignment method can successfully embody the master–subordinate relationship of the two objective functions and effectively avoid wasting too much time on optimizing unnecessary solutions. The minimum of the number of the flow meter is the master term of objective function while hydraulic performance or water quality deterioration is subordinate term. Three improvements are applied for a better and faster optimization in the dividing phase of WNP, including the reduction of search space through initial hydraulic analysis, modification of the crossover mechanism for a better search ability at the later stage of optimization, and boundary pipe grouping and mutation based on the pipe importance. The proposed method is applied for the WNP in a real WDS. Results show that it plays an effective role in the optimization of layout of the flow meters and valves in WNP.

Overall, in comparison with the iterative method [15,16], which is in essence an empirical method, the heuristic algorithm considers the joint effect caused by the simultaneous closure of multiple pipes (although it is more time-consuming). The multi-objective optimization method usually takes too much time to search the solutions with different number of flow meters. Moreover, the optimization goals should deserve attention. They are usually related to economic feasibility [40–42] or the preservation of the hydraulic reliability of the WDN [11,17]; other aspects such as pressure uniformity and water

quality issues are also included. In contrast to Ferrari et al. [21] and Brentan et al. [43], we try not to make the original flow velocity deteriorate, especially for pipes that originally had a low flow velocity. More attention can be paid to better execute pressure management [44] or more quickly detect and control accidental events (e.g., pipe bursts and water contamination) in future research.

**Author Contributions:** Conceptualization, Y.S. and H.Y.; Formal analysis, H.Y., Y.S. and X.L.; Methodology, H.Y. and S.C.; Supervision, T.Z.; Validation, H.Y.; Writing – original draft, H.Y., Shao Yu and X.L.; Writing – review and editing, Y.S. and T.Z.

**Funding:** The present research is funded by the National Key Research and Development Program of China (No. 2016YFC0400600), the National Science and Technology Major Projects for Water Pollution Control and Treatment (2017ZX07502003-05, 2017ZX07201-003), the Science and Technology Program of Zhejiang Province (Nos.2017C33174 and 2015C33007), the National Natural Science Foundation of China (No. 51761145022), and the Fundamental Research Funds for the Central Universities (No. 2019FZA4019).

**Acknowledgments:** The authors greatly thank Yanxi Yu for his discussion and suggestion.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


© 2019 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 (http://creativecommons.org/licenses/by/4.0/).

#### *Article*
