Optimization of a Real Urban Water Network (Langarud City’s Water Network) with the HBMO Algorithm

In developing countries, many of urban water networks are too old where most of them are not designed or expanded by engineering methods. Therefore, it is of high concerns to rebuild or relief them in a way that they can operate best. This will reduce the water loss and the costs of maintenance of the water network for a long time period. Use of evolutionary and meta-heuristic algorithms for optimization of water network is most popular nowadays. Methods such as Genetic Algorithm (GA) and Ant Colony Optimization (ACO) have been used frequently in the literatures. In this research, the new meta-heuristic evolutionary algorithm called Honey Bee Mating Optimization (HBMO) has been used so as to optimize the urban water network of a real town in north of Iran named Langarud. The purpose of this research was replacing adequate pipes for balancing the pressure level at the water network of Langarud city with the lowest cost. The result of optimization were compared with the present situation of network and showed a good effectiveness in the improvement of operational parameters.


Introduction
Water distribution network optimization problem is a non-convex, non-linear problem. Usually this problem is assumed single objective [1] and most of the time the objective function is the set of diameters for the pipes of the network which should be determined in a way that the total cost becomes the least. Sometimes, however, the problem is assumed as a multi-objective optimization problem [2]. The other parameters which can be used as objective functions of the problem are parameters such as water quality, reliability [3] and entropy [4].
In the late 1960s, first researches were done on the field of water networks optimization like the one solved the problem with generalized reduced gradient in combination with penalty methods [5]. Soon using of Genetic Algorithm (GA) became popular when it was first used for optimization of water networks and compared with the None Linear Programming (NLP) method and showed more effectiveness [6]. During these researches the necessity of pipes diameters getting single discrete for the solution to become more realistic was demonstrated [7].
By the beginning of the new century, new heuristic or evolutionary approaches like harmony search [8], Ant Colony Optimization (ACO) algorithm [9] and Shuffled Frog Leaping Algorithm (SFLA) [10] were used for optimization of water network's benchmarks like New York Tunnel and Hanoi problem. The last method was a metaheuristic method based on a local search similar to the particle swarm optimization and the leaping technique which allows the method to reach the global optimum. Another effective method for the problem is Tabu search algorithm [11].
In the end of the previous decade more new evolutionary or metaheuristic methods were used to the problem such Particle swarm optimization (PSO) algorithm [12] and Immune Algorithm (IA), which the last one's results was compared to the results of GA and fast messy GA in the literature and the conclusion showed that it gives the promising results with less number of evaluations [13].
Honey Bee Mating Optimization (HBMO) algorithm was first used for solving of the New York Tunnel (NYT) problem and compared with other previous methods [14]. The results obtained by this new meta-heuristic algorithm demonstrated that the HBMO algorithm gives the least cost in balance with the number of evaluations after the Harmony Search (HS) [8] and the Simulated Annealing (SA) methods [15,16]. Memetic algorithm is one of the newest methods used for the problem and compared five other methods named SA, mixed SA, tabu search, scatter search, GAs and binary linear integer programming [17]. It was shown that memetic algorithm gives the best results among these 6 methods. Recently HBMO algorithm was again used for two benchmark problems and compared the results with other methods in the literature and proved that HBMO gives the promising results in less number of evaluations [18].
Although many different methods were used to optimization of water distribution network and some of them showed good results, no one of these methods could demonstrate a total satisfactory result. Besides most of the methods were applied to the benchmark problems and just some of the methods were used to optimize a real network. Therefore, there still is a long way for using these methods for executive real problems.
In this research, the HBMO algorithm was used to optimize a model obtained from a real network in the north of Iran. The results of the optimized network compared to the real network before optimization where it showed that the operational parameters became better. For this purpose, a code has been written based on HBMO algorithm, changing the diameter of old network pipes. Epanet software has been used to simulate the new generated network hydraulically. If the hydraulic constraints were satisfied, the cost of replacing pipes calculates. According to the cost function each structure which satisfied the constraints and also has the least replacing cost is the better solution. This procedure continues until the optimal solution will converge.

HBMO algorithm
The HBMO algorithm is based on the mating process in honey bee colony. Naturally, in hives of honey bees the queen is the mother of all the hives. She does the mating flight in an appropriate time and with her some of the drones fly and tries to reach her in order to do the mating. During the mating flight, only some of drones will reach queen and put their sperms in her spermatheca [19]. Those drones that have more energy during the time of the flight can do this. The mating flight will end whether when the queen's spermatheca is full enough or when her energy is least. After the flight queen will go back to the hive and generates eggs. The queen will fertilize some of the eggs. The unfertilized eggs will result in drones, in contrast, the others can be whether broads or queen [20]. The eggs and larvae will be fed up by the broads. Some of them which are more appropriate in shape and size will be chosen by the broads for special treatments and food where these broods will be taken care of in order to replace the queen in the future. If one of these broods were deserved enough, it will defeat queen and become new queen of the colony.
In HBMO algorithm, queen is the best solution, however, in beginning it will be the first guess as well. The broads are ordinary heuristic functions in the literature of artificial intelligence such as the hill climbing strategy, which improve quality of the solutions by local search mechanisms. Drones will be then random trial solutions which their probability of mating with the queen will be achieved from the annealing function (eq. 1): In this equation P is probability of a successful mating; ( ) f ∆ is absolute difference of the fitness between chosen drone and queen and S(t) is known as the speed of queen at time t of flight. The reduction of the queen's speed and energy after moving into another state can be described by: Where E(t) is queen's energy; a is a coefficient between 0 and 1 which represent the reduction in speed, and g is energy reduction coefficient [20].
Broods are semi-optimal solutions which are obtained by increasing queen's genome by drones. However, sometimes genome of mother will be mutated. At the end, best solutions achieved will be compared to present queen and each of them has a better quality, it will become the new queen.
The algorithm has been summarized in these 5 stages in literature [19].
1-Queen starts the flight and appropriate drones will be chosen probabilistically to fill her spermatheca. Then, a drone will be selected randomly from the previous chosen drones for the generation of broods.
2-New broods will be generated after queen's genotypes were crossovered by drones' ones.
3-Broads will take care of broods in order to improve them. 4-Workers' fitness will be adapted after analyzing achieved improvements on broods.
5-Queen will be replaced by the best brood if it has better characteristics.
HBMO algorithm has been previously used for water network optimization and they concluded that results of this method on the NYT problem are among the best solutions in literature [14]. This algorithm again was applied to two more benchmarks simultaneously and their results emphasized on its ability to give the promising results with less number of evaluations [18].

Case study
City of Langarud is placed in west of Guilan state in north of Iran and it has a population of about 68000 people. The area of Langarud is about 900 km 2 which contain 42327 water consumers. Water network of Langarud is old and it has about 9800 nodes and 4700 pipes which all pipes can be categorized in 3 groups by their material. Oldest pipes of network are the asbestos ones with more than 35 years old, second group contains cast iron pipes with more than 20 years of age and eventually polyethylene ones which have rarely more than 15 years old are in the third group. The network is fed by two reservoirs each one with a capacity of 4000 m 3 one in the elevation of -9 m from level of sea with 3 pumps and other one with one pump in the elevation of -14 m. Two flow-meters are placed in the entrance of network where they show flow rate of 218 lit/s in sum. Main paths of network were obtained by only accepting the pipes with diameters more than 100 mm. Main nodes were achieved too and thus, general model of network were produced in Epanet software. This model has 84 pipes and 54 nodes including 2 reservoirs. Pumps and valves were equalized in their paths by pipes for simplicity. Figure 1 demonstrates general model in Epanet environment. Model was calibrated for pipes roughness and then was run so as to demonstrate the hydraulic situation of network before optimization. The results of hydraulic analysis are brought in next lines.
In Figure 2a contours of elevation has been shown while Figure 2b is the demonstration of contours of nodal demands and Figure 2c is the same type of diagram for pressure. Comparing these contours it can be concluded that Langarud's water distribution network has a serious problem in north part of town, such as low water pressure because of the high population density and high demand in this region. In fact, network can't provide water with adequate pressure for north part of city. Besides, pressure has not been distributed in network's nodes appropriately.

Optimization
The kind of optimization problem which were done on Langarud water network model in this research is a minimization of total cost of replacing special pipes sizes in order to reach the best hydraulic performance of network. Therefore, total reform cost was the objective function.
At used algorithm, a bee (solution or network pipes configuration) has a number of genes (equal to the number of network pipes) and queen is the best solution (best configuration of pipelines). The queen selects randomly some drones, and new brood (new configuration of network) created, by crossovering queen's own genome with drones' genomes. To improve the trial solution, a single mutation operator was used (as worker bees). At this time each improved trial solution (network configuration) solve hydraulically with Epanet software and where the constraints were satisfied, the objective function (cost) will be computed and compared with current queen. Where the performance of a new solution is better than the current queen, then the new solution will become new queen for next mating flight. These iterations continued until the solutions converged.
A constraint was introduced for pressure of nods. In fact the bottom limit for pressure at nodes was assumed 3 bars. The algorithm will find the new pipe configuration (with replacing some of the existent pipes with bigger diameter ones) with least replacing cost in way that, pressures of all nodes become more than 3 bars. Total cost of reform cost is dependent on the diameters of pipes. In this research only polyethylene pipes could be placed instead of other pipes, according to the policy of Langarud's water organization, and the new pipes could have diameters between 110 mm and 350 mm. Table 1 shows the total cost for each diameter including parameters like cost of workers and machineries.

Results and Discussions
HBMO algorithm was applied to optimize total cost of rebuilding Langarud water network and the algorithm was run 10 times where each run had 10000 iterations. Results of run number 5 were the best where least total cost was found 2057805 Rials (Iranian currency) with 2178524 evaluation functions. Figure 3 shows the convergence diagrams which indicate that results are reliable. Optimized network was then analyzed and its results were compared with those of network before optimization. Figure 4 is the diagram of pressure which demonstrates quality of pressure in nodes before and after optimization. It is obvious that pressures after optimization have been increased and balanced all  Figure 5b. Increase in pressures is more obvious in this contours compared to Figure 5a. In fact with a nearly 2060000 Rials cost the whole network can operate better and a balance in pressure will be achieved.

Conclusion
In this research a new previously used meta-heuristic algorithm named Honey Bee Mating Optimization algorithm was used to optimize the performance of a general model of a real urban water network placed in Langarud city in the north of Iran with 68000 population and 42327 water consumers with the least cost for changing pipes of network. The general model of network was created in Epanet software which links with the algorithm as a hydraulic solver. A limit was assumed for nodal pressures as a constraint which guaranties that all nodal pressures would be more than 3 bars. 10 runs were held where each run had 10000 iterations and as a result the 5 th run gave the least cost which was obtained 2060000 Rials with 2178524 evaluation functions.
Results of hydraulic analysis of network before and after optimization demonstrate that nodal pressures and velocity of water in pipes were increased. Besides, although unit losses in pipes were not decreased due to increase of velocity and pressure, it was balanced all over network. In addition, the low pressure in north of city was corrected after optimization.