General methodology for using Epanet as an optimization element in evolutionary algorithms in a grid computing environment for water distribution network design

In this paper, an evolutionary algorithm, called EA-WDND, is developed to optimize water distribution network design for real instances. The evolutionary algorithm uses the Epanet Solver which, while not an optimizer, helps to evaluate the operational constraints of mass conservation, energy conservation, pressure in nodes (nodal heads) of the network, and velocities of water in network pipes. Epanet is used by the EA-WDND to evaluate whether the looped network is operating properly. Consequently, the EA-WDND obtains feasible configurations of network design. The best configuration, which has the lowest cost and best performance according to defined constraints, is obtained by the EA-WDND. This configuration can be practically implemented in real life. In this paper, a methodology for using Epanet Solver with a parallel evolutionary algorithm is presented. This is an Open Access article distributed under the terms of the Creative Commons Attribution Licence (CC BY 4.0), which permits copying, adaptation and redistribution, provided the original work is properly cited (http://creativecommons.org/licenses/by/4.0/). doi: 10.2166/ws.2016.101 s://iwaponline.com/ws/article-pdf/17/1/39/410961/ws017010039.pdf Erika Yesenia Avila-Melgar Marco Antonio Cruz-Chávez (corresponding author) Beatriz Martinez-Bahena CIICAp, Autonomous University of the State of Morelos, Av. Universidad 1001. Col. Chamilpa, C.P. 62209, Cuernavaca, Morelos, México E-mail: mcruz@uaem.mx


INTRODUCTION
Currently, water distribution networks are indispensable in society. One of the key issues in order to have a properly working water distribution network is the network design.
The network design is a very common problem which requires the correct selection of components. The correct network design helps guarantee proper network operation and, at the same time, the appropriate service for network users in order to satisfy their water needs.
Real-world instances of water distribution networks involve very large networks. Numerous attempts have been made to solve these networks and several different methods have been proposed by researchers, including heuristic methods. The water distribution network design (WDND) problem is a wellknown combinatorial optimization problem and is classified by complexity theory as an NP-hard problem. It has been widely studied by the scientific community for decades due to its practical applicability. The problem has been stated using different mathematical formulations. In addition, various solution techniques have been proposed in order to solve it.
The WDND problem has been classified, according to its characteristics and its mathematical model, into two approaches: the classical approach and modern approach (Cruz-Chávez et al. ).
In this work, the mathematical formulation which represents the WDND problem is defined by two models: the linear programming model and the constraint satisfaction Solutions for different sized instances can be found in limited computational time because the EA-WDND works in a grid computing environment, using parallel computing techniques. The grid computing environment is a set of computer clusters which are located in different geographic places but linked using Internet 2 technology.
The sections of the present article are organized as follows.
The following section explains the mathematical formulation for the WDND problem. The third section describes the methodology used to link Epanet to the EA-WDND, in order to work in a grid computing environment. The fourth section shows the experimental results. The final section asserts the conclusions of this work.

MATHEMATICAL FORMULATION FOR THE WDND PROBLEM
Basically, the WDND problem consists of finding the most efficient way to deliver water from sources to users, within given constraints.
Let P ¼ p 1 , p 2 , p 3 , . . . , p n f g be a set of n pipes in a network, and let   In order to create the static library and have it working as part of the evolutionary algorithm, it is necessary to follow these steps: (1) The source code written in C language (.c extension) must be compiled to obtain the object files (.o extension). For this work, the Epanet version downloaded including the object files into the folder src. This folder contained the Epanet source code and the corresponding object files for that source code. If object files were not available, they were generated by the programmer, or step 2 could not be carried out.
(2) The object files must be packed. If this is not the case, the path must be indicated explicitly.
(3) At this point, if steps 1 and 2 were carried out successfully, the static library will have been generated with the indicated name Epanetsl.a.
(4) Finally, the programmer must verify that the static library generated, Epanetsl.a, is placed in the same directory that contains the evolutionary algorithm to avoid configuring paths.

Including library toolkit.h in the evolutionary algorithm
The evolutionary algorithm, called EA-WDND, is a C language program. As with every program in C language, it includes some common libraries ( properties. Therefore, EA-WDND interacts constantly with Epanet Solver and can achieve the goal of finding the best possible solution for the WDND problem. Table 1 shows that the input file has an ID for the pipes.
If the programmer wants to know which pipes are connected to a specific node, the information should be obtained based on the pipes' connections. For example, for node 1, pipe 1 is connected while for node 2, pipes 1, 2, and 3 are connected, as seen in Figure 2.
The initial diameters defined in the Two-LoopedNetwork.inp instance (Table 1)     Lines 4-6 are used to assign diameters in the network, creating a network design with each configuration, as shown in Lines 9-22 are used to analyze all the nodes in the network to obtain the pressure at each node.
Line 11 retrieves the node-type code for a specific node.
It can be a network user or a reservoir.

Compiling the evolutionary algorithm with Epanet
At this point, the evolutionary algorithm has to be compiled to generate the EAA-WDND, with the next instruction: gcc-o3 EAA-WDND EA-WDND.c -lm Epanetsl.a. The command shows that the sequential evolutionary algorithm is compiled by using gcc. It is important to mention that the resulting application is ready to be executed in centralized environments. In this work, the parallel evolutionary algorithm is compiled by using an mpic or mpich compiler to run in grid environments. The EA-WDND is ready to be executed in grid environments when it has been previously compiled by using mpich -o3 EAA-WDND EA-WDND.c -lm Epanetsl.a.

Executing the evolutionary algorithm
The last step of the methodology proposed here for using Epanet with an evolutionary algorithm is the execution of the algorithm in a grid environment.
The EA-WDND runs in a distributed environment by using a cluster of computers located in different geographic places.
The general schema of the grid environment used in this work is presented in Figure 3.     Table 2 shows the configurations used by other researchers. A configuration is a set of diameters. A diameter is assigned to a specific pipe in the network; usually a different diameter is assigned for each pipe. A configuration is a solution for the WDND problem. The configurations in Table 2 are presented in inches (Abebe & Solomatine ). In Table 3, the same configurations are used in order to compare results. Table 3 shows the equivalent configurations of Table 2 in millimetres, which is the specific format Epanet needs for the input parameters. The EAA-WDND includes the Epanet Solver, so it also requires diameters expressed in millimetres as input parameters. Configuration number five, represented as 'Best Run' in Table 2 Table 5 indicate that the nodal heads obtained by the  The nodal heads results in the compared works was the same, because the configuration used as the input parameter is the same. The equations and the coefficients defined in the Epanet version impact the results.
The relative error is calculated by Equation (6) Table 7 shows a comparison using another configuration.
In this comparative table, satisfactory results are presented.
They show the appropriate performance of the EAA-WDND in a grid environment. All the nodal heads for the   Martínez ). The best solution found by EAA-WDND was €2,014,928, an improvement of 12.5% over the current best-known solution. Figure 6 shows the convergence of the EAA-WDND in 30 tests for the Balerma instance.

CONCLUSIONS
The EAA-WDND presented in this work has excellent performance in a grid environment. A methodology for using Epanet with an evolutionary algorithm in a grid environment is presented. Experiments were carried out in this work and the results were compared to previous work.
The results obtained in a grid environment are correct.
Most work related to WDND uses algorithms to solve the problem in centralized environments or clusters of computers. Algorithms to solve this problem in grid environments have not been explored. This paper shows how the evolutionary algorithm interacts with Epanet as a static library, working in a grid environment. This work is important because it explores the possibility of applying parallel computing techniques to solve real problems, like the WDND problem, in a grid environment.