Optimization of the Water Distribution Networks with Differential Evolution ( DE ) and Mixed Integer Linear Programming ( MILP )

Nowadays, due to increasing population and water shortage and competition for its consumption, especially in the agriculture, which is the largest consumer of water, proper and suitable utilization and optimal use of water resources is essential. One of the important parameters in agriculture field is water distribution network. In this research, differential evolution algorithm (DE) was used to optimize Ismail Abad water supply network. This network is pressurized network and includes 19 pipes and 18 nodes. Optimization of the network has been evaluated by developing an optimization model based on DE algorithm in MATLAB and the dynamic connection with EPANET software for network hydraulic calculation. The developing model was run for the scale factor (F), the crossover constant (Cr), initial population (N) and the number of generations (G) and was identified best adeptness for DE algorithm is 0.6, 0.5, 100 and 200 for F and Cr, N and G, respectively. The optimal solution was compared with the classical empirical method and results showed that Implementation cost of the network by DE algorithm 10.66% lower than the classical empirical method.


Introduction
Nowadays, due to increasing population and water shortage and competition for its consumption, proper and suitable utilization and optimal use of water resources is essential.Distribution networks are an essential part of all water supply systems.A water distribution network is a system containing pipes, reservoirs, pumps, and valves of different types, which are connected to each other to provide water to consumers.The water distribution system is one of the major requirements in urban and regional economic development.For any agency dealing with the design of the water distribution network, an economic design will be an objective.Attempts should be made to reduce the cost and energy consumption of the distribution system through optimization in analysis and design.A water distribution network that includes booster pumps mounted in the pipes, pressure reducing valves, and check-valves can be analyzed by several common methods such as Hardy-Cross, linear theory, and Newton-Raphson (Stephenson,[1]).
Traditionally, pipe diameters are chosen according to the average economical velocities (Hardy-Cross method) (Cross, [2]).This procedure is cumbersome, uneconomical, and requires trials, seldom leading to an economical and technical optimum.
In the case of the design of a pipe network the optimization problem can be stated as follows: minimize the cost of the network components subject to the satisfactory performance of the water distribution system (mainly, the satisfaction of the allowable pressures).
Numerous optimization techniques are used in water distribution systems.These include the deterministic optimization techniques such as linear programming (for separable objective functions and linear constraints), and non-linear programming (when the objective function and the constraints are not all in the linear form), and the stochastic optimization techniques such as genetic algorithms, simulated annealing, Deferential Algorithm, Particle Swarm Optimization and etc.
Mays and Tung [13] recommended strongly the use of the linear programming (LP) technique in designing the pipe networks due to the capability of the LP in handling more decision variables than other optimization techniques.Dandy and Hassanli [14] developed a nonlinear model for optimum design and operation of multiple subunit drip irrigation systems on flat terrains.
Mansouri et al. [29] by using differential evolution algorithm (DE), CU equation (water distribution uniformity coefficient in zb sprinkler irrigation) was optimized and the best optimized coefficients obtained.
Shahinezhad et al. [30] presented a mixed integer linear programming (MILP) model for optimization of pressurized branched irrigation networks.Detailed analysis of the results is reported and compared with those generated based on trial-and-error method.The proposed method results in a reduction of 12.5% in costs.
In this paper, DE algorithm is developed to obtain the optimum pipe size and inlet pressure head that produce the least cost design of Shahinezhad et al. [30] networks.In this study, the hydraulic analysis of the network is based on continuity at nodes and Hazen-Williams formula for head loss calculations by using link between Epanet and Matlab Software.The results of this investigation compared with absolute optimization are obtained by mixed integer linear programming (MILP) model that is presented by Shahinezhad et al. [30].

Case Study
The Ismail Abad irrigation network is located in 7 kilometers North West of Noorabad city in Lorestan province.Land area of this project is 1000 ha. Figure 1 depicts the schematic network of Ismael Abad.This network consists of 18 pipes and 19 nodes are.In Table 1, the hydraulic details and arrangement of pipes for water distribution networks Ismael Abad is presented.
This project consists of two kinds of steel pipe that is used.Polyethylene pipe material is used for pipe sizes equal or less than 500 mm and GRP for greater sizes.Pipe specifications are given in Table 2.

Pressure Constraint
Minimum Allowable pressure head required for each node is considered to be 50 m.

Velocity Constraint
In order to prevent sediment deposition in low flow velocities and avoid water hammer at high velocities, minimum and maximum allowable flow velocities in pipes are considered to be 0.7 m/s and 2 m/s, respectively.

Differential Evolution Algorithm (DE)
Differential Evolution (DE) algorithm is a branch of evolutionary programming developed by Rainer Storn and Kenneth Price [31] [32] for optimization problems over continuous domains.In DE, each variable's value is represented by a real number.The advantages of DE are its simple structure, ease of use, speed and robustness.DE is one of the best genetic type algorithms for solving problems with the real valued variables.Differential Evolution is a design tool of great utility that is immediately accessible for practical applications.DE has been used in several science and engineering applications to discover effective solutions to nearly intractable problems without appealing to expert knowledge or complex design algorithms.Differential Evolution uses mutation as a search mechanism and selection to direct the search toward the prospective regions in the feasible region.Genetic Algorithms generate a sequence of populations by using selection mechanisms.Genetic Algorithms use crossover and mutation as search mechanisms.The principal difference between Genetic Algorithms and Differential Evolution is that Genetic Algorithms rely on crossover, a mechanism of probabilistic and useful exchange of information among solutions to locate better solutions, while evolutionary strategies use mutation as the primary search mechanism.
Differential Evolution (DE) is a parallel direct search method which utilizes NP D-dimensional parameter vectors.
, , 1, 2, , As a population for each generation G. NP does not change during the minimization process.The initial vector population is chosen randomly and should cover the entire parameter space.As a rule, we will assume a uniform probability distribution for all random decisions unless otherwise stated.In case a preliminary solution is available, the initial population might be generated by adding normally distributed random deviations to the nominal solution x nom,0 .DE generates new parameter vectors by adding the weighted difference between two population vectors to a third vector.Let this operation be called mutation.The mutated vector's parameters are then mixed with the parameters of another predetermined vector, the target vector, to yield the so-called trial vector.Parameter mixing is often referred to as "crossover" in the ES-community and will be explained later in more detail.If the trial vector yields a lower cost function value than the target vector, the trial vector replaces the target vector in the following generation.This last operation is called selection.Each population vector has to serve once as the target vector so that NP competitions take place in one generation.More specifically DE's basic strategy can be described as follows: , a mutant vector is generated according to: With random indexes r1, r2, r3 ∈ {1, 2, ⋅⋅⋅, NP} integer, mutually different and F > 0. The randomly chosen integers r1, r2 and r3 are also chosen to be different from the running index i, so that NP must be greater or equal to four to allow for this condition.F is a real and constant factor ∈ [0, 2] which controls the amplification of the differential variation (x r2,G − x r3,G ). Figure 2 shows a two-dimensional example that illustrates the different vectors which play a part in the generation of V i,G+1 .

Crossover
In order to increase the diversity of the perturbed parameter vectors, crossover is introduced.To this end, the trial vector: Is formed, where: In Equation ( 5), randb(j) is the jth evaluation of a uniform random number generator with outcome ∈ [0; 1].CR is the crossover constant ∈[0; 1] which has to be determined by the user.rnbr(i) is a randomly chosen index ∈ 1, 2, …, D which ensures that u i,G+1 gets at least one parameter from V i,G+1 .

Selection
To decide whether or not it should become a member of generation G + 1, the trial vector u i,G+1 is compared to the target vector x i,G using the greedy criterion.If vector u i,G+1 yields a smaller cost function value than x i,G , then x i,G+1 is set to u i,G+1 ; otherwise, the old value x i,G is retained.Finally, this process continues to reach new generations to the number of NP.Then the same process is repeated to reach termination condition.
Figure 3 schematically overview of differential evolution algorithm for numerical model, the entire above process is specified numerically in this figure.

Mixed Integer Linear Programming (MILP)
In general, an optimization problem either linear or nonlinear consists of an objective function which is subjected to some constraints.The classical linear optimization method may results in a branch which consists of many pipe sizes.In practice, this is considered as a strong weak point.On the other hand, linear optimization methods yields pipe sizes which are not commercially available.This leads to choose the pipe size close to that obtained by optimization.Consequently, the hydraulic conditions and cost of the network system will be different from that obtained by the optimization technique which means that the design is not optimum any more.The developed model guarantees obtaining the global optimum of pressurized branched irrigation networks.

Objective Function
The total annual cost of a pressurized branched irrigation network system can be introduced as: where, L N = length of pipe number N, N = subscript representing pipe number in the network, CP N = unit length cost of pipe N, which is a function of pipe diameter, NP = Number of pipes, CPU I = cost of the Ith pump which is a function of the total power of the pump required, NPU = Number of pumps in the network system, C en = annual energy cost per unit head, The annual energy cost per unit head of the pump can be expressed as: In which, C fu is the fuel cost ($/kWh); O t is the number of annual system operating in hours; EAE is the equivalent annualized escalating energy cost factor; η e is the overall pump efficiency in fraction.
( ) ( ) ( ) ( ) ( ) In which, e is the decimal equivalent annual rate of energy escalation; y is the life time of the design in years, and r is the decimal equivalent annual interest rate.HPI = total dynamic head of the Ith pump, CRF = capital return factor which is calculated as below: where, P I = total power of the Ith pump and K = pump station cost per unit total power ($/KW).
Multiplying the terms of the first summation of equation ( 1) by zero-unity variables such as X NJ , and adding for all commercially available pipes yields: ND = number of commercially available pipe Diameter, Shahinezhad et al. [30] to ensure of performance the model, MILP model was used for four different branch network.This study showed that MILP method, with the above objective function is the ability to provide absolute optimum for branch network.
According the literature review in the differential evolution algorithm (Suribabu, [33]) and other evolutionary algorithms, to find the best conditions for optimizing water distribution network, at first considering an initial population of 100 member (N = 100) and generation of 500 (G = 500) to find the coefficients of F and CR, 18 different combinations of these factors was examined.It should be mentioned, at study each of the condition in this algorithm, three runs were conducted and the optimal run was chosen for that.
In general, in this study, in total 120 runs with different conditions of the algorithm was implemented, in order to derive the optimal of water distribution networks by using differential evolution algorithm.

F and CR Factor
In the first step, to obtain the best conditions for algorithm that provide the most optimum and do not face local optimum problem, 18 combinations of different modes for the coefficients F and CR were examined.The results are shown in Table 3.The Results show that median values for the coefficients of F and Cr provide the optimum situation and cause DE algorithm not to be trapped in local optimum.The most optimal answers for coefficients are 0.6 and 0.5 for F and Cr coefficients, respectively.These values matched with the results of Suribabu [33].
Scale factor (F) can increase the accuracy of the search.The smaller coefficient, the shorter steps needs to be taken for an accurate research.But the problem is that the algorithm may be trapped in local optimum and it cannot be withdrawn.On the other hand, the higher value of F, the more area will be searched, but the best optimum situation may not be obtained.

Population and Generation
After finding the best combination of coefficients values F and CR, algorithms for solving the independent populations were examined.For this purpose, the population of 4, 25, 50, 100, 500 and 1000 members were studied in two generations (G = 50 and 100).Figure 3 shows these results.
Based on the DE algorithm, the initial population is very important to select the initial three members, when the population gets more, the selection of four initial members has more variety, which causes the algorithm to reach convergence.
According to Figure 4, it is clear that by increasing population, the optimal cost will be lower.In addition It is proved that the increasing population will extend the domain of the search; and more members are used for optimization.
Finally, the best combination of coefficients and population were used to examine the effect of generations' number, so ten generations (30,40,50,100,200,300,500,1000,2000, and 3000) were studied.The results are shown in Table 4.The increase in time per the number of population has almost a linear trend, which indicates the effect of population in the runtime algorithm.Hence specifying suitable population to obtain an optimal result is very important.
The runtime algorithm for 100 members of population and 50 generations is 935s and 100 generation is 1950s.According to the numbers, the running time of the algorithm to reach new member in each generation takes an average of 0.19s (Figure 5).
Results of Figure 6 indicate a fairly linear relationship between runtime and number of generations.
In general it can be said that the population and number of generations to run the algorithm, in order to optimize water distribution network is 100 and 200, respectively that requires nearly an hour to reach the optimal answer.
So it can be revealed that one of the advantages of this algorithm is the high speed runtime.Another advantage is rapid convergence of the algorithm, that takes 16 minutes (G = 50 and N = 100) to reach convergence.

Runtime (s)
) G ( Generation Due to the hydraulic conditions in the pipes, it can be seen from Table 6, each pipe is in standard conditions and velocity in each pipe is in permitted range.Table 7 shows pressure in each node in permitted range.So itcan be said in this optimized network the constraint of pressure and velocity is considered.

Comparison of Differential Evolution Algorithm Optimization and a Mixed
Integer Linear Programming and Classical Methods Shahinezhad et al. [30] optimize this network by using mixed integer linear programming method.In this paper the network is optimized by differential evolution algorithm (DE) and the results are compared with absolute optimum that is obtained from mixed integer linear programming (MILP) by Shahinezhad et al. [30].Table 8 shows the results of optimizing from differential evolution algorithm, MILP and classic method.In all optimization methods, the factor of time is important.MILP method to find absolute optimum needs more time than DE algorithm, that it's one of the disadvantages of this method.Although MILP Method achieves the absolute optimum, this method is not recommended in the engineering works that the time is important.The biggest problem in this method is that this method cannot be used in the loop network.
So you cannot use this method to networks that combine the loop and branched network.
Figure 7 shows Schematic comparison between optimum diameter of the DE algorithm and MILP method.On the other hand, MILP method is able to solve the tree network and gives absolute optimum, but is unable to solve loop and complex network (loop and branch).In this study, we compared the algorithm (DE) with this method, Therefore, According to great potential of DE, the algorithm can be used in the loop, branch and complex network.
In Table 9 optimal cost obtained by each method can be seen.According to Table 9, it can be said that algorithm presents very good results for optimizing water distribution network.So that Differential Evolution algorithm estimates cost, 1.57% more than the lowest cost (MILP Method).That according to less time that is required to run, DE algorithm is very efficient.While the classic method estimated cost 13.7 percent more than the lowest cost (MILP Method).

Conclusions
In this study, to optimize water distribution network by DE algorithm, the best scale and probability coefficients (F and Cr) are 0.6 and 0.5, respectively.About the initial population and the number of generations investigation revealed that the initial population of 100 members and generations 200 are the best, in terms of time and efficiency.
Conclusions show DE algorithm runtime is less than the MILP method that provides absolute optimum.While optimization of differential evolution algorithm (737,920$) is 1.57% more than the absolute optimum that determined by the MILP method.Also, DE algorithm estimates cost 10.66% less than classic method.
Another advantage of DE algorithm in comparison with MILP method is that DE algorithm can be used in the loop network and complex network.Whereas MILP Method is unable to solve loop and complex network (loop and branch).
About major networks with many pipes, using differential evolution algorithm is recommended compared with MILP method and other evolutionary algorithms, because of high-speed runtime and convergence to reach the optimum.

Figure 2 .
Figure 2.An example of a two-dimensional cost function showing its contour lines and the process for generating V i,G+1 .

Figure 3 .
Figure 3. Computational module for differential evolution algorithm.

Figure 4 .
Figure 4. Optimization cost in different populations.

Table 1 .
Main and sub main pipe line data of Ismail Abad Network.

Table 2 .
Pipe specifications data of Ismail Abad Network.

Table 3 .
Study F and CR.

Table 4 .
The effect of generation on optimization cost.

Table 4
indicates that the generation number 200 is suitable for optimizing water distribution networks.This results show that DE algorithm for optimizing water distribution networks in the generation of 200 gives acceptable results.

Table 9 .
Inlet pressure head and network cost by DE algorithm, Classic method and MILP method.