Genetic algorithm for networks with dynamic mutation rate

A genetic algorithm based on hydraulic optimization is applied in the paper in order to achieve the lowest possible costs, the most appropriate pipe diameter, and the most favourable longitudinal slope values. A new algorithm for mutation operation, called the dynamic mutation rate method, is proposed as a means to reduce the number of trials for genetic algorithm parameters, especially for mutation rates, and to obtain an optimum value in the shortest possible time.


Introduction
Sewer and urban stormwater drainage systems that directly affect public health and safety rank among important fields of civil engineering [1].Building a new network is costly and also quite disturbing for the inhabitants.The complexity of the design, and operations to decrease the costs, have led to the use of various infrastructure-design optimization techniques.Urban stormwater and sewer systems consist of manholes and pipes connecting manholes designed as network.The design of stormwater and sewer systems can be investigated in two phases: deciding about the network system (the plan) and hydraulic design of pipes in the network [2][3][4][5][6][7], which includes calculating flows, velocities, pipe diameters, slopes and burying depths, and placing ancillary facilities.The main purpose of the infrastructure systems is to take the flow to the discharge point by means of pipes and ancillary facilities.This is achieved by engineering experience.However there are many restrictions on the system, and the adoption of different values for each choice results in generation of different costs.Therefore, the purpose of the system cannot only be to ensure the flow.The system design is expected to provide an appropriate solution at the lowest cost.This obviously requires the use of optimization techniques together with traditional methods.Many researchers have used various optimization methods for hydraulic optimization, including genetic algorithms.A genetic algorithm based on obtaining the lowest cost with several trials enables us to reach the necessary solution by finding a global optimum minimum or maximum value.Siriwardene and Perera, [8] studied the effect of parameters used in a genetic algorithm for hydraulic optimization.Afshar [9] and Pianese et al. [10] used a genetic algorithm aimed at hydraulic optimization.Brand and Ostfeld [11] focused on using a genetic algorithm for hydraulic optimization and sewage treatment optimization.Afshar [12] offered using the rebirthing technique because of difficulties in discrete coding of continuous parameters.Haghighi and Bakhshipour [13] used the "Adaptive Binary Genetic Algorithm" to avoid using penalty value for genetic algorithm in hydraulic optimization.Cimorelli et al. [14] used genetic algorithm for both network and hydraulic design.Ogidan and Giacomoni [15], Zimmer et al. [16], Afshar et al. [17], and Beraud et al. [18], also used genetic algorithm for optimization.Some researchers used only genetic algorithm, while other researchers used it in the scope of hybrid algorithms.Weng et al. [2], and Weng and Liaw [3], used the "Sewer System Optimization Model for Layout and Hydraulics GA/SSOM/LH" for both network and hydraulic design, which is a combined model with a genetic algorithm.The SSOM or the "0-1 Mixed Integer Programming" method, and "Bounded Implicit Enumeration (BIE)" method, are used for size and slope calculations.Weng et al. [2], Weng and Liaw [3], and Guo et al. [19], used "cellular automata" (CA), an optimization technique depending on organizing neighbourhood relationships, the results of which are used as input in genetic algorithm.Their objective was to decrease computing time by ensuring a high quality generation for genetic algorithm.Pan and Kao [20] developed a hybrid method for waste water network design in which they used the second degree programming, a mathematical method as an internal solver, while genetic algorithm was used as an external solver (QP-GA model).Rohani and Afshar [21] and Liang et al. [22] also used genetic algorithm along with other algorithms.
In this study, hydraulic optimization is performed using a genetic algorithm to achieve the lowest costs and to obtain the most appropriate pipe diameter and slope values.While doing so, different genetic algorithm parameters are tested and a new algorithm for mutation operation is proposed.

Hydraulic design of stormwater and sewage systems
The flow coming inside the pipe should first be calculated in the scope of hydraulic calculations.This flow is mainly based on the water used for sewage systems, and the rainfall for stormwater systems.Flow calculations are beyond the scope of this study, and it is accepted in the study that the flow is known at the beginning.Hydraulic calculations of stormwater and sewage systems are performed based on the open-channel hydraulic principles.First of all, the velocity calculation assuming the pipe is full is performed and then the full flow is calculated [23].The continuity equation is then expressed as follows: where Q D is the full flow, V D is the velocity of full flow, and A is the cross sectional area of the pipe.Several formulas are used in literature to calculate the velocity of full flow in pipes.Some of them are the formulas proposed by Manning, Kutter, Prandtl-Colebrook, Hazen-Williams, and Darcy-Weisbach.ASCE [24] recommends the use of the Darcy-Weisbach equation for open-channel resistance, while Liou [25] discourages the use of the Hazen-Williams equation.Even though, according to literature, most researchers prefer the Manning formula [11-14, 19-22, 26], all velocity formulas mentioned above are taken into consideration in this study.Thus the following formulas were used: Manning: Kutter: Prandtl-Colebrook: Genetic algorithm for networks with dynamic mutation rate Hazen-Williams: Darcy-Weisbach:

Optimization of hydraulic calculations
A computer program has been developed for hydraulic optimization based on genetic algorithm.Inputs to this program are the information about manholes and pipes between manholes, consisting of main characteristics of storm-sewer networks, such as elevation levels, lengths, flows and discharge points, pipe types, diameters allowed to be used on the project, allowable minimum and maximum slopes, minimum and maximum burying depths and flow rates for each diameter, data about manholes, quantities necessary for estimation, and also cost values for each issue in the project [29].Network optimization, or manhole distribution, are not the main point of this study.So the network design and manhole distribution have been taken from real projects.It is assumed that the pipe layout and flow rate are known.The goal is to choose dimension of pipes between manholes for individual burying depths.All characteristics of storm-sewer networks are not taken as constant, but are rather taken from the project itself.So the program can handle all values of real storm-sewer projects.In addition to topographic conditions required for the use of pumping stations, all kinds of other topographic conditions, such as steeper slopes or very flat terrain, are also taken into consideration.This provides the opportunity for the program to be applied to any real case studies without any restrictions and any assumptions specific to any project.The genetic algorithm is a searching an optimization technique depending on natural selection.Having performed cross and mutation operations on the population of N chromosomes, a new generation is obtained.The general diagram of genetic algorithm is shown in Figure 1.An optimal solution is investigated by comparing total cost of the system.Formulas listed below are used for calculating the construction cost of storm water and sewage projects: Total network cost = Total pipe cost + total manhole cost (12) + total burying cost where N is the total number of lines in the network, L i is the distance between neighbouring manholes, M pipe is the unit price per meter of a pipe, M manhole_to_depth is the unit price per a depth meter of a manhole, h avg_pipe_i is the average buried depth of each line, h avg_manhole_i is the average buried depth of each manhole, M burying is the unit price per a depth meter of burying.As can be seen from Equation 12, the total network cost covers only

Figure 1. General diagram of genetic algorithm
Tulin Cetin, Mehmet Ali Yurdusev the pipe, manhole and burying costs.The total cost of ancillary facilities that may be used in the system is not included in the calculated total cost as shown in [5,[30][31][32][33][34].In this paper, it was adopted that there are no ancillary facilities such as pumping stations, stormwater overflows, retarding basins, etc.If it these facilities were included, the related costs would be added to the total network cost.However, the aim in this paper is to find the optimum pipe diameter and the optimum slope as in [5,[30][31][32][33][34], without the effect of other facilities.Two main elements directly affecting the cost are the pipe diameter and the quantity of excavation that is defined as burying depth.The burying depth is defined by the slope of the pipe.For this reason, the pipe diameter (D) and the slope (S) are used as parameters for hydraulic optimization.D and S are generated randomly as binary values in the program with different lengths depending on allowable values used in the projects for each chromosome.Therefore, different accuracy was obtained for each parameter.The string-length of the binary value of pipe diameters (D) is determined with the total number of pipe diameters.For example, if allowable pipe diameters of the project involve 10 (D) different values such as 200, 300, 400, 600, 800, 1000, 1200, 1400, 1600 and 1800 mm., 4-bits are used for binary representation of diameters.The string-length of the binary value of slopes (S) is determined with the difference value of allowable minimum and maximum slope values of allowable diameters.For example, if 1/300 and 1/8 (1/S) for the pipe with a diameter of 200 mm and 1/3000 and 1/75 (1/S) for the pipe with a diameter of 1800 mm are the minimum and maximum allowable slope values, this means that 3000-8=2992 (S) different slope values could be in the project which tends to use 12-bits for binary representation of slopes.Binary values of diameters and slopes are decoded to real values as follows: (7) (8) where D min is the minimum diameter value of allowable pipe diameters, D max is the maximum diameter value of allowable pipe diameters, D random is the real number value of randomly generated diameter, D calc is the pipe diameter calculated from randomly generated diameter values, S min is the minimum allowable slope value of calculated diameter D calc , S max is the maximum allowable slope value of calculated diameter D calc , S random is the real number value of randomly generated slope, and S calc is the slope value calculated from randomly generated slope values.Random values of the pipe diameter and the slope are checked before calculations to eliminate values ending with improper solutions, and to reduce the calculation time known as adaptive strategy [13,20].For example, the pipe diameter of the downstream line cannot be less than the upstream lines at each manhole.Also the elevation levels of upstream manholes should be greater than the downstream manholes unless using pumping stations.However, it has been agreed that there is no need to use pumping station in this study.After having obtained random diameters and slope values, the velocity in each pipe is calculated with the velocity formula chosen between Manning, Kutter, Prandtl-Colebrook, Hazen-Williams or Darcy-Weisbach formulas.According to the formula chosen and the pipe type that will be used in the project, the necessary pipe coefficient is determined according to the allowable minimum and maximum velocity values (V min and V max ).The flow rate is compared with the allowed flow rate of the diameter used, while the calculated velocity value is compared with the allowable minimum and maximum velocity values.If the flow rate and maximum velocity criteria are not satisfied, calculation is repeated with the next diameter value.If minimum velocity criteria are not satisfied, the calculation is repeated with a greater slope value.Burying depths and crown elevation levels are calculated with the obtained diameter and slope values.Burying depths are compared with the allowable minimum and maximum depths and the slope of lines whose depth criteria are not satisfied are changed.Randomly generated values are replaced with the adapted diameter and slope values according to criteria requiring elimination of values ending with improper solutions.

Application of genetic algorithm
Having performed hydraulic calculation, genetic algorithm search is undertaken with initial population, as shown in Figure 1.Genetic algorithm parameters such as population size, comparison values for tournament selection algorithm, elitism rates, crossover methods, crossover rates, and mutation rates, are taken alternatively from selected values.Total cost of each chromosome is calculated with the formulas given below.There are several methods for selection of parents in a genetic algorithm.Some of them are the tournament selection, roulette wheel, linear ranking, and proportionate selection.Goldberg and Deb [35] state that no selection method is superior to others.Therefore, the tournament selection method is preferred in the program.Tournament selection is randomly picking a small subset of chromosomes, two or three as tournament number, from the mating pool and then making a "tournament".The "tournament" is generating a random value between 0 and 1 for each subset and comparing this random value with a special value as a tournament ratio.If the random value is less than the tournament ratio, the first chromosome is chosen as the selected parent.If the random value is greater than the tournament ratio, the second chromosome is chosen.The tournament repeats for every parent needed [36].

Genetic algorithm for networks with dynamic mutation rate
In the program, uniform, single-point and double-point algorithms [36] are used for crossover operations.The selected crossover algorithm is used for both diameter and slope chromosomes according to their own bit-length.Mutation operation is performed by considering the opposite of the binary number in the chromosome.In this study, the bit number that is to go through the mutation operation in the chromosome is defined randomly.That is applied differently for each diameter and slope values.During the genetic algorithm operation, mutation rate can be taken as constant [8,9,20,36,37] or variable, i.e. linearly increasing from a value [36,37] or linearly decreasing from a value [13,36,37].Choosing a constant mutation rate depends on trials as in choosing other genetic algorithm parameters.It takes too much time to find which mutation rate is the optimum one, while there are still many more trials to be performed for other genetic algorithm parameters.To reduce the number of trials especially for mutation rates and to obtain the optimum value in a shorter period of time, the dynamic mutation rate method is proposed in this study.A minimum and a maximum mutation rates are chosen as control mutation rates.When the program starts, a minimum mutation rate is accepted as the applicable mutation rate.At each generation calculations, the most proper cost value is compared with the previous proper cost value.If there is only 1 % or less of change in the cost value at adjacent 50 generations, the applicable mutation rate is increased by 1 %.If the cost value at any generation is changed by more than 1 %, the 50 generations control interval starts from the beginning and the applicable mutation rate is decreased by 1 %.The mutation rate can be increased till the maximum mutation rate value, while it can be decreased till the minimum mutation rate by the value of 1 % [29].All operations are repeated for the total generation number which is a program parameter.At the beginning of the study, the generation number is tried as 2000 and more.It has been observed that more than 1000 generations have no serious effect on the optimum value.Therefore, the generation number has been adopted as 1000 for all trials.

Case study
To test the program, the stormwater network taken from a real project is used in hydraulic optimization.The real project was prepared using an appropriate software.The software used does not have any optimization procedure.So the real project was designed based on engineering experience only, as mentioned in Guo et al. [38].The cost obtained in the real project is compared with the cost value result obtained using the hydraulic optimization program.The stormwater network used is 15,318 m long and it has 193 intersection points and 192 lines.A schematic view of the network is given in Figure 2. The flow values in lines are taken from the original project.Commercial pipe diameters and allowable minimum and maximum slope values are also taken from the original project and given in Table 1.The velocity formula used is Prandtl-Colebrook, and the minimum and maximum allowable velocity values (V min and V max ) are 0.50 m/s and 5 m/s, respectively.2. The genetic algorithm parameters are 60, 80, 100, 120 and 140 for population size, 1 %, 3 %, 5 % and 10 % for elitism rate, 0,5 and 0,75 for tournament rate, uniform, single-point and double-points algorithms for crossover operation, 30 %, 50 %, 70 % and 90 % for crossover rates, and 1 %, 2 %, 3 %, 5 %, 7 % and 10 % for mutation rates.Also, the dynamic mutation rate is taken into account as described earlier, with the minimum mutation rate of 1 % and the maximum mutation rate of 11 %, 1 % increase in mutation rate, 50 generations for 1 % or less change in the cost value.
To compare the results of the dynamic mutation rate value and other mutation rate values, the optimum mutation rate obtained from trials is not considered when taking the minimum and the maximum mutation rate values as 1 % and 11 %.

Table 2. Genetic algorithm parameters used for hydraulic optimization
After realisation of all trial combinations, it can be observed that the following represents an optimum solution for the project: population size of 100 (Figure 3), elitism rate value of 1 % (Figure 4), tournament rate of 0.5 (Figure 5), single-point algorithm as crossover method (Figure 6), crossover rate of 50 % (Figure 7), and mutation rate of 7 % (Figure 8).Genetic algorithm for networks with dynamic mutation rate

Results
The cost obtained by means of hydraulic optimization is 2.762.534,00EUR while the original project cost obtained without any optimization is 2.913.750,00EUR.This shows that approximately 5,5 % savings were realized by integrating the optimization procedure in hydraulic calculation.Trials on different genetic algorithms for the sample project have shown that values suitable for the project are: population size 100, elitism rate 1 %, tournament rate 75 %, single-point algorithm as crossover method, 50 % crossover rate, and 7 % mutation rate.Both results are very similar to each other.Even though the 7 % mutation rate results are slightly better compared to the dynamic mutation results, it is clear that more than one trial should be performed to obtain an optimum mutation rate.Therefore, it seems that the dynamic mutation rate is more effective.The quantitative values obtained by hydraulic optimization are compared with original values shown in Table 3.This table shows that diameter values are decreasing.The maximum diameter is f1800 with optimization, while it is f2000 without optimization (for 2 km).The difference column at the right of this table has been subsequently added to the table.The values with + show an increase in the use of this diameter, whereas the values with -show a decrease in the use of this diameter in hydraulic optimization.Almost 85,300 m 3 of excavation are specified in the original project, while 500 m 3 less figure in the optimization results.
According to the unit-cost values of this project, the optimization program relies on decreasing diameters to achieve an optimum solution.Consequently, smaller savings are made in excavation, as compared to savings in diameter.In addition, there is no difference in elevation levels at the discharge point, which means that the project is applicable.The dynamic mutation rate and the optimum mutation rate (7 %) are combined together as shown in Figure 9.The upper lines in the figure show that the mutation rate has increased by 1 %, while the lower lines show that the mutation rate has decreased at that point by 1 %.Even though the 7 % mutation rate is somewhat better compared to the dynamic mutation rate, it is obvious that more trials are needed to find the optimum mutation rate.As can be seen in Figure 9, the results are similar to each other.All mutation rate values of 1 %, 2 %, 3 %, 5 %, 7 % and 10 % have been tried (1 solution from 6 trials) to find the optimum mutation rate of 7 %.On the other hand, only one trial for mutation rate is sufficient to get the optimum solution by using the dynamic mutation rate.So it is obvious that it is more suitable to use the dynamic mutation rate method instead of trying different mutation rate values.

Conclusion
The best way to obtain an optimum cost of a sewage / storm water project is to use an optimization algorithm, instead of trying too many alternatives.In this study, an algorithm is created for optimization of the sewage / storm water hydraulic design using a genetic algorithm.The genetic algorithm, aimed at obtaining the best chromosome and passing its genes through to the next generation, is chosen as an optimization method for hydraulic design.Instead of using any of genetic algorithm tools for trying different algorithms, the flexibility has been increased by developing a new computer program.
All necessary characteristics of storm-sewer networks have been taken into consideration.These characteristics include elevation levels, lengths, flows and discharge points, pipe types, diameters allowed to be used in the project, allowable minimum and maximum slopes, minimum and maximum burying depths and flow rates for each diameter, data about manholes, quantities necessary for estimation, cost values for each issue in the project, and the flow velocity formula preferred by governmental offices.Therefore, the program developed in this respect can be used for all storm-sewer projects without requiring any change to the algorithm.Pipe diameters and slope values are main inputs to the algorithm developed for hydraulic optimization.These values are defined randomly.To reduce calculation time of the program, random values of the pipe diameter and the slope have been checked prior to calculations to eliminate values that would lead to improper solutions.The optimum pipe diameters and slope values have been obtained using cost formulas specifically adjusted to the project.The developed program has been implemented on a real project solved without optimization.Different methods and values have been tried for genetic algorithm parameters such as the population size, comparison values for the tournament selection algorithm, elitism rates, crossover methods, crossover rates, and mutation rates during optimization operations.The genetic algorithm parameters are 60, 80, 100, 120 and 140 for population sizes, 1 %, 3 %, 5 % and 10 % for elitism rate, 2 for tournament number, 0.5 and 0.75 for tournament rate, uniform, single-point and double-points algorithms for crossover operation, 30 %, 50 %, 70 % and 90 % for crossover rates, and 1 %, 2 %, 3 %, 5 %, 7 % and 10 % for mutation rates.To reduce the number of trials, especially for mutation rates, and to obtain an optimum mutation rate value in a shorter period of time, a new method called the "dynamic mutation rate method" is proposed in this study.The use of dynamic mutation rate is investigated in this study as compared to the constant mutation rate and linearly increasing or decreasing mutation rate, as used in other similar studies.
Minimum and maximum mutation rates have been selected as control mutation rates.During calculations related to each generation, the most proper cost value is compared with the previous proper cost value.If there is only 1 % or less change in the cost value at adjacent 50 generations, the mutation rate used is increased by 1 %.If the cost value at any generation is changed by more than 1 %, the 50 generations control interval starts from the beginning and the mutation rate is decreased by 1 %.After all, the most optimum genetic algorithm parameters have been chosen for the project: 100 as population size, 1 % as elitism rate value, 0.75 as tournament rate, single-point algorithm as crossover method, 50 % as crossover rate, and 7 % as mutation rate.Also, it can be seen from the results that the use of the dynamic mutation rate is effective for obtaining the most optimum genetic algorithm parameters and an optimum solution.
The results of this study show that the cost value obtained with the developed program is lower than the original cost value, which means the algorithm developed has been proven successful.One of the advantages of the developed algorithm is that it can be used for all project conditions, without any restrictions and assumptions specific to a project.As a result, the algorithm developed in this study has been found to be successful, and can therefore be applied to any case study.

)
Parameters used in the above formulas are: V D -Velocity at full flow [m/s] R -Hydraulic radius [m] D -Diameter [m] J -Slope A -Cross sectional area of the pipe [m 2 ] Q -Flow inside the pipe [m 3 /s] n -Manning roughness coefficient [s/m 1/3 ] m -Kutter roughness n -Kinematic viscosity [m 2 /s] k -Prandtl-Colebrook roughness coefficient [m] g -Gravitational acceleration [m 2 /s] C hw -Hazen-Williams friction coefficient e -Darcy-Weisbach roughness height [m].Diameters and flows are calculated with using one of these velocity formulas[28].

Figure 2 .
Figure 2. Network used for program testing Figures 3,4,5,6, 7 and 8   show the difference between various values of the genetic algorithm parameter.Taking into account the results from these figures, genetic algorithm parameters other than those mentioned at each figure are taken as optimum values obtained after trials.For example, while trying different values (60, 80, 100, 120 and 140) for population size (Figure3), optimum values are taken for other genetic algorithm parameters such as 1 % as elitism rate value, 0.75 as tournament rate, single-point algorithm as crossover method, 50 % as crossover rate, and 7 % as mutation rate.

Figure 9 .
Figure 9.Comparison of constant mutation rate and dynamic mutation rate

Table 1 . Pipe diameters and allowed slope values Diameter [mm] Minimum slope (1/) Maximum slope (1/)
The original cost value obtained without any optimization technique is 2.913.750,00EUR.Different values for each genetic algorithm parameter are tried in this study, as shown in Table