# Optimal Design of Water Supply Network Based on Adaptive Penalty Function and Improved Genetic Algorithm

Authors: Kun Ding; Yong Ni; Lingfeng Fan; Tian-Le Sun
Journal: Mathematical Problems in Engineering
 (2022)

---

## 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.


---

## Body

## 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 [1–3]. 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 F of the pipe network. The number of pipe segments in the pipe network is N, and the number of nodes is I. The formula is as follows:(1)F=1T+P100∑j=1Na+bdjcLj,where T is the repayment period of pipe network investment; P is the annual depreciation rate of the pipe network; a, b, and c are the coefficients and indexes in the unit cost formula of the pipe network; Lj is the length of pipe section j, mm; dj is the pipe diameter of pipe section j, mm.


### 2.2. Constraints

Nodal equilibrium [9] equation is as follows:(2)∑Aq+Q=0,where A is the incidence matrix of the pipe network diagram, q is the column vector of the flow of each pipe section, and Q is the column vector of the node flow.Energy balance equation of the pipe network is as follows:(3)Bhj−ΔHk=0,where B is the loop matrix of the pipe network diagram; K is the number of pipe network base ring; hj is the pressure drop of the pipe section j; ΔHk is the closure error of the base ring K.Velocity limit is as follows:(4)vmin≤vj≤vmax,where vmax and vmin 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 [10–13] 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 [14–17]. 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:(5)Fd=F+k∑maxvjmin−vj,0,vj−vjmax2,where F is the annual conversion cost of the pipe network, ∑maxvjmin−vj,0,vj−vjmax2 is the constraint function of the economic flow rate, and k is the penalty factor.At the initial stage of evolution, there are a few feasible solutions in the population. At this time,k 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 k 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] k is related to the proportion of feasible solutions in the group.


## 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 F of the pipe network. The number of pipe segments in the pipe network is N, and the number of nodes is I. The formula is as follows:(1)F=1T+P100∑j=1Na+bdjcLj,where T is the repayment period of pipe network investment; P is the annual depreciation rate of the pipe network; a, b, and c are the coefficients and indexes in the unit cost formula of the pipe network; Lj is the length of pipe section j, mm; dj is the pipe diameter of pipe section j, mm.


## 2.2. Constraints

Nodal equilibrium [9] equation is as follows:(2)∑Aq+Q=0,where A is the incidence matrix of the pipe network diagram, q is the column vector of the flow of each pipe section, and Q is the column vector of the node flow.Energy balance equation of the pipe network is as follows:(3)Bhj−ΔHk=0,where B is the loop matrix of the pipe network diagram; K is the number of pipe network base ring; hj is the pressure drop of the pipe section j; ΔHk is the closure error of the base ring K.Velocity limit is as follows:(4)vmin≤vj≤vmax,where vmax and vmin 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 [10–13] 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 [14–17]. 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:(5)Fd=F+k∑maxvjmin−vj,0,vj−vjmax2,where F is the annual conversion cost of the pipe network, ∑maxvjmin−vj,0,vj−vjmax2 is the constraint function of the economic flow rate, and k is the penalty factor.At the initial stage of evolution, there are a few feasible solutions in the population. At this time,k 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 k 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] k 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 [21–23], which applies integer coding to improve efficiency.We constructf′d by using the reciprocal [24] of (5) and fd by using (6). The formula is as follows:(6)f′d=1Fd,(7)fd=1fmax′−fmin′×f′where Fd is the cost function of individuals in the population; f′d is the reciprocal of the cost function of individuals in the population; fmax′ and fmin′ represent the maximum and minimum values of fitness; fd 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 EX and DX, the formula is as follows:(8)EX=f1+f2+…fMM,(9)DX=f12+f22+…fM2M−f¯2,where EX is expected; DX is the variance; M is the number of chromosomes in the population; f¯ 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:(10)ρ=EX+1DX,where EX is expected; DX is the variance.From formula (10), when the genetic algebra increases, the individual expectation EX will increase, while the variance DX 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 Figure1. By using (10), the adjustment formula of crossover probability and mutation probability is constructed as follows:(11)Pc=11+e−h1/ρ−0.15,(12)Pm=h261+e1/ρ,where Pc is the crossover probability, Pm is the probability of variation, and h1, h2 is the constant, h1∈0,+∞, h2∈0,1; when ρ increases, the crossover probability decreases [28] and the mutation probability increases.Figure 1
Logistic function.


#### 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].M individuals were selected after the selection operation, and the probability Pc was used for them to cross and generate random numbers a, b, and c uniformly and independently in [0, 1]. The specific operations are as follows [30, 31]:(13)x2in+1=ax2in+bx2i+1n+cx2i+1n−x2inx2i+1n+1=ax2i+1n+bx2in+cx2i+1n−x2in,where c∈0,1,a∈0,1,a+b=1, i=1,2,…,M/2, x2in and x2i+1n is the parent individual pair, x2in+1 and x2i+1n+1 is the individual pair of offspring.


#### 3.2.3. Improvement of Mutation Operator

Let the parent chromosome bex2in=x1,x2,…,xk,…,xN; xkϵxkmin,xkmax is the mutated element in chromosome, and the mutated element x2in+1 is generated randomly in interval θ. The formula constructed by using (15) is as follows:(14)θ=xk−μnxk−xkmin,xk+μnxkmax−xk,where xk is the variation element, xkmin is the minimum value, xkmax is the maximum value, and μn is a monotonic decreasing function.Then, we use the generated numberx2in+1 replacing x2in. Among them, with the increase of evolutionary algebra T, The value of μn is gradually reduced, so it is necessary to construct a monotonic [12] decreasing function as follows:(15)μn=1−r1−nTb,where T is the maximum iterated algebra, n is the current iterated algebra, b is the parameter, and the value in this paper is 3, R∈0,1.As can be seen from the equation, with the increase of the number of iterations,μn tends to 1 at first and then to 0, so the variable interval of xk gradually changes from xkmin,xkmax to the neighborhood of xk, 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 p = 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.Figure 2
Flowchart of pipe network optimization.


## 3.1. Coding Method and Fitness Function

Pipe network optimization belongs to discrete combination [21–23], which applies integer coding to improve efficiency.We constructf′d by using the reciprocal [24] of (5) and fd by using (6). The formula is as follows:(6)f′d=1Fd,(7)fd=1fmax′−fmin′×f′where Fd is the cost function of individuals in the population; f′d is the reciprocal of the cost function of individuals in the population; fmax′ and fmin′ represent the maximum and minimum values of fitness; fd 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 EX and DX, the formula is as follows:(8)EX=f1+f2+…fMM,(9)DX=f12+f22+…fM2M−f¯2,where EX is expected; DX is the variance; M is the number of chromosomes in the population; f¯ 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:(10)ρ=EX+1DX,where EX is expected; DX is the variance.From formula (10), when the genetic algebra increases, the individual expectation EX will increase, while the variance DX 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 Figure1. By using (10), the adjustment formula of crossover probability and mutation probability is constructed as follows:(11)Pc=11+e−h1/ρ−0.15,(12)Pm=h261+e1/ρ,where Pc is the crossover probability, Pm is the probability of variation, and h1, h2 is the constant, h1∈0,+∞, h2∈0,1; when ρ increases, the crossover probability decreases [28] and the mutation probability increases.Figure 1
Logistic function.


### 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].M individuals were selected after the selection operation, and the probability Pc was used for them to cross and generate random numbers a, b, and c uniformly and independently in [0, 1]. The specific operations are as follows [30, 31]:(13)x2in+1=ax2in+bx2i+1n+cx2i+1n−x2inx2i+1n+1=ax2i+1n+bx2in+cx2i+1n−x2in,where c∈0,1,a∈0,1,a+b=1, i=1,2,…,M/2, x2in and x2i+1n is the parent individual pair, x2in+1 and x2i+1n+1 is the individual pair of offspring.


### 3.2.3. Improvement of Mutation Operator

Let the parent chromosome bex2in=x1,x2,…,xk,…,xN; xkϵxkmin,xkmax is the mutated element in chromosome, and the mutated element x2in+1 is generated randomly in interval θ. The formula constructed by using (15) is as follows:(14)θ=xk−μnxk−xkmin,xk+μnxkmax−xk,where xk is the variation element, xkmin is the minimum value, xkmax is the maximum value, and μn is a monotonic decreasing function.Then, we use the generated numberx2in+1 replacing x2in. Among them, with the increase of evolutionary algebra T, The value of μn is gradually reduced, so it is necessary to construct a monotonic [12] decreasing function as follows:(15)μn=1−r1−nTb,where T is the maximum iterated algebra, n is the current iterated algebra, b is the parameter, and the value in this paper is 3, R∈0,1.As can be seen from the equation, with the increase of the number of iterations,μn tends to 1 at first and then to 0, so the variable interval of xk gradually changes from xkmin,xkmax to the neighborhood of xk, so the search speed will be accelerated.


## 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 EX and DX, the formula is as follows:(8)EX=f1+f2+…fMM,(9)DX=f12+f22+…fM2M−f¯2,where EX is expected; DX is the variance; M is the number of chromosomes in the population; f¯ 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:(10)ρ=EX+1DX,where EX is expected; DX is the variance.From formula (10), when the genetic algebra increases, the individual expectation EX will increase, while the variance DX 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 Figure1. By using (10), the adjustment formula of crossover probability and mutation probability is constructed as follows:(11)Pc=11+e−h1/ρ−0.15,(12)Pm=h261+e1/ρ,where Pc is the crossover probability, Pm is the probability of variation, and h1, h2 is the constant, h1∈0,+∞, h2∈0,1; when ρ increases, the crossover probability decreases [28] and the mutation probability increases.Figure 1
Logistic function.


## 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].M individuals were selected after the selection operation, and the probability Pc was used for them to cross and generate random numbers a, b, and c uniformly and independently in [0, 1]. The specific operations are as follows [30, 31]:(13)x2in+1=ax2in+bx2i+1n+cx2i+1n−x2inx2i+1n+1=ax2i+1n+bx2in+cx2i+1n−x2in,where c∈0,1,a∈0,1,a+b=1, i=1,2,…,M/2, x2in and x2i+1n is the parent individual pair, x2in+1 and x2i+1n+1 is the individual pair of offspring.


## 3.2.3. Improvement of Mutation Operator

Let the parent chromosome bex2in=x1,x2,…,xk,…,xN; xkϵxkmin,xkmax is the mutated element in chromosome, and the mutated element x2in+1 is generated randomly in interval θ. The formula constructed by using (15) is as follows:(14)θ=xk−μnxk−xkmin,xk+μnxkmax−xk,where xk is the variation element, xkmin is the minimum value, xkmax is the maximum value, and μn is a monotonic decreasing function.Then, we use the generated numberx2in+1 replacing x2in. Among them, with the increase of evolutionary algebra T, The value of μn is gradually reduced, so it is necessary to construct a monotonic [12] decreasing function as follows:(15)μn=1−r1−nTb,where T is the maximum iterated algebra, n is the current iterated algebra, b is the parameter, and the value in this paper is 3, R∈0,1.As can be seen from the equation, with the increase of the number of iterations,μn tends to 1 at first and then to 0, so the variable interval of xk gradually changes from xkmin,xkmax to the neighborhood of xk, 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 p = 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.Figure 2
Flowchart of pipe network optimization.


## 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 supplyq = 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.Figure 3
Pipe network of Zongyang County.Brand new ductile iron pipe is adopted, and its price is shown in Table1.Table 1
Price of ductile iron pipe.
Pipe diameter (mm)Unit price (yuan•m−1)Pipe diameter (mm)Unit price (yuan•m−1)20026445065825037850073530045460088735051570010284005928001176


### 4.1. Solving Penalty Function

The penalty function can be considered as a functionkz of the proportion z of feasible solutions in the population [33], and the formula is as follows:(16)kz=10λ1−z,where λ is the constant parameter to be adjusted, and λ>0, z is the proportion of feasible solutions in the current population.SupposeK is an increasing sequence kw, w = 1, 2, 3, ⋯. The initial value of the penalty factor k0 = 1, the increase coefficient σ = 1.3 is taken, with kw=σkw−1=…=σwk0.The problem is transformed into solving unconstrained optimization problemminFD,kw. Every kw in the iterative process is its optimal solution, and the iterative termination condition is Dw−Dw−1<τ. τ is a smaller value greater than 0, taking kw as the final k. Then, there is k=10λ, and inverse solution can be obtained λ=lgk.We solve according to the result of inverse solutionλ,k=kw=σwk0=1.344×1=103159≈100000, then λ=lgk=5. The curve of penalty function about the proportion of feasible solution [34] is shown in Figure 4. It can be seen that kz is a subtractive function, and k first decreases sharply with the increase of z and then decreases slowly so that the search focus quickly shifts from the search for feasible solutions to the search for good feasible solutions.Figure 4
Penalty function diagram.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 Figures5 and 6.Figure 5
Traditional genetic algorithm.Figure 6
Adaptive genetic algorithm.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 Table2.Table 2
Comparison of results.
NumberTube lengthImproved genetic algorithmSimple genetic algorithmPipe diameterCurrent speedPipe diameterCurrent speed1303.54000.833000.862419.53500.793000.823394.33000.743000.7444712500.622000.865258.33000.653000.656486.24000.853000.877528.95000.863000.928422.83000.622000.689422.87001.258000.9510426.73000.642000.7111222.32500.612000.6812222.33000.672000.7513394.32000.812000.8114482.77001.358001.2615500.64000.853000.9216644.94000.913001.0517470.93000.652000.6918465.76001.218001.1519275.27001.268001.0220308.37001.328001.2421429.88001.388001.3822163.38001.358001.35Annual conversion cost/Ten thousand yuan1082.451174.26


### 4.3. Algorithm of Cross Mutation Probability Change

Figures7 and 8 show the changes of crossover probability and mutation probability in the first 50 iterations.Figure 7
Variation of crossover probability.Figure 8
Variation of mutation probability.When the genetic algebra increases, the individual expectationEX will become larger, and the variance DX 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.


## 4.1. Solving Penalty Function

The penalty function can be considered as a functionkz of the proportion z of feasible solutions in the population [33], and the formula is as follows:(16)kz=10λ1−z,where λ is the constant parameter to be adjusted, and λ>0, z is the proportion of feasible solutions in the current population.SupposeK is an increasing sequence kw, w = 1, 2, 3, ⋯. The initial value of the penalty factor k0 = 1, the increase coefficient σ = 1.3 is taken, with kw=σkw−1=…=σwk0.The problem is transformed into solving unconstrained optimization problemminFD,kw. Every kw in the iterative process is its optimal solution, and the iterative termination condition is Dw−Dw−1<τ. τ is a smaller value greater than 0, taking kw as the final k. Then, there is k=10λ, and inverse solution can be obtained λ=lgk.We solve according to the result of inverse solutionλ,k=kw=σwk0=1.344×1=103159≈100000, then λ=lgk=5. The curve of penalty function about the proportion of feasible solution [34] is shown in Figure 4. It can be seen that kz is a subtractive function, and k first decreases sharply with the increase of z and then decreases slowly so that the search focus quickly shifts from the search for feasible solutions to the search for good feasible solutions.Figure 4
Penalty function diagram.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 Figures5 and 6.Figure 5
Traditional genetic algorithm.Figure 6
Adaptive genetic algorithm.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 Table2.Table 2
Comparison of results.
NumberTube lengthImproved genetic algorithmSimple genetic algorithmPipe diameterCurrent speedPipe diameterCurrent speed1303.54000.833000.862419.53500.793000.823394.33000.743000.7444712500.622000.865258.33000.653000.656486.24000.853000.877528.95000.863000.928422.83000.622000.689422.87001.258000.9510426.73000.642000.7111222.32500.612000.6812222.33000.672000.7513394.32000.812000.8114482.77001.358001.2615500.64000.853000.9216644.94000.913001.0517470.93000.652000.6918465.76001.218001.1519275.27001.268001.0220308.37001.328001.2421429.88001.388001.3822163.38001.358001.35Annual conversion cost/Ten thousand yuan1082.451174.26


## 4.3. Algorithm of Cross Mutation Probability Change

Figures7 and 8 show the changes of crossover probability and mutation probability in the first 50 iterations.Figure 7
Variation of crossover probability.Figure 8
Variation of mutation probability.When the genetic algebra increases, the individual expectationEX will become larger, and the variance DX 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.



---

*Source: 8252086-2022-03-20.xml*