Professional Documents
Culture Documents
by
A. Murat KAHRAMAN
September, 2003
İZMİR
OPTIMAL DESIGN AND EXPANSION OF
WATER DISTRIBUTION SYSTEMS USING
GENETIC ALGORITHM
by
A. Murat KAHRAMAN
September, 2003
İZMİR
I
Supervisor
Approved by the
Graduate School of Natural and Applied Sciences
ACKNOWLEDGMENTS
My supervisor, Prof.Dr. Davut ÖZDAĞLAR for his guidance and support during
the course of this study
I would also like to special thank to my friend Mehmet Fatih YÜCE for his
computer programming support and his friendship.
Finally I would like to thank to my family for their patience, trust and endless
support during all my education life.
Environment Engineer
A. Murat KAHRAMAN
II
ABSTRACT
ÖZET
Genetik Algoritmaların yapısı oldukça basittir, Darvin’in “en iyiler hayatta kalır”
prensibine göre işlerler. Basit bir Genetik Algoritmada en iyiyi belirleyen bir
uygunluk fonksiyonu, seçme, çaprazlama ve mutasyon operatörleri bulunur. Genetik
Algoritmalar belirli bir populasyon topluluğu ile başlarlar (populasyonlar genelde ilk
defa rasgele oluşturulur), bir sonraki jenerasyon topluluktaki en iyi bireyler, seçme
havuzunda birbirleriyle çaprazlanmak için çeşitli seçme yöntemlerinden (rulet,
IV
turnuva gibi) biriyle seçilirler, daha sonra en iyi bireyler birbirleriyle eşleştirilerek
daha iyi bireyler oluşması sağlanır ve kuşaklar boyu sürekli en iyiye doğru gidilir.
Genetik Algoritmalar çözümün nerede sonuçlanacağını bilmezler, yakınsamanın
sağlandığı an çözüm olarak kabul edilir. Dolayısıyla genetik algoritmalar en iyi
çözümü vereceğini garanti etmezler, ancak optimum bir sonuç sağlarlar. Çözüm
uzayının trilyonlar olduğu bir kümede en iyi sonucu bulabilmek ayrı bir meseledir!
Hazırlanan program ile her bir boru için dizaynda kullanılabilecek boru çapları ve
fiyatlarını kullanarak, her düğüm noktası için ayrı ayrı verilebilen minimum ve
maksimum basınç ve her boru için ayrı ayrı verilebilen minimum ve maksimum hız
sınırları arasında optimize edilmiş bir şebeke sunabilmektedir. Optimizasyonda hız
ve basınç sınırlarının verilen tolerans sınırlarında aşılmasında verilen bir ceza puanı
ile şebeke toplam maliyeti artırılmakta, böylece hidrolik açıdan uygun bir şebeke
çözümüne ulaşılabilmektedir.
Literatürde yer alan birçok şebeke sistemi hazırlanan program ile hesaplanarak
test edilmiş ve literatürde yer alan çeşitli genetik algoritma ile çözüm yapan
programın sonuçlarına yakın sonuçlar elde edilmiştir. Genetik algoritma ile yapılan
optimizasyonlarda çözüm uzayı çok geniş olduğundan birbirine çok yakın çeşitli
çözümlere ulaşılabilmektedir. Bu nedenle programın tamamen aynı verilerle yeniden
çalıştırılmasıyla yeni bir çözüme daha ulaşılabilmektedir. Bu nedenle de en iyiye
karar verebilmek oldukça güçtür. Ancak bulunan bir çok çözümde mühendisçe iyi bir
yaklaşım olabilmektedir. Hazırlanan program su dağıtım şebekelerinin dizaynında,
mevcut bir şebekenin genişletilmesinde ve hatta rehabilitasyonunda bir mühendis
denetiminde optimizasyon amaçlı kullanılabilir.
V
CONTENTS
ACKNOWLEDGMENTS ........................................................................................ I
ABSTRACT ............................................................................................................ II
ÖZET .....................................................................................................................III
CONTENTS............................................................................................................V
LIST OF TABLES..................................................................................................IX
LIST OF FIGURES .................................................................................................X
CHAPTER ONE
INTRODUCTION
CHAPTER TWO
OPTIMIZATION TECHNIQUES
CHAPTER THREE
GENETIC ALGORITHM
CHAPTER FOUR
EPANET
CHAPTER FIVE
OPTIGA
CHAPTER SIX
SUGA
1. Introduction .....................................................................................................30
6.2. About SuGA .................................................................................................31
6.2.1 Installation ..................................................................................................31
6.2.2 Hardware Requirement ...............................................................................31
6.2.3 Software Requirement.................................................................................31
6.2.4. Program Menu ...........................................................................................32
6.2.5 Toolbox ......................................................................................................33
6.2.6 Design Manager ..........................................................................................34
6.2.7. Junctions ....................................................................................................39
6.2.8. Pipes ..........................................................................................................41
6.2.9. Optimization Options .................................................................................43
6.2.10. Genetic Algorithm Options ......................................................................44
6.2.11. Run Design ..............................................................................................47
6.2.12. Results .....................................................................................................49
6.2.13. Compare Results ......................................................................................51
6.3. Implementation of SuGA ..............................................................................54
VIII
CHAPTER SEVEN
CONCLUSION AND RECOMMENDATION
7.1. Conclusion....................................................................................................60
7.2. Recommendations.........................................................................................61
References ...........................................................................................................62
APPENDICES
LIST OF TABLES
LIST OF FIGURES
CHAPTER ONE
INTRODUCTION
1.1. Introduction
As a vital part of water supply systems, water distribution networks represent one
of the largest infrastructure assets of industrial society. The Water Infrastructure
Network (WIN) report Clean and Safe Water for the 21st Century (April 2000)
warns of huge funding shortfalls for replacement of drinking water infrastructure and
needed improvements to meet federal water regulations. The required capital
investment for drinking water systems alone is estimated to be $24 billion per year
for the next 20 years—this amount dwarfs the $13 billion per year that water systems
currently invest for infrastructure capital needs (The optimatics letter, 2001)
improvement plans (CIPs), main replacement plans, and more. Cost savings of 20%
or higher are not uncommon for both small and large distribution systems. (To apply
the optimization does require a hydraulic model of the system.)
Consider a simple network of 20 pipes, where each pipe could be one of ten
different diameters. Since search space is 1020, even one computer was capable of
evaluating one million scenarios in a second; it would need over three million years
in order to evaluate all of the enumerations. An expansion which considers changes
in pumps, valves, or other variables as well, would take considerably longer.
Evaluation of all possible solutions seems to be impossible even small network
systems. We need powerful optimization technique that can find optimal solution
among enormous search space. Next chapters, we will have answer about this
problem.
3
CHAPTER TWO
OPTIMIZATION TECHNIQUES
2.1. Introduction
A water distribution network can have pipes, hydraulic devices (pumps, pressure
reducing valves, etc.), storage tanks or reservoirs. It has to be built to satisfy
demands at given points (nodes) and satisfy pressure and velocity criteria. The funds
needed for the construction, maintenance, and operation of these systems should be
considered that a good compromise between technical aspects and economic aspects.
As such, a great deal of attention must be paid to their planning and management. So
we can say that optimization of water distribution means, minimize sum of the
capital costs plus the operating costs of the water distribution system while the
system satisfies design criteria
Quindry et al. (1981) also used a two-step methodology for the optimal design of
looped networks. This use in these two models of a two-step process in an
optimization framework represented a new stage in the development of the
optimization models for network design.
The next major step in the development of design models focused on ways of
incorporating multiple-load patterns into the design procedure. The approaches taken
to handle the multiple loads issue were again two-step procedures, a process
consistent with the complexity of the design problem noted earlier. One of the first
procedures was that of Rowell and Barnes (1982), who in their initial step developed
an optimal (least cost) branched system and then designed cross connections with
sufficient capacity to meet demands with any single broken link. Morgan and Goulter
(1985) proposed a two-step heuristic procedure based on a linear programming
approach to address the requirement for multiple-load cases, a procedure that
5
required an iterative interaction between two stages of the model and was able to
handle simultaneously as many load cases as there were links in the network.
Lansey and Mays (1989) reported on the development of two-step procedure for
the design of water distribution under multiple loading conditions. This work was an
advance over the models of Rowell and Barnes (1982) and Morgan and Goulter
(1985) in that it considered sizing and location of pumps, storage tanks, and valves as
well as pipes. The procedure was still computationally intensive, however, requiring
a large number of iterations between an optimization model and a simulation model,
with the gradient terms considered at each step (Geem, 2000).
CHAPTER THREE
GENETIC ALGORITHM
In the 1950s and the 1960s several computer scientists independently studied
evolutionary systems with the idea that evolution could be used as an optimization
tool for engineering problems (Mitchell, 1996). The first person who proposed
genetic algorithms (GAs) as computer programs that mimic the evolutionary process
in nature is John Holland, in early 1970s. Holland's book "Adaptation in Natural
and Artificial Systems" published in 1975. His genetic algorithm is commonly
called the Simple Genetic Algorithm or SGA, shown in figure 3.1
When David Goldberg present “Steady state and transient optimization of gas
pipeline using genetic algorithm, 1983” named thesis, GAs became more popular. In
7
1992 John Koza has used genetic algorithm to evolve programs to perform certain
tasks. He called his method "genetic programming" (GP).
Given a clearly defined problem to be solved and a bit string representation for
candidate solutions, a simple GA works as follows (Mitchell, 1996):
Chromosome 1 1101100100110110
Chromosome 2 1101111000011110
Each chromosome is represented by a binary string. Each bit in the string can
represent some characteristics of the solution. Another possibility is that the whole
string can represent a number.
Of course, there are many other ways of encoding. The encoding depends mainly
on the solved problem. For example, one can encode directly integer or real numbers;
sometimes it is useful to encode some permutations and so on.
3.3.2. Reproduction
3.3.3. Selection
Parents are selected according to their fitness. The better the chromosomes are,
the more chances to be selected they have. Imagine a roulette wheel where all the
chromosomes in the population are placed. The size of the section in the roulette
10
wheel is proportional to the value of the fitness function of every chromosome - the
bigger the value is, the larger the section is. See the following picture for an example.
A marble is thrown in the roulette wheel and the chromosome where it stops is
selected. Clearly, the chromosomes with bigger fitness value will be selected more
times.
3.3.4. Crossover
After we have decided what encoding we will use, we can proceed to crossover
operation. Crossover operates on selected genes from parent chromosomes and
creates new offspring. The simplest way how to do that is to choose randomly some
11
crossover point and copy everything before this point from the first parent and then
copy everything after the crossover point from the other parent.
There are other ways how to make crossover, for example we can choose more
crossover points. Crossover can be quite complicated and depends mainly on the
encoding of chromosomes. Specific crossover made for a specific problem can
improve performance of the genetic algorithm.
3.3.5. Mutation
The technique of mutation (as well as crossover) depends mainly on the encoding
of chromosomes. For example when we are encoding permutations, mutation could
be performed as an exchange of two genes.
3.3.6. Elitism
The idea of the elitism has been already introduced. When creating a new
population by crossover and mutation, we have a big chance, that we will loose the
best chromosome.
Elitism is the name of the method that first copies the best chromosome (or few
best chromosomes) to the new population. The rest of the population is constructed
in ways described above. Elitism can rapidly increase the performance of GA,
because it prevents a loss of the best found solution.
We select the mating pool of the next generation by spinning the weighted
roulette wheel four times. Actual simulation of this process using coin tosses has
resulted in string 1 and string 4 receiving one copy in the mating pool, string 2
receiving two copies, and string 3 receiving no copies as shown in table 3.5
Comparing this with the expected number of copies (n.pselecti) we have obtain what
we should expect: the best get more copies, the average stay even, and the worst die
off.
REPRODUCTION SELECTED
Sum 1754
Average 439
Max 729
With an active pool of strings looking for mates, simple crossover proceeds in
two steps: (1) strings are mated randomly, using coin tosses to pair off the happy
14
couples, and (2) mated string couples cross over, using coin tosses to select the
crossing sites. Referring again to table 3.5, random choice of mates has selected the
second string in the mating pool to be mated with the first. With a crossing site of 4,
the two strings 01101 and 11000 cross and yield two new strings 01100 and 11001.
The remaining two strings in the mating pool are crossed at site 2.
Machine learning
GAs have been used for many machine learning applications, including
classification and prediction tasks, such as the prediction of weather or protein
structure. GAs have also been used to evolve aspects of particular machine learning
systems, such as weights for neural networks, rules for learning classifier systems or
symbolic production systems, and sensors for robots.
Economics
GAs have been used to model processes of innovation, the development of
bidding strategies, and the emergence of economic markets.
Immune systems
GAs have been used to model various aspects of natural immune systems,
including somatic mutation during an individual's lifetime and the discovery of
multi-gene families during evolutionary time.
Ecology
GAs have been used to model ecological phenomena such as biological arms
races, host-parasite co evolution, symbiosis, and resource flow.
Population genetics
GAs have been used to study questions in population genetics, such as "Under
what conditions will a gene for recombination be evolutionarily viable?"
Social systems
GAs have been used to study evolutionary aspects of social systems, such as the
evolution of social behavior in insect colonies, and, more generally, the evolution of
cooperation and communication in multi-agent systems.
16
This list is by no means exhaustive, but it gives the flavor of the kinds of things
GAs have been used for, both in problem solving and in scientific contexts. Because
of their success in these and other areas, interest in GAs has been growing rapidly in
the last several years among researchers in many disciplines. The field of GAs has
become a sub discipline of computer science, with conferences, journals, and a
scientific society.
9. Compute a penalty cost for each network where design constraints are
violated.
10. Compute the fitness of each string based on the costs in steps 7 and 9; often
taken as the inverse of the total cost (network cost plus penalty cost).
11. Create a mating pool for the next generation using the selection operator that
is driven by the “survival of the fittest.”
12. Generate a new population of designs from the mating pool using the genetic
algorithm operators of crossover and mutation.
13. Record the lowest cost solutions from the new generation.
14. Repeat steps 6 to 13 to produce successive generations of populations of
designs stop if all members of the population are the same.
15. Select the lowest cost design and any other similarly low cost designs of
different configuration.
16. Check if any of the decision variables have been selected at the upper bound
of the possible choices in the lookup table. If so, expand the range of choices and re-
run of genetic algorithm.
17. Repeat steps 4 to 16 for say, ten different starting random number seeds.
18. Repeat steps 4 to 17 for successively larger and larger population sizes.
Some of the main steps in the genetic algorithm process are now described in
more detail.
A genetic algorithm coding scheme is required for each of the design variables
within the water distribution system to be selected as part of the design. Examples of
design variables that may need to be selected include:
CHAPTER FOUR
EPANET
This chapter is taken from EPANET2 user manual; more information can be
found there. EPANET is a computer program that performs extended period
simulation of hydraulic and water quality behavior within pressurized pipe networks.
A network consists of pipes, nodes (pipe junctions), pumps, valves and storage tanks
or reservoirs. EPANET tracks the flow of water in each pipe, the pressure at each
node, the height of water in each tank, and the concentration of a chemical species
throughout the network during a simulation period comprised of multiple time steps.
In addition to chemical species, water age and source tracing can also be simulated.
EPANET is designed to be a research tool for improving our understanding of the
movement and fate of drinking water constituents within distribution systems. It can
be used for many different kinds of applications in distribution systems analysis.
Sampling program design, hydraulic model calibration, chlorine residual analysis,
and consumer exposure assessment are some examples. EPANET can help assess
alternative management strategies for improving water quality throughout a system.
viewing the results in a variety of formats. These include color-coded network maps,
data tables, time series graphs, and contour plots.
4.4. Hydraulics
The method used in EPANET to solve the flow continuity and head loss
equations that characterize the hydraulic state of the pipe network at a given point in
time can be termed a hybrid node-loop approach. Todini and Pilatini (1987) and later
Salgado et al. (1988) chose to call it the "Gradient Method". Similar approaches have
been described by Hamam and Brameller (1971) (the "Hybrid Method) and by
Osiadacz (1987) (the "Newton Loop-Node Method"). The only difference between
23
these methods is the way in which link flows are updated after a new trial solution
for nodal heads has been found. Because Todini's approach is simpler, it was chosen
for use in EPANET.
hf = 4,72 C-1,85. q1,85. d-4,87. L
hf = 0,0252 f(ε,d,q). q2. d-5. L
hf = 4,66 n2. q2. d-5,33. L
24
CHAPTER FIVE
OPTIGA
5.1. Introduction
This chapter is taken from OptiGA user manual; more information can be found
at http://www.optiwater.com. OptiGA is an activeX controls for Windows
applications, which can be capable solve complex problems using genetic algorithm.
It has some useful properties, events, methods and functions to construct algorithm
structure. OptiGA present 3 coding scheme binary coding, real coding and integer
coding. Problem parameters (genes) and fitness function (the hearth of the GA) must
be defined selecting one of these coding schemes by the user
Once a suitable representation has been decided upon for the chromosomes, it is
necessary to create an initial population to serve as the starting point for the genetic
algorithm. This initial population is usually created randomly. From empirical
25
5.5. Selection
The first parent is selected by the fitness order. The second parent is selected
randomly.
5.5.3. Tournament
With this selection method, a small subset of chromosomes is selected and the
one with the best fitness will become a parent.
5.5.4. Random
After two parents have been selected by the selection method, crossover takes
place. Crossover is an operator that mates the two parents (chromosomes) to produce
two offspring’s. The two newborn chromosomes may be better then their parents and
the evolution process may continue. The crossover in carried out according to the
crossover probability.
Here are the crossover methods implemented by optiGA:
A random crossover point is selected. The first part of the first parents is hooked
up with the second part of the second parent to make the first offspring. The second
offspring is build from the first part of the second parent and the second part of the
first parent (the crossover point is noted by the | sign):
The two point’s crossover operator differs from the one point crossover in the
fact that two crossover points are selected randomly:
Parent #1: 011|101|0101
Parent #2: 100|111|0111
Offspring #1: 011|101|0111
Offspring #2: 100|111|0101
Implemented for binary genes only!
5.6.3. Uniform
In the uniform crossover each bit/gene is selected randomly, either from the first
parent or from the second one:
Parent #1: 0111010101
Parent #2: 1001110111
Offspring #1: 0111010111
Offspring #2: 1001110101
5.6.4. Blending
This crossover operator is a kind of linear combination of the two parents that
uses the following equations for each gene:
Offspring #1 = parent1 – b * (parent1 – parent2)
Offspring #2 = parent2 + b * (parent1 – parent2)
Were b is a random value between 0 and 1.
Implemented for real and integers genes only!
The user defined crossover method is the most powerful one. With this method
the user may code his own crossover operator, so the sky is the limit.
28
Mutation is the genetic operator that randomly changes one or more of the
chromosome’s gene. The purpose of the mutation operator is to prevent the genetic
population from converging to a local minimum and to introduce to the population
new possible solutions. The mutation is carried out according to the mutation
probability.
Here are the mutation methods implemented by optiGA:
5.7.2. Random
The random mutation operator exchange’s a random selected gene with a random
value within the range of the gene’s minimum value and the gene’s maximum value.
Implemented for real and integers genes only!
5.7.3. Min-max
The min-max mutation operator exchange’s a random selected gene with the
gene’s minimum value or with the gene’s maximum value, selected randomly.
Implemented for real and integers genes only!
The user defined mutation method is the most powerful one. With this method
the user may code his own mutation operator, so the sky is the limit.
29
The termination method determines when the genetic process will stop evolving.
Here are the termination methods implemented by optiGA:
The genetic process will end when the specified number of generation’s have
evolved.
The genetic process will end when a specified time has elapsed.
Note: if the maximum number of generation has been reached before the specified
time has elapsed, the process will end.
The genetic process will end if there is no change to the population’s best fitness
for a specified number of generations.
Note: if the maximum number of generation has been reached before the specified
number of generation with no changes has been reached, the process will end.
30
CHAPTER SIX
SuGA
6.1. Introduction
SuGA
OptiGA
Random Population
Have Yes
Terminati
Cost Has the
on criteria Generation
been met? Number
Reach Max Selection
Generation
No Crossover
No Mutation
Generation =
Cost = Cost + Yes Generation + 1
Penalty Cost
SOLUTION
Before run the program firstly water network data must be entered in EPANET2
and it must be run without any error. Export the network from EPANET2 must be
done as an INP file, so we have the data which is necessary to run the SuGA.
6.2.1. Installation
SuGA has setup file, so you can easily install it that way you used to windows
programs
Optimization
Options
GA
Options
6.2.5. Toolbox
Open
Open file that *.inp (EPANET input file) or *.sga (SuGA project file)
Save
Save file that *.sga (SuGA project file) before run optimization
Design Manager
Displays Design Manager Form
Junctions
Displays Junctions form
Pipes
Displays Pipes form
Optimization Options
Displays Optimization Options form
Run
Displays Run form
Results
Displays Results form
Compare Results
Displays Compare Results form
Turkish
Translate language to Turkish
English
Translate language to English
Design manager has 3 important column cost for unit pipe length, diameter,
roughness coefficient respectively. These components will be used for pipe design in
water distribution system. You may consider design manager a kind of pipe
catalogue.
How to create pipe’s cost considering distribution systems are shown next
35
Land Class : Soil : 40% , Sand : 30% , Soft Rock : 15% , Hard Rock : 10% , The Hardest Rock : 5% to be taken
Ditch excavation is done by 20% hand, 80% machine. Excavation and filling cost for 1m³ is found 7.763.744 TL
36
When you open INP file, you see design manager form empty
Design Manager has five components
· ID : An auto generated unique ID
· Description : Free text that described pipes properties
· Cost for unit length : Cost for 1m length pipe considering WDS
· Diameter : Pipe’s diameter
· Roughness Coefficient : Pipe’s roughness coefficient
To add a record, click the “Add Row” button. To remove a record, first select it
by clicking on its row and then click the “Delete Row” button.
39
To enter data or change data, select a record by clicking on its row. The record
ID will be shown on ID textbox, and then you can enter or change data. After data
entry/change click the “Update” button to update it.
You can export the records to a data file in order to use it in another project by
clicking the “Export” button. Click “Import” button to call the data.
6.2.7. Junctions
With the “junctions” you can specify which junctions in the system have pressure
constraints. Each junction in the system can have a minimum and maximum pressure
constraint.
The table in the figure shows a list of all junctions in the system and their
minimum and maximum pressures allowed. Initial pressure and head are shown on
the 4th and 5th column in the table. Minimum initial pressure value is displayed red
color and maximum initial pressure value is displayed green color which provides
easiness to define pressure constraints for large scaled water distribution systems (If
you consider that initial system is a good solution). So you can set pressure
constraints by clicking “update all minimum pressure” and “update all maximum
pressure” buttons for all junctions or click the row which you want to set pressure
constraints. When you select a row in the table, its value for min and max pressure is
shown on the right side of form. Enter min and max pressure value there. After,
check design box and click “Update” button. You will see the junction ID box color
turn to blue on the first column in the table. That means the selected junction ID will
be placed in design process. If you want some junctions not placed in design
process, select that junctions, unchecked the design box and click the update button
so their color turn to brown (see 24,25,26,27,28 ID).
6.2.8. Pipes
You must click design manager and enter some pipes and their cost to design
water distribution system before entering pipes menu. When you click pipes menu,
pipes from design manager menu will be placed with checkboxes on the bottom of
pipes form.
Initial velocity, initial diameter, length, initial flow, initial head loss are shown
on the 4th, 5th, 6th, 7th, 8th column respectively. Minimum initial velocity value is
displayed red color and maximum initial velocity value is displayed green color
which provides easiness to define velocity constraints for large scaled water
distribution systems (If you consider that initial system is a good solution). So you
42
can set velocity constraints by clicking “update all minimum velocity” and “update
all maximum velocity” buttons for all pipes or click the row which you want to set
velocity constraints. When you select a row in the table, its value for min and max
velocity is shown on the left side of form. Enter min and max velocity value there.
After, check design box, check some pipes that you want or click “select all options”
button and then click “Update” button. You will see the pipes ID box color turn to
blue on the first column in the table. That means the selected pipe ID will be placed
in design process. If you want to some pipes not placed in design process, select that
pipes, unchecked the design box and click the update button so their color turn to
brown (see 36,37,38,39 ID).
There are seven parameters that control the optimization process of SuGA. Select
the optimization options to edit the optimization parameters.
Penalties
The penalties are the most important parameters for the optimization process. We
use single objective function to implement genetic algorithm, so if the pressure and
velocity constraints are exceeded the program use these penalties
44
Pressure Penalty
The penalty coefficient is that for each unit of pressure exceeding. The default
penalty is 100,000.
Velocity Penalty
The penalty is that for each unit of velocity constraint exceeding. The default
penalty is 100,000.
EPANET Warning Penalty
A penalty so that is introduced when the EPANET reports a warning. You should
consider this penalty value about water network cost. The default penalty is 500,000.
Tolerances
Given pressure and velocity constraints can be very strict for some special points
in water distribution systems. Tolerances are useful for these points to not far away
from solution.
Pressure Tolerance
The tolerance is that for pressure (m) constraints. The default value is 1.
Velocity Tolerance
The tolerance is that for velocity constraints (m). The default value is 0,02.
Max tolerant pressure number at the network
Number of tolerant pressure is that allowed at the network. The default value is 3
Max tolerant velocity number at the network
Number of tolerant velocity is that allowed at the network. The default value is 3
Selection Type
There are five selection types that can be used in genetic algorithm process
Top mate
The first parent is selected by the fitness order. The second parent is selected
randomly.
Roulette rank/cost
With this selection method, the chance of a chromosome to be selected is
calculated according to their fitness (cost) or according to their rank.
Tournament
With this selection method, a small subset of chromosomes is selected and the
one with the best fitness will become a parent.
46
Random
This is the simplest method. Parents are simply selected randomly.
Crossover Type
There are three crossover types that can be used in genetic algorithm process
One point
A random crossover point is selected. The first part of the first parents is hooked
up with the second part of the second parent to make the first offspring. The second
offspring is build from the first part of the second parent and the second part of the
first parent
Two points
The two point’s crossover operator differs from the one point crossover in the
fact that two crossover points are selected randomly
Uniform
In the uniform crossover each bit/gene is selected randomly, either from the first
parent or from the second one
Population Size
The number of individuals in the genetic population. The default value is 30
Number of Generations
The maximum number of generation in the population is allowed to evolve. The
default value is 1500.
Number of Generations with no change
The maximum number of generation in the population is allowed to evolve with
no change in the best fitness (minimum cost). The default value is 50.
Mutation Probability
The default value is 0,03.
Crossover Probability
The default value is 0,95
47
Current Generation
The current genetic generation within the current genetic run
Current Best Fitness
The best fitness within the current genetic run. If the current best fitness is
feasible then background of the label will be painted green. If not, the background
will be painted red.
Best Feasible Solution
The best overall feasible solution reached.
While the design process is on, the progress bars on the bottom of the form show
its progress.
The run can be stopped by clicking the stop button.
6.2.12. Results
When finished run progress or when the program is stopped by you “Results” and
“Compare Results” button will be enabled. You can click them to see the results.
50
Pipes tab has five columns ID, Design Description, Cost, Min Velocity, and Max
Velocity respectively. Total water distribution network cost is shown at the end of
the table.
51
Junctions tab has three columns ID, Min Pressure, Max Pressure respectively.
To see the results in EPANET click “Save results to INP file” button.
52
This form compares pipe and junctions data to difference between initial solution
and found solution by SuGA. If the found diameter is same with the initial diameter
than the textbox backcolor will be yellow. If the found diameter is bigger than initial
diameter than the textbox backcolor, which belongs to SuGA, will be red, initial
diameter will be green. Last column compares costs between SuGA and initial. If the
53
SuGA costs higher than initial, the textbox backcolor will be red, if not it will be
green. If two of them are same than the textbox backcolor will be yellow.
Last column compares velocities between SuGA and initial. If the SuGA’s
velocity higher than initial, the textbox backcolor will be green, if not it will be red.
If two of them are same than the textbox backcolor will be yellow.
54
Last column compares pressures between SuGA and initial. If the SuGA’s
pressure higher than initial, the textbox backcolor will be green, if not it will be red.
If two of them are same than the textbox backcolor will be yellow.
can use Appendix A, which contains basic tutorial, to understand running SuGA. The
layout of WDS and WDS’s data such as pipes and junctions ID’s, pipes length and
junctions demand are given Appendices B. You can look Appendices C and D to
compare SuGA’s solution and final solution of this WDS. Solutions contain
diameters, velocities, pressures, flows, heads, and unit headloss. The search space of
this 77 piped WDS, because of nine different diameters, is 977. With assistance of
SuGA, we were able to obtain the following solution represent table 6.4. We run the
program with tournament selection type, two points crossover type, 40 population
sizes, 10.000 generations and 20 runs. Since the program does not make a telescopic
solution, diameters can be distributed unbalanced; some engineering approachment
must be made on the solution by modeler. To achieve this, not spending too much
effort (eliminate lots of trial and error steps), we can find a suitable solution a bit
higher (1314 Euro) than the found by SuGA. The solution data we found with some
engineering approachment is in table 6.4. with comparing results found by SuGA.
So, we see that SuGA is an effective program for finding lower cost solution; SuGA
almost nearly reached this solution at the one of these 20 runs.
DIAMETER COST
(MM) (UNITS)
((MM((MM)
80 6,21
100 8,20
125 10,72
150 14,00
200 21,98
250 32,51
300 44,99
400 78,13
500 120,22
56
Pipe Initial SuGA Initial SuGA Delta Initial SuGA Delta Node Initial SuGA Delta
ID Diameter Diameter Diameter Diameter Cost Velocities Velocities Velocities ID Pressures Pressures Pressures
Cost Cost
10 80 80 2.484 2.484 0 0,49 0,63 0,14 5 28,67 28,70 0,03
11 80 80 2.484 2.484 0 0,60 0,63 0,03 6 27,38 26,62 0,76
12 80 80 2.484 2.484 0 0,69 0,65 0,04 7 25,51 24,54 0,97
23 80 80 2.484 2.484 0 0,69 0,66 0,03 8 23,09 22,36 0,73
24 80 80 2.484 2.484 0 0,60 0,77 0,17 14 31,91 32,50 0,59
25 80 80 2.484 2.484 0 0,49 0,47 0,02 15 30,20 30,85 0,65
36 250 300 13.004 17.996 4992 1,95 1,38 0,57 16 27,72 26,77 0,95
37 250 200 13.004 8.792 -4212 1,24 1,59 0,35 17 25,81 24,72 1,09
38 200 200 8.792 8.792 0 1,54 1,22 0,32 18 23,15 22,54 0,61
39 200 150 8.792 5.600 -3192 1,24 1,42 0,18 24 33,77 34,32 0,55
54 100 100 2.050 2.050 0 1,09 0,97 0,12 25 31,01 32,71 1,70
55 80 80 1.552,5 1.552,5 0 0,77 0,76 0,01 26 28,29 28,87 0,58
57 100 100 2.050 2.050 0 1,09 1,01 0,08 27 25,81 26,08 0,27
58 80 80 1.552,5 1.552,5 0 0,77 0,80 0,03 28 23,30 23,70 0,40
60 150 150 3.500 3.500 0 0,84 1,16 0,32 34 36,51 36,51 0
61 150 100 3.500 2.050 -1450 0,73 0,88 0,15 35 32,07 34,63 2,56
62 80 80 1.552,5 1.552,5 0 0,69 0,83 0,14 36 30,15 30,71 0,56
63 150 150 3.500 3.500 0 0,84 1,25 0,41 37 26,45 28,30 1,85
64 150 80 3.500 1.552,5 -1947,5 0,73 0,85 0,12 38 23,97 23,82 0,15
65 80 80 1.552,5 1.552,5 0 0,69 0,67 0,02 44 33,77 34,13 0,36
57
Pipe Initial SuGA Initial SuGA Delta Initial SuGA Delta Node Initial SuGA Delta
ID Diameter Diameter Diameter Diameter Cost Velocities Velocities Velocities ID Pressures Pressures Pressures
Cost Cost
66 80 80 1.552,5 1.552,5 0 0,77 0,76 0,01 45 31,01 32,41 1,40
67 80 80 1.552,5 1.552,5 0 0,41 0,82 0,41 46 28,29 29,30 1,51
68 80 80 1.552,5 1.552,5 0 0,31 0,20 0,11 47 25,81 26,39 0,58
69 80 80 1.552,5 1.552,5 0 0,77 0,52 0,25 48 23,30 23,78 0,48
70 80 100 1.552,5 2.050 497,5 0,41 0,76 0,35 54 31,91 32,11 0,20
71 80 80 1.552,5 1.552,5 0 0,31 0,50 0,19 55 30,20 30,19 0,01
72 80 80 1.552,5 1.552,5 0 0,43 0,85 0,42 56 27,72 28,40 0,68
73 80 80 1.552,5 1.552,5 0 0,03 0,65 0,62 57 25,81 24,62 1,19
74 80 80 1.552,5 1.552,5 0 0,29 0,22 0,07 58 23,15 22,54 0,61
75 80 80 1.552,5 1.552,5 0 0,43 0,78 0,35 65 28,67 28,76 0,09
76 80 80 1.552,5 1.552,5 0 0,03 0,75 0,72 66 27,38 27,56 0,18
77 80 80 1.552,5 1.552,5 0 0,29 0,09 0,20 67 25,51 24,59 0,92
78 80 80 1.552,5 1.552,5 0 0,44 0,17 0,27 68 23,09 22,37 0,72
79 80 80 1.552,5 1.552,5 0 0,20 0,60 0,40 1 21,11 20,05 1,06
80 80 80 1.552,5 1.552,5 0 0,13 0,22 0,09 3 21,61 20,43 1,18
81 80 80 1.552,5 1.552,5 0 0,44 0,09 0,35 9 19,05 19,03 0,02
82 80 80 1.552,5 1.552,5 0 0,20 0,62 0,42 10 21,73 20,76 0,97
83 80 80 1.552,5 1.552,5 0 0,13 0,21 0,08 11 19,35 19,05 0,30
93 80 80 2.484 2.484 0 0,74 0,55 0,19 12 22,48 21,19 1,29
94 80 125 2.484 4.288 1804 0,73 1,17 0,44 13 20,53 19,06 1,47
95 80 125 2.484 4.288 1804 0,70 0,98 0,28 19 21,73 20,77 0,96
96 80 125 2.484 4.288 1804 0,70 0,90 0,20 20 19,35 19,05 0,30
102 80 80 2.484 2.484 0 0,74 0,57 0,17 21 21,61 20,44 1,17
58
Pipe Initial SuGA Initial SuGA Delta Initial SuGA Delta Node Initial SuGA Delta
ID Diameter Diameter Diameter Diameter Cost Velocities Velocities Velocities ID Pressures Pressures Pressures
Cost Cost
103 80 150 2.484 5.600 3116 0,73 1,06 0,33 22 19,05 19,03 0,02
104 80 125 2.484 4.288 1804 0,70 1,10 0,40 23 21,11 20,06 1,05
105 80 125 2.484 4.288 1804 0,70 0,95 0,25
111 80 80 2.484 2.484 0 0,57 0,56 0,01
112 125 80 4.288 2.484 -1804 0,92 0,91 0,01
113 125 100 4.288 3.280 -1008 0,80 0,72 0,08
114 100 100 3.280 3.280 0 0,83 0,75 0,08
120 80 80 2.484 2.484 0 0,57 0,61 0,04
121 125 80 4.288 2.484 -1804 0,92 0,58 0,34
122 125 80 4.288 2.484 -1804 0,80 0,87 0,07
123 100 100 3.280 3.280 0 0,83 0,73 0,10
1 300 300 224.950 224.950 0 1,67 1,67 0
2 80 80 2.484 2.484 0 0,62 0,67 0,05
4 100 100 3.280 3.280 0 0,62 0,73 0,11
5 80 100 2.484 3.280 796 0,71 0,59 0,12
6 80 100 2.484 3.280 796 0,55 0,88 0,33
7 80 100 2.484 3.280 796 0,68 0,66 0,02
8 200 150 8.792 5.600 -3192 0,94 1,07 0,13
13 150 125 5.600 4.288 -1312 0,91 0,85 0,06
14 80 100 2.484 3.280 796 0,55 0,89 0,34
15 80 100 2.484 3.280 796 0,68 0,66 0,02
16 100 100 3.280 3.280 0 0,62 0,73 0,11
17 80 100 2.484 3.280 796 0,71 0,59 0,12
59
Pipe Initial SuGA Initial SuGA Delta Initial SuGA Delta Node Initial SuGA Delta
ID Diameter Diameter Diameter Diameter Cost Velocities Velocities Velocities ID Pressures Pressures Pressures
Cost Cost
18 80 80 2.484 2.484 0 0,62 0,67 0,05
20 80 80 1.552,5 1.552,5 0 0,38 0,33 0,05
21 100 80 2.050 1.552,5 -497,5 0,20 0,30 0,10
22 100 80 2.050 1.552,5 -497,5 0,54 0,35 0,19
27 100 80 2.050 1.552,5 -497,5 0,54 0,34 0,20
28 100 80 2.050 1.552,5 -497,5 0,20 0,30 0,10
29 80 80 1.552,5 1.552,5 0 0,38 0,33 0,05
31 80 80 1.552,5 1.552,5 0 0,29 0,07 0,22
32 80 80 1.552,5 1.552,5 0 0,60 0,04 0,56
33 80 80 1.552,5 1.552,5 0 0,60 0,04 0,56
34 80 80 1.552,5 1.552,5 0 0,29 0,07 0,22
442.592 441.278 -1314
60
CHAPTER SEVEN
7.1. Conclusion
7.2. Recommendations
SuGA use single objective function, constraints take part inside fitness function
as a penalty. Constraints and pipes can be coded separately in multiobjective
function. Usage of multiobjective function on WDS should be considered.
Binary coding scheme has some disadvantage such as the hamming cliff effect
and redundant values. Real value or Gray coding scheme can be used instead of
binary coding
SuGA does not provide telescopic solution. Adding a function to SuGA can
provide telescopic solution, so it will be helped close to final solution.
SuGA has capable optimal design and expansion of WDS. Other usage of GA on
WDS such as pump scheduling, leakage reduction, water quality control etc. can be
added to SuGA with some developing coding scheme.
62
REFERENCES
24. Savic, D. A., and Walters, G. A. (1997). “Genetic algorithms for least-cost
design of water distribution networks.” J. Water Resour. Plng. and Mgmt.,
ASCE, 123(2), 67-77.
25. Schaake, J., and Lai, D. (1969). “Linear Programming and Dynamic
Programming –Application of Water Distribution Network Design.” Report
116, MIT Press, Cambridge, Mass., USA.
26. Simpson, A. R., Murphy, L. J., and Dandy G. C. (1993). “Pipe Network
Optimization using Genetic Algorithms.” Paper presented at ASCE, Water
Resources Planning and Management Specialty Conference, ASCE, Seattle,
USA.
27. Simpson, A. R., Dandy G. C., and Murphy, L. J. (1994). “Genetic algorithms
compared to other techniques for pipe optimization.” J. Water Resour. Plng.
and Mgmt., ASCE, 120(4), 423-443.
28. Simpson, A.R. (2000). "Optimization of design of water distribution systems
using genetic algorithms." Slovenian Society of Hydraulic Research, Seminar
Series, Vol.1, Ljubljana, Slovenia, 10pp.
29. The optimatics letter Issue No:12 (April-June, 2001) Advances in
Optimization for Water Distribution System Design & Operations
30. Walters, G. A., Savic, D. A., Morley, M., de Schaezten, W., and Atkinson, R.
(1998). “Calibration of water distribution network models using genetic
algorithms.”, paper presented at Hydrosoft '98, Italy.
31. http:\\www.optiwater.com
65
APPENDICES
APPENDIX A-TUTORIAL
The layout of the network with a single source at a 210 m fixed head and eight
pipes arranged two loops. The pipes are all 1000-m long with the assumed Hazen-
Williams coefficient of 130. The node data for this network are summarized in Table
1. The minimum acceptable pressure requirements for nodes 2 to 7 are defined as 30
m above ground level. There are 14 commercially available diameters and Table 2
presents the total cost per one meter of pipe length for different pipe sizes.
Diameters Unit
(inch) Cost
1 2
2 5
3 8
4 11
6 16
8 23
10 32
12 50
14 60
16 90
18 130
20 170
22 300
24 550
4. Click the “import” button and select the predefined file named “Tutorial.dat”
located in the tutorial directory:
69
12. Click “Update all pipes for design” button for all pipes to be designed
74