**4. Application**

Usually, the design of a storm water network was solved by using the rational method. However, methods based on the concept of return period do not take into account economic issues. It might result in both overdesigned or underdesigned networks [20]. Cost-optimal design of hydraulic network is a complex problem for engineers. Meredith [6] applied dynamic programming to sewer studies including cost functions for pipes. Mays and Wenzel [21] also used dynamic programming to optimize the design of a gravity sewer network with known pipe flow direction. Recent studies try to solve the problem of designing sewage networks by heuristic algorithms [22,23]. Furthermore, costs associated with flooding are rarely considered. Defining flood damage functions are another challenge for storm water network design [24]. More recently, Guo *et al* [25] combined EPA SWMM with a cellular automata and genetic algorithm hybrid algorithm to design large sewer networks. In all previous studies, the inflows were considered constant. That is, the rainfall-runoff processes were not calculated. Furthermore, most of these studies considered a normal flow regime.

In this case study, the design of a simple sewage network is used as an example of application of the Toolkit. The dynamic wave approach is used for the hydraulic simulation. The network used for this application consists of 6 pipes, 6 manholes and an outfall. Node and pipe data are shown in Figure 7.

**Figure 7.** Sample network used as a case study.

Since the depth of the sewers should allow water flows by gravity, the design includes not only the dimensioning of the pipes, but also the depth at which these pipes must be installed. Hence, both the conduit diameters and their slopes must be calculated. It should be noted that diameters can be coded as discrete variables and they must be chosen among those listed in Table 3. On the other hand, slopes are derived from the elevation and depth of the conduit ends. Therefore, they are continuous variables that may assume any value. As it happens in every design problem, constraints have been used for maximum velocity, capacity of the conduit and minimum slope. Another restriction was used, based on a similar one proposed by Meredith [6]: the invert elevation of a pipe leaving a manhole cannot be higher than the lowest invert elevation of a pipe entering the manhole.


**Table 3.** Cost of conduits.

When calculating pipe installation costs, a formulation which involves both cost of the pipe according to Table 3 and the cost of installing such a pipe. In order to do so, a standardized trench was used (shown in Figure 8). It will depend on both the diameter (D) and the maximum depth the pipe can be installed (Δ*z*). The trench model used is shown in Figure 8, as well as all the data that defines it. It is worth mentioning that the same type of trench has been used for all the pipes, regardless of the type of terrain in which pipes were located.

**Figure 8.** Trench model used.

This way, the data required to define the trench include:


Likewise, *z*0 and *z*1 represent the invert and the ground elevations, respectively. The latter is calculated in the algorithm for all nodes with the exception of the outfall node D-1 for which *z*0 = 2.5 m. Therefore, using these values and pipe diameters it is possible to calculate the rest of the geometrical parameters of the trench.

With the trench parameters, it is possible to calculate the volumes that correspond to each part of the trench construction. These calculations must then be associated to the costs of the different actuations that were performed on the terrain. A cost function associated with the trench is thus obtained, which is the sum of the terms shown in Table 4.


**Table 4.** Costs associated with the trench model.

The geometrical calculation of the trench gives a cost function for pipe *i* that depends on the diameter ( *Di*), the depth ( Δ*zi*) and the length (*Li*) of the pipe:

$$C\_i = f\left(D\_{i\prime} \Delta z\_{i\prime} L\_i\right) \tag{2}$$

According to the object model of EPA SWMM, the elevation of both ends of each conduit will be computed and must be modified during the calculation process. Because of the different nature of the variables, two algorithms have been used for network design: a pseudo-genetic algorithm (PGA) and the particle swarm optimization (PSO) algorithm. PGA is a modified genetic algorithm that replaces the binary coding of each variable by an integer coding [26]. Therefore, PGA is meant to address problems of discrete character. PSO, instead, is an algorithm more suitable for continuous problems [27]. In both situations, modifications to the different generations have been performed with the help of the Toolkit functions.

In order to modify the slope of conduits, only the elevation of the downstream end of the pipe was modified, while the upstream end was fixed to the invert of the upstream node. The pipe slopes have been limited to be between 0% and 5%. The slope has been coded differently depending on the algorithm used. In the PSO method, due to its continuous nature, any value within this range has been allowed. In the PGA, instead, the range was divided into 100 intervals. This different coding is one of the reasons why PSO presents higher execution costs but better solutions than PGA.

Some restrictions were imposed. Maximum allowable velocity in pipes (*v*max) was fixed at 4 m/s. As it is common in optimization problems with restrictions, if they are violated, penalizations will be applied to the cost functions. If the velocity in a pipe (*v*i) is bigger than the maximum velocity, a binary variable δ1,i will take the value of 1 and the penalty will be the exceedance times the penalty cost ( *λ*1). Finally, damage functions for flooding and surcharge conditions were assumed. As the target of the design was to avoid both situations, these functions were high enough to discard designs with flood or surcharge. Therefore, if the water level in node *j* (*yj*) is higher than the level that provokes surcharging (*yj*,*max*), another binary variable *<sup>δ</sup>*2,*j* will take the value of 1 and a penalty cost ( *λ*2) will be added. Then, the fitness of a solution *k* will be given by an objective function *F<sup>k</sup>* that accounts for the pipe costs and the penalties for constraint violations:

$$F^{k} = \sum\_{i=1}^{NL} \mathbf{C}\_{i}^{k} + \lambda\_{1} \cdot \sum\_{i=1}^{NL} \delta\_{1,i} \cdot \left(\upsilon\_{i}^{k} - \upsilon\_{\max}\right) + \lambda\_{2} \cdot \sum\_{j=1}^{NM} \delta\_{2,j} \cdot (y\_{j}^{k} - y\_{j,\max}) \tag{3}$$

In this equation, *C<sup>k</sup> i* is the cost of pipe *i* in solution *k* according to Equation (2), *NL* is the number of links and *NM* is the number of manholes in the model.

In order to account for computational costs, nearly 7000 simulations were carried out for every algorithm. All the simulations were done with an initial population of 100 individuals, and the rest of the parameters were tuned for each method [28].

The optimal result obtained using the AG design model offers a solution that costs 290,441.68 €, while the solution obtained using PSO design model is 287,518.02 €. Both algorithms yielded the same solution for diameters, but since PSO is a continuous algorithm, its results are slightly better (1%) compared to those obtained by using APG. On the other hand, APG needs less than half the number of iterations than PSO. Furthermore, the rate of success of APG (as defined in [28]) is better. The summary of these results can be seen in Table 5.

**Table 5.** Summary of results for both algorithms.

