Abstract

In view of the shortcomings of water supply network optimization design based on the traditional genetic algorithm in water supply safety and economy, an improved crossover operator adaptive algorithm and penalty function are proposed to improve the traditional genetic algorithm, which can effectively solve the problem of local optimal solution caused by too early convergence of the traditional genetic algorithm in pipe network optimization design. Taking a typical annular water supply network as an example, the calculation results show that the economy of the design scheme of the improved genetic algorithm is better than the traditional genetic algorithm, which fully shows that the improved genetic algorithm is practical and effective for the optimal design of water supply network.

1. Introduction

The design and construction of water supply network is an important part of the construction of an urban water supply system, accounting for 40%∼70% of the total investment in water supply system, which is closely related to the stable operation, maintenance, and operation of water supply system in the future [13]. Therefore, it is of great significance to optimize the design scheme of a water supply network for system construction.

The penalty function method is usually used to deal with the constraints in the optimization model of the water supply network [4], in which the penalty factor plays a major role. However, in many cases, the penalty factor is usually represented by a constant based on experience, which will lead to the inability to determine the penalty intensity so that the model obtains the local optimal solution, and the cost of pipe network construction and operation management cannot be reduced. In order to make up for this deficiency, an adaptive penalty function method is proposed; that is, the penalty factor can adjust with the number of feasible solutions in the iterative process so as to improve the search range of the model.

The traditional genetic algorithm has the problem of premature convergence in the optimal design of the pipe network, resulting in entering the local optimal solution. Among them, crossover operation [5, 6] plays a great role in the genetic algorithm and will affect the convergence of the genetic algorithm. Therefore, the use of constant crossover probability is not conducive to the algorithm to find the optimal solution. Therefore, it is necessary to update the value of crossover probability with the iteration to ensure the global search ability.

The improved genetic algorithm optimizes the crossover operator and mutation operator, updates the probability of crossover and mutation through the expectation and variance of the population, speeds up the search speed, and prevents entering the local optimal solution, which is very important for the optimal design of pipe network.

2. Mathematical Model of Water Supply Network Optimization

2.1. Objective Function

The purpose of pipe network optimization design is to seek a group of optimal pipe [7] diameter combination with the lowest cost of the pipe network on the premise of ensuring the water demand, water pressure, and reliability of the water supply system [8]. Therefore, the objective function is the annual conversion cost of the pipe network. The number of pipe segments in the pipe network is , and the number of nodes is . The formula is as follows:where is the repayment period of pipe network investment; is the annual depreciation rate of the pipe network; , , and are the coefficients and indexes in the unit cost formula of the pipe network; is the length of pipe section , mm; is the pipe diameter of pipe section , mm.

2.2. Constraints

Nodal equilibrium [9] equation is as follows:where is the incidence matrix of the pipe network diagram, is the column vector of the flow of each pipe section, and is the column vector of the node flow.

Energy balance equation of the pipe network is as follows:where is the loop matrix of the pipe network diagram; is the number of pipe network base ring; is the pressure drop of the pipe section ; is the closure error of the base ring .

Velocity limit is as follows:where and are the upper and lower limits of an economic flow rate.

2.3. Penalty Function Design

When the traditional genetic algorithm without velocity constraint is used, the velocity [1013] in the pipe section will be unstable. Some velocity far exceeds the economic velocity, while others tend to zero, which will affect the hydraulic performance of the whole pipe network [1417]. Therefore, it is necessary to construct a penalty function constrained by the economic flow rate to reduce the fitness of the pipe section whose flow rate is not within the economic range. The formula constructed by using (1) and penalty function is as follows:where is the annual conversion cost of the pipe network, is the constraint function of the economic flow rate, and is the penalty factor.

At the initial stage of evolution, there are a few feasible solutions in the population. At this time, should take a larger value to make the search quickly enter the feasible region [18]; when the proportion of feasible solutions in the population is increasing, a smaller value should be taken to make the searched feasible solutions better and better, which is very important to search the global optimal solution. Therefore, the selection of penalty factor [19, 20] is related to the proportion of feasible solutions in the group.

3. Improved Design of Genetic Algorithm

3.1. Coding Method and Fitness Function

Pipe network optimization belongs to discrete combination [2123], which applies integer coding to improve efficiency.

We construct by using the reciprocal [24] of (5) and by using (6). The formula is as follows:where is the cost function of individuals in the population; is the reciprocal of the cost function of individuals in the population; and represent the maximum and minimum values of fitness; is the fitness value of individuals in the population.

3.2. Genetic Operator Design
3.2.1. Adjustment of Crossover Probability and Mutation Probability

In order to ensure the global search ability of the genetic algorithm, it is necessary to make the crossover and mutation process self-renewal with the emergence of different situations. In this paper, the logistic function [25] is used to construct the adjustment formula of cross mutation probability [26], and it is necessary to reflect the average level of the current population fitness value through the expected EX and the deviation degree of the individual fitness value from the average level through the variance DX. By using (7) to construct and , the formula is as follows:where is expected; is the variance; is the number of chromosomes in the population; is the average fitness.

With the increase of the number of iterations, the individuals with high fitness of each generation will be retained and the ones with low fitness will be eliminated. Therefore, the overall fitness of the population will gradually increase, so the expected value will gradually increase. With more and more individuals that can be retained, the difference of the population will decrease, resulting in the decrease of variance.

We introduce population similarity [10] coefficient ρ, and the formula constructed by using (8) and (9) is as follows:where is expected; is the variance.

From formula (10), when the genetic algebra increases, the individual expectation EX will increase, while the variance will decrease, and the similarity coefficient in the population will increase, which means that with the increase of genetic algebra, the similarity [27] in the population is increasing and the difference is decreasing.

The logistic function is shown in Figure 1. By using (10), the adjustment formula of crossover probability and mutation probability is constructed as follows:where is the crossover probability, is the probability of variation, and , is the constant, , ; when increases, the crossover probability decreases [28] and the mutation probability increases.

3.2.2. Improvement of Crossover Operator

The crossover operator is very dependent on the fitness function. Improper selection of the fitness function will lead to the close fitness of individuals at the end of evolution, resulting in the failure of the crossover operator. The improved operator is not strongly dependent on the selected fitness function so that the offspring individuals are not only limited between two parent individuals, making the gene pool of the population diverse [29].

individuals were selected after the selection operation, and the probability was used for them to cross and generate random numbers , , and uniformly and independently in [0, 1]. The specific operations are as follows [30, 31]:where , , and is the parent individual pair, and is the individual pair of offspring.

3.2.3. Improvement of Mutation Operator

Let the parent chromosome be ; is the mutated element in chromosome, and the mutated element is generated randomly in interval . The formula constructed by using (15) is as follows:where is the variation element, is the minimum value, is the maximum value, and is a monotonic decreasing function.

Then, we use the generated number replacing . Among them, with the increase of evolutionary algebra , The value of is gradually reduced, so it is necessary to construct a monotonic [12] decreasing function as follows:where is the maximum iterated algebra, is the current iterated algebra, is the parameter, and the value in this paper is 3, .

As can be seen from the equation, with the increase of the number of iterations, tends to 1 at first and then to 0, so the variable interval of gradually changes from to the neighborhood of , so the search speed will be accelerated.

3.3. Pipe Network Optimization Process

First, the pipe network information is read, and the parent population is randomly generated [32]. The population size is 50, and the evolutionary algebra is 100. The annual depreciation rate and overhaul cost rate of the pipe network are  = 5, and the investment payback period is T = 10. The flow is initially distributed; then, the manual adjustment is carried out by using (2), (3), and (4), and the fitness is calculated by using (5) and (16). The intersection operation is carried out by using (13), and the variation range is determined by using (14). The crossover probability and mutation probability are obtained from (11) and (12). The natural adjustment for the selected optimal solution is carried out, and the final optimization result is output. The flowchart of pipe network optimization is shown in Figure 2.

4. Case Application

Taking Zongyang County as an example, the pipe network is a typical ring pipe network with 16 nodes and 22 pipe sections, which is supplied by a pump station. The maximum total water supply  = 1296.30 L/s and the flow and elevation of each node and the length of each pipe section are known. The water supply pipe network is shown in Figure 3.

Brand new ductile iron pipe is adopted, and its price is shown in Table 1.

4.1. Solving Penalty Function

The penalty function can be considered as a function of the proportion of feasible solutions in the population [33], and the formula is as follows:where is the constant parameter to be adjusted, and , is the proportion of feasible solutions in the current population.

Suppose is an increasing sequence ,  = 1, 2, 3, . The initial value of the penalty factor  = 1, the increase coefficient  = 1.3 is taken, with .

The problem is transformed into solving unconstrained optimization problem . Every in the iterative process is its optimal solution, and the iterative termination condition is . is a smaller value greater than 0, taking as the final . Then, there is , and inverse solution can be obtained .

We solve according to the result of inverse solution , then . The curve of penalty function about the proportion of feasible solution [34] is shown in Figure 4. It can be seen that is a subtractive function, and first decreases sharply with the increase of and then decreases slowly so that the search focus quickly shifts from the search for feasible solutions to the search for good feasible solutions.

As the number of iterations increases, the expected value increases, the variance decreases, the feasible solution becomes higher and higher, and the similarity in the population becomes higher, which leads to the decrease of crossover probability and the increase of mutation probability. Therefore, when the proportion of feasible solutions increases, the penalty function decreases, the crossover probability decreases, and the mutation probability increases.

4.2. Comparison of Optimization Algorithms

Traditional genetic algorithm and adaptive genetic algorithm are used to optimize the water supply network of Zongyang County, and the results are shown in Figures 5 and 6.

Using the traditional genetic algorithm, the initial cost is about 13.6 million, the pipe network cost is reduced to about 12.4 million after about 13 iterations and becomes stable after 63 iterations, and the pipe network cost finally converges to 11.74 million. When the adaptive genetic algorithm is adopted, the initial cost is 12.6 million, the pipe network cost is reduced to 11.3 million after 10 iterations and becomes stable after 44 iterations, and the pipe network cost converges to 10.8 million. Compared with the traditional genetic algorithm design scheme, the improved genetic algorithm can save 7.8% of the engineering cost, which fully proves that this method has obvious economic advantages.

The final pipe network layout scheme is obtained by improving the calculation of the genetic algorithm. The results are compared with the results of the simple genetic algorithm, as shown in Table 2.

4.3. Algorithm of Cross Mutation Probability Change

Figures 7 and 8 show the changes of crossover probability and mutation probability in the first 50 iterations.

When the genetic algebra increases, the individual expectation will become larger, and the variance will become smaller, the similarity coefficient [35] will become larger, the similarity in the population will become higher, and the difference will become smaller. When the similarity coefficient increases, the crossover probability decreases and the mutation probability increases. By observing the Figures 7 and 8, it is found that the crossover probability decreases gradually in a fluctuating manner, while the mutation probability increases gradually in a fluctuating manner. Therefore, the changes of crossover probability and mutation probability during the operation of the algorithm comply with the theoretical adjustment law.

5. Conclusion

Compared with the traditional genetic algorithm, the improved crossover operator proposed in this paper not only expands the search space but also can effectively prevent the premature problem and accelerate the convergence speed. The offspring generated by the general crossover operator directly replaces the parent to enter the next iteration. This paper adopts the competition between the parent and the child, and selects the optimal and suboptimal individuals to enter the next generation, which can make the population close to the region with high fitness value, and the range of mutation operator decreases with the iterative process, which speeds up the search speed and makes the convergence faster.

The adaptive penalty function can speed up the search into the feasible region and then automatically adjust the penalty factor to search for a better feasible solution, which is particularly important for searching the global optimal solution, and has high computational efficiency and better convergence.

Compared with the simple genetic algorithm design scheme, the improved genetic algorithm can save 7.8% of the engineering cost, which fully proves that this method has obvious economic advantages and has good application value and prospect in the optimal design of the water supply network.

Data Availability

All the data used to support the findings of this study are included within the article. Any other data are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This paper was supported by the National “13th Five Year Plan” Water Special Support Project (2017zx07303), Key Support Project for Provincial Natural Science Research of Colleges and Universities in Anhui Province (kj2018a0508), and Anhui Quality Engineering Support Project (2018sjjd072).