Genetic Algorithm For Optimization of Water Distribution Systems
Genetic Algorithm For Optimization of Water Distribution Systems
Abstract
A methodology based on genetic algorithm has been developed for lower cost design of new, and augmentation of existing water
distribution networks. The results have been compared with those of non-linear programming technique through application to
several case studies. The genetic algorithm results in a lower cost solution. Parameters governing the convergence of the solutions
in non-linear and genetic algorithms are also discussed. 1999 Elsevier Science Ltd. All rights reserved.
Software availability is well known that when diameters are assumed as the
Program title: GENE decision variables (DV), the constraints are implicit
Developers: Indrani Gupta, A. Gupta functions of the DV, the feasible region is non-convex,
and P. Khanna and the objective function is multimodal. Hence, con-
Contact address: National Environmental ventional optimization methods result in a local optimum
Engineering Research which is dependent on the starting point in the search
Institute, Nagpur-440020, process.
India The application of stochastic optimization techniques
Hardware: HP 9000/730 PA-RISC such as genetic algorithm (GA) and simulated annealing
Workstation under HP-UX to WDS optimization is of recent origin. Simpson et al.
8.07 multi-user operating (1994) have presented a methodology for finding the best
system cost alternative for pipe networks using a three operator
Source language: FORTRAN GA comprising reproduction, crossover and mutation.
An inherent problem in that the model is the large com-
putational time in comparison to the non-linear program-
ming techniques. Loganathan et al. (1995) proposed an
1. Introduction outer flow search inner optimization procedure to ident-
ify lower cost design solutions. In that approach each
Water distribution system (WDS) design belongs to a pipe network is subjected to an outer search scheme that
group of inherently intractable problems commonly selects alternative flow configurations in an attempt to
referred to as NP-hard (Templeman, 1982; Parker and find an optimal flow division among pipes. For each
Rardin, 1988). Essentially NP-hard means that a rigorous selected set of pipe flows a linear program is used to find
algorithm to find an optimum design using discrete the associated optimal pipe diameters and energy heads.
diameters is not a practical possibility. Several A new GA based methodology for optimal
researchers have reported algorithms for minimising the design/augmentation of pipe networks is described in
cost through the application of mathematical techniques, this paper. The methodology was compared with a non-
such as linear, non-linear or dynamic programming. It linear programming (NLP) technique based on interior
penalty function (IPF) with the Davidon-Fletcher-Powell
(DFP) method. The NLP technique was first evaluated
* Corresponding author. by application to a case study which has been previously
1364-8152/99/$ - see front matter 1999 Elsevier Science Ltd. All rights reserved.
PII: S 1 3 6 4 - 8 1 5 2 ( 9 8 ) 0 0 0 8 9 - 9
438 I. Gupta et al. / Environmental Modelling & Software 14 (1999) 437–446
attempted by several researchers (Loganathan et al., meration, (ii) uses GRG2 to find optimum pipe sizes for
1995, 1990; Fujiwara et al., 1987; Quindry et al., 1979; the pump and tank layout specified in (i), and (iii) uses
Alperovits and Shamir, 1977). The optimal cost obtained a separate model to compute various measures of sys-
from the NLP technique was 0.57% higher than the sol- tem reliability.
ution achieved by Loganathan et al. (1995). The sol- Gupta et al. (1993) developed the software package
utions achieved by other researchers are 1.9–18.3% WATDIS based on IPF and DFP methods. In that
higher than the solution obtained by Loganathan et al. approach the problem was formulated as a cost minimiz-
(1995). ation problem wherein the objective function F(x) com-
Further, a comparison between the results of the GA prised the cost of power and annualised cost of pipes,
and NLP techniques for augmentation of several medium pumps, and reservoirs satisfying the hydraulic loop laws
size networks showed that the GA in general provided with constraints on minimum diameter and residual
a lower cost solution, than that obtained from the NLP head. The non-linear non-convex problem was converted
technique. The hydraulic simulator ANALIS (Bassin et to an unconstrained problem by appending the con-
al., 1992) which is based on graph theory, was used in straints to the objective function through penalty and
both the NLP and GA solutions to calculate pressure weighting factors using the IPF method. An independent
heads, flows and velocities in the design of branched, weighting factor was assigned to each constraint in order
looped and combined systems. to ensure the normalisation required by the significantly
different contributions of diameter, reservoir height, and
residual head constraints to the unconstrained objective
2. Deterministic optimization techniques function.
Recently, Loganathan et al. (1995) presented a design
A number of investigators have dealt with the problem heuristic for global cost minima design. That method
of optimization of WDS by applying mathematical pro- was used to solve a standard eight pipe problem, each
gramming techniques. pipe being 1000 m long with a Hazen Williams coef-
Several researchers employed linear programming to ficient of 130. The pipe sizes and associated costs used
optimise a WDS. Principal approaches include those of in the study are presented in Table 1. By assuming a
Alperovits and Shamir (1977), Quindry et al. (1981) and minimum diameter of 1 inch and minimum flow con-
Kessler and Shamir (1989). The technique given by Alp- straint of 1 m3/hour the method identified a design for
erovits and Shamir (1977) requires that a set of variables the network costing US $405 301.
(pipe flows) be set to particular values before the linear The same problem with the same minimum diameter
programme can be formulated. Information available and flow constraints was solved by the authors
from the solution of linear programming problem can be employing WATDIS. Since the single cost equation was
used to calculate a gradient which is then used to change of exponential form and did not show a good fit (the
pipe flows. Quindry et al. (1981) have decomposed the coefficient of determination ⫽ 0.932), a piecewise linear
looped network problem to branched systems. The limi- function was used to represent the cost. The optimal cost
tation of such simplified solution has been critically dis- obtained employing WATDIS is $407 625 which is the
cussed by Templeman (1982). Kessler and Shamir actual cost of the network finally calculated from cost
(1989) also use linear programming gradient procedure. of pipes per unit length. This is 0.57% higher than the
Several non-linear programming packages have been one reported by Loganathan et al. (1995). The details of
developed for network design problems. These packages the pipe cost and solution are presented in Fig. 1, and
include GRG2 (Lasdon and Waren, 1983), MINOS Tables 1–4. The cost of the same network as determined
(Murtagh and Saunders, 1987), GINO (Liebman et al., in a number of other methods in previous studies is
1986), and GAMS (Brooke et al., 1988) which are all
based on the generalised reduced gradient method. Chi- Table 1
plunkar et al. (1986) presented an algorithm based on Pipe sizes and associated costs
interior penalty function (IPF) with the Davidon-
Fletcher-Powell (DFP) method. Lansey and Mays (1989) Diameter Unit cost Diameter Unit cost
used GRG2 to find the optimum design and to simulate (in.) (US$/m) (in.) (US$/m)
pumps, tanks and multiple loading cases. Lansey et al. 1 2 12 50
(1989) considered uncertainty in nodal demands, Hazen- 2 5 14 60
Williams coefficients and minimum nodal heads, and 3 8 16 90
developed a methodology for optimal design with 4 11 18 130
recourse to chance constrained optimization. Duan et al. 6 16 20 170
8 23 22 300
(1990) extended the work of Lansey and Mays (1989) 10 32 24 550
further and developed a model that (i) identifies the num-
bers and locations of pumps and tanks by implicit enu- Note: 1 in. ⫽ 25.4 mm
I. Gupta et al. / Environmental Modelling & Software 14 (1999) 437–446 439
Table 2 Table 3
Pipe details for optimal solution Nodal details
Pipe Node Length Diameter Flow Headloss Status Node no. Ground Residual Hydraulic Demand
No (m) (in) (lps) (m) level head grade (lps)
(m) (m)
From To
1 R 210.00 00.00 210.00 ⫺ 311.1111
1 1 2 1000.00 18 311.111 6.756 N 2 D 150.00 53.24 203.24 27.7778
2 2 3 210.72 12 102.215 1.305 N 3 D 160.00 30.06 190.06 27.7778
789.28 10 102.215 11.881 NS 4 D 155.00 43.57 198.57 33.3333
3 2 4 932.17 16 181.118 4.104 N 5 D 150.00 30.04 180.04 75.0000
67.83 14 181.118 0.572 NS 6 D 165.00 30.11 195.11 91.6667
4 4 5 57.55 2 0.277 0.039 N 7 D 160.00 30.09 190.09 55.5556
942.45 1 0.277 18.486 NS
5 4 6 836.22 16 147.508 2.517 N Legend: R, Reservoir location; D, Demand node
163.78 14 147.508 0.945 NS
6 6 7 989.13 10 55.841 4.860 N
10.87 8 55.841 0.158 NS judged to be fairly good in comparison to that of other
7 3 5 899.81 10 74.438 7.529 N
100.19 8 74.438 2.485 NS algorithms reported in the literature. The WATDIS was
8 7 5 535.81 2 0.286 0.381 N thus considered an adequate basis for evaluation of the
464.19 1 0.286 9.663 NS GA described in this paper.
Legend: N, New pipe; NS, New pipe in series with the previous pipe
3. Overview of genetic algorithms
$412 931 (Loganathan et al., 1990), $415 271 (Fujiwara
et al., 1987), $441 522 (Quindry et al., 1979), and GAs are nature based stochastic computational tech-
$479 525 (Alperovits and Shamir, 1977). These costs are niques. The major advantages of these algorithms are
1.9%, 2.5%, 8.9% and 18.3% higher respectively than their broad applicability, flexibility and their ability to
the cost of $405 301 achieved by Loganathan et al. find optimal or near optimal solutions with relatively
(1995). Accordingly, the performance of WATDIS was modest computational requirements. GAs, pioneered by
440 I. Gupta et al. / Environmental Modelling & Software 14 (1999) 437–446
(vii) If Counter 2 is less than MI, go to step (ii) to design larger systems by re-dimensioning the vari-
otherwise go to step 5. ables in the program.
5. Store the solutions in the set of new populations for
which the residual heads at the nodes are greater
than the desired residual head tolerance. This step 5. Comparison of GA and NLP-IPF based
helps reduce the number of hydraulic analyses techniques
required.
6. Evaluate cost of the solutions in the new population GA and NLP based techniques are powerful tools
and store the feasible solution having the mini- which have been effectively applied to water distribution
mum cost. system optimization problems. The effectiveness of the
7. Increment Counter 1. techniques with respect to convergence relies on the
8. If Counter 1 is more than MG go to step 15 adaptation of inherent features and properties of the dis-
9. If a solution does not satisfy the minimum residual tribution system in the problem formulation. Both the
head constraint, evaluate a penalty cost as the pro- techniques require few parameter adjustments through
duct of the penalty factor and head violated at the trial and error to obtain the best solution. The fitness
critical node. In the present study the penalty factor function is most crucial aspect of any GA. Other
has been taken between 0.9–1.0 million per meter important parameters include the size of the population
of head. of solutions, the strategy for the stratification of solution
10. Compute the total cost as the sum of network cost space in more than one set of diameters, tolerance level,
and penalty cost. mutation rate, and penalty factor. In the case of the NLP
11. Compute the fitness for each solution as f ⫽ with IPF, the parameters which control convergence rate
1/total cost. include the penalty parameter in the unconstrained
12. Perform crossover of solutions of the new popu- objective function and its subsequent values, and the step
lation taken two at a time based on their fitness length in the finite difference scheme. In this research,
values as described earlier to produce two offspring. following advantages and disadvantages of GAs and
13. Mutate each offspring based on the mutation rate. NLPs were observed:
14. The offspring constitute the new population. Go to
step 4.
15. Write the stored solution set for each generation and 5.1. Advantages of the GA over the NLP technique
write network details for the best solution.
GA deals with a population of solutions which are
The above algorithm is an improvement of the method- spread over the solution space. It simultaneously climbs
ology presented by Simpson et al. (1994) as evident in many peaks in parallel during the search so that the prob-
the following: ability of trapping into a local minimum is reduced con-
1. The set of solutions is stored in discrete pipe sizes siderably. In case of NLP technique, the solution is
and not in binary alphabet as is usual in a GA. The highly dependent on the initial solution and it converges
decoding required to calculate the fitness for each set always to a local minimum based on the initial solution.
of solutions is therefore avoided. The simple ideas of The GA uses discrete pipe diameters for generation
crossover and mutation are applied to the discrete of each solution set while in NLP technique, the diam-
pipe diameters directly. eters are generated as real numbers requiring further
2. The network is stratified into a number of groups of rounding to commercial sizes. The process often con-
pipe sizes for generation of the initial population of verts the solution away from optimum particularly for
solutions. This process helps in reducing the number large size networks even after rounding using pro-
of redundant solutions. fessional judgement.
3. The solutions which are within tolerable limits are The GA uses a more rational fitness function to select
placed in the set of new solutions there by reducing the members of the next generation while the NLP relies
the total number of hydraulic analyses. on derivatives of the unconstrained objective function.
4. The set of solutions are modified by velocity and
average head loss adjustments which helps in bring- 5.2. Advantages of the NLP over the GA technique
ing rationality to the solutions.
The maximum size of the distribution system that can NLP converges much faster particularly for medium
be designed using the software is 200 pipes, 175 nodes, and large size networks as compared to GA.
and 2 reservoirs. The software can handle a maximum It is possible to incorporate additional techniques in
population of 200 solutions and 30 generations. Incorpo- the NLP for example splitting of link in two sections
rating these limitations the size of the executable pro- with next lower and upper commercially available diam-
gram is 122.8 KB. The software can be easily modified eter sizes such that their combined hydraulic character-
442 I. Gupta et al. / Environmental Modelling & Software 14 (1999) 437–446
istics are the same as that of the non-commercial diam- of 20 m height at node no. 8. Constraints on minimum
eter. nodal pressure and pipe diameter are 12 and 0.08 m
respectively. The coefficients of roughness for old and
new pipes are 0.7 and 0.9 respectively in the modified
6. Case study Hazen-Williams equation (Jain et al., 1978). The terrain
is flat with little variation in relative elevation. The initial
In order to establish the efficacy of GA based algor- starting solution for the NLP algorithm is the best alter-
ithm in comparison with NLP technique several net- native out of five attempted solutions. Application of this
works were optimized employing both the techniques. optimization algorithm resulted in a solution in terms
Fig. 2 delineates network 1. This network consists of of continuous diameters which has been rounded off to
38 pipes (30 existing and 8 new) and 23 nodes including commercial diameters. The population size of the sol-
21 demand nodes. Water is supplied through a reservoir utions used for the GA based algorithm is 200. In the
present work subroutine ran2 from Numerical Recipes for the optimal solutions are presented in Tables 7 and
(1992) which is based on the method of L’Eeuyer (1988) 8. The CPU times for network 1 were 6 minutes 40
has been used for generation of random numbers. The seconds and 2 minutes and 10 seconds respectively for
pipe details of the best solutions obtained through GA GA and NLP based techniques. The least cost solution
and NLP techniques are presented in Tables 5 and 6. obtained with the GA and NLP techniques are Indian
Diameters of pipes to be placed in parallel to existing Rs. 2,301,330 (1US $ ⫽ 43.5 Indian Rs.) and
pipes and new pipe lines are given in column 5 while 2 485 690 respectively.
the flow and headloss in each pipe is given in columns Network 2 represents an alternate problem to network
6 and 7. Nodal details and comparison of the pipe cost 1 with same network structure having significantly dif-
Table 5
Pipe details of optimal solution for the case study network-1 employing GA
Pipe no. Node Length (m) Diameter (mm) Flow (lps) Headloss (m) Status
From To
Table 6
Pipe details of the optimal solution for the case study network-1 employing non-linear programming
Pipe no. Node Length (m) Diameter (mm) Flow (lps) Headloss (m) Status
From To
ferent demand pattern. The GA and NLP solutions optimized employing GA and NLP techniques. Table 9
resulted in Indian Rs. 2.99 million and 3.006 million summarizes the details of these networks and optimal
respectively. Networks 3 and 4 were optimized similarly costs. Out of these six sets of solutions except for the
while networks 5 and 6 are two other different networks case of network 3, all optimal costs obtained through
I. Gupta et al. / Environmental Modelling & Software 14 (1999) 437–446 445
Table 7
Nodal details of optimal solution for case study network-1 employing GA and NLP techniques
Node no. Gr. level (m) Peak demand (l/s) Residual head (m) Residual head (m)
employing GA employing NLP
Table 8
Comparison of cost of new pipe lines in GA and NLP based techniques for case study network-1
Pipe dia. (mm) Unit cost Length of pipe in m using Cost of pipe in Rs.
(Indian Rs./m)
GA NLP GA NLP
Table 9
Network details and comparison of optimal design costs employing GA and NLP techniques for various case studies
Network no. No. of pipes No. of Total pipe Total Coeff. of friction Optimal* cost (million)
node length (m) demand
(lps)
*Indian Rupees
Note: 1US$ ⫽ 43.5 Indian Rs.
446 I. Gupta et al. / Environmental Modelling & Software 14 (1999) 437–446
GA technique were found to be lower than those Bassin, J.K., Gupta, I., Gupta, A., 1992. Graph theoretic Approach to
obtained through NLP technique. the Analysis of Water Distribution System. J. Indian Water Works
Assoc. 24 (3), 269–276.
Brooke, A., Kendrick, D., Meeraus, A., 1988. GAMS: a user’s guide.
The Scientific Press, Redwood City, California, U.S.A.
7. Conclusions Chiplunkar, A.V., Mehndiratta, S.L., Khanna, P., 1986. Looped water
distribution system optimization for single loading. J. Envir. Engrg.
ASCE 112 (2), 264–279.
The paper presents the applicability of genetic algor- Duan, N., Mays, L.W., Lansey, K.E., 1990. Optimal reliability based
ithm in the design of water distribution systems. The design of pumping and distribution systems. J. Hydr. Engrg., ASCE
algorithm has been compared with a NLP technique with 116 (2), 249–268.
Fujiwara, O., Jenchaimahakoon, B., Edirisinghe, N.C.P., 1987. A
IPF method which was found to be fairly efficient in modified linear programming gradient method for optimal design
comparison to the techniques presented thus far in the of looped water distribution networks. Water Resour. Res. 23 (6),
literature. The solution set obtained from GA and NLP 977–982.
techniques for several medium size networks showed Gupta, I., Bassin, J.K., Gupta, A., Khanna, P., 1993. Optimization of
that GA provides a better solution in general, in compari- water distribution system. Environmental Software 8, 101–113.
Goldberg, D.E., 1989. Genetic Algorithms in Search, Optimization and
son with that obtained with the NLP technique. The dif- Machine Learning. Addison-Wesley, Reading, Mass.
ferences in costs, however, is marginal which shows Holland, J.H., 1975. Adaptation in Natural and Artificial Systems. Uni-
both the techniques are efficient. versity of Michigan Press, ANN Arbor.
The convergence of GA was considerably improved Jain, A.K., Mohan, D.M., Khanna, P., 1978. Modified Hazen Williams
by providing initial information on network stratifi- Formula. J. Envir. Engr. Div. ASCE 104 (EE1), 137–146.
Kessler, A., Shamir, U., 1989. Analysis of the linear programming
cation. Generation of initial feasible solution, as required gradient method for optimal design of water supply networks.
in NLP technique, is avoided in GA. Considerable Water Resour. Res. 25 (7), 1469–1480.
efforts are needed to generate separate initial solutions Lasdon, L.S., Waren, A., 1983. GRG2: a user’s guide. Department of
to try acceptable number of trials in NLP methodology General Business, University of General Business, University of
in order to ensure optimality particularly in case of larger Texas, Austin, Texas.
Lansey, K.E., Mays, L.W., 1989. Optimization model for water distri-
networks. Trials in GA are made by providing different bution system design. J. Hydr. Engrg., ASCE 115 (10), 1401–1418.
seeds which does not require elaborate computations in Lansey, K.Y., Duan, N., Mays, L.W., Tung, Y.K., 1989. Water distri-
generating a feasible solution. NLP technique also bution system under uncertainties. J. Water Resour. Plg. and Mgt.,
requires rounding of pipe diameters to the available com- ASCE 115 (5), 630–644.
mercial sizes while GA selects discrete diameters. For Liebman, J.S., Lasdon, L., Scrage, L., Waren, A., 1986. Modeling and
Optimization with GINO. The Scientific Press, Palo Alto, Califor-
identical problem dimensions of pipes (200), nodes (175) nia.
and reservoirs (2), the size of the executable programs Loganathan, G.V., Greene, J.J., Ahn, T.J., 1995. Design heuristic for
for GA and NLP techniques are 122.8 and 126.9 KB globally minimum cost water distribution systems. J. Water Resour.
respectively. Plg. and Mgt., ASCE 121 (2), 182–192.
Experience, however, indicates that both the tech- Loganathan, G.V., Sherali, H.D., Shah, M.P., 1990. A two phase net-
work design heuristic for the minimum cost water distribution sys-
niques warrant several trials to obtain the best solution. tems under a reliability constraint. Engrg. Optim. 15 (4), 311–336.
The GA requires the trials in order to try out different L’Eeuyer P., 1988. Communications of the ACM, vol 31, pp. 742-774
seeds as well as initial guess on network stratification Murtagh, B.A., Saunders, M.A., 1987. MINOS 5.1 User’s Guide. Sys-
while the NLP requires different initial solutions from tems Optimization Laboratory, Department of Operations Research,
which to begin the search for the optimum. Generation Stanford, California.
Numerical Recipes, 1992. Cambridge University Press, IInd ed.
of information on network stratification is significantly Parker R.D., Rardin R.L., 1988. Discrete optimizations, United King-
easier in comparison with generation of initial solutions. dom Edition published by Academic Press, Inc (London) Ltd.
As a result, GA provides a convenient technique in per- Quindry, G.E., Brill, E.D., Liebman, J.C., 1979. Comments on design
forming more trials in comparison with NLP technique of optimal water distribution systems by E. Alperovits and U.
in order to obtain cost effective design of water distri- Shamir. Water Resour. Res. 15 (6), 1651–1654.
Quindry, G.E., Brill, E.D., Liebman, J.C., 1981. Optimization of
bution systems. looped water distribution systems. J. Envir. Engrg. Div., ASCE 107
(4), 665–679.
Simpson, R.A., Dandy, G.C., Laurence, J.M., 1994. Genetic algorithms
compared to other techniques for pipe optimization. J. Water
References Resour. Plg. and Mgt., ASCE 120 (4), 423–443.
Templeman, A.B., 1982. Discussion of Optimization of Looped Water
Alperovits, A., Shamir, U., 1977. Design of optimal water distribution Distribution Systems, by G.E. Quindry, E.D. Brill, and J.C. Lieb-
systems. Water Resour. Res. 13 (6), 885–900. man, J. Envir. Engr. Div. ASCE, vol. 108, No. EE3, pp. 599–602.