Optimizing the Layout of Run-of-River Powerplants Using Cubic Hermite Splines and Genetic Algorithms

: Despite the clear advantages of mini hydropower technology to provide energy access in remote areas of developing countries, the lack of resources and technical training in these contexts usually lead to suboptimal installations that do not exploit the full potential of the environment. To address this drawback, the present work proposes a novel method to optimize the design of mini-hydropower plants with a robust and efﬁcient formulation. The approach does not involve typical 2D simpliﬁcations of the terrain penstock layout. On the contrary, the problem is formulated considering arbitrary three-dimensional terrain proﬁles and realistic penstock layouts taking into account the bending effect. To this end, the plant layout is modeled on a continuous basis through the cubic Hermite interpolation of a set of key points, and the optimization problem is addressed using a genetic algorithm with tailored generation, mutation and crossover operators, especially designed to improve both the exploration and intensiﬁcation. The approach is successfully applied to a real-case scenario with real topographic data, demonstrating its capability of providing optimal solutions while dealing with arbitrary terrain topography. Finally, a comparison with a previous discrete approach demonstrated that this algorithm can lead to a noticeable cost reduction for the problem studied.


Electrification in Developing Countries and Mini-Hydropower Plants
The use of Mini Hydro-Power Plants (MHPP) constitutes one of the most efficient solutions for the problem of energy access in remote rural areas, especially in the context of developing countries [1]. These small installations are capable of exploiting the potential energy of a natural water flow to generate electricity with minimal environmental impact and simple equipment. Nevertheless, the context of poverty of these emplacements conditions the design strategies, which are usually based on the personal experience of local technicians and the use of hand rules. For this reason, the development of efficient and robust design strategies can play an important role in the application of these technologies to combat energy poverty.
An MHPP basically consists of extracting a fraction of the water flow from a natural course and conducting it downhill through a long pipe, called penstock, at the end of which the water interacts with a generation unit and transforms its kinetic energy into electrical energy (see Figure 1). It is relevant to note that the water is returned to its natural course, and thus the environmental impact is almost zero. The potential and cost efficiency of an MHPP is determined by the correct use of the terrain or, in other words, the optimal emplacement of its elements and of the penstock layout to achieve the maximum height difference with the shortest pipe length (as pipe friction lowers the efficiency). When the price of the equipment is low, the costs of the deployment can become relevant with respect to the overall cost, and thus the civil works involved become a variable of interest. This, together with the penstock bending and the arbitrary profiles of the terrain and the river, increases the complexity of the problem and motivates the use of numerical and heuristic optimization approaches.

Optimization of MHPP
The problem of optimizing MHPP is addressed in the literature from a wide variety of perspectives. For example, some works propose solutions to reduce the environmental impact of the plants [2,3], to quantify the potential of these installations [4], to improve the MHPP viability [5], or to operate the plants under water scarcity conditions [6,7].
Although the seasonal character of water availability induces variations in the energy production of MHPP, these plants remain one of the best solutions for isolated, rural locations with no access to the power grid, and therefore a large effort has been made in the literature to improve their design and viability. In line with this, some studies have focused on the overview and characterization of the main elements and variables of these installations [8], the design of the turbines (see [9] for a nice survey about this topic), and the analysis of the most important economic indexes [10].
A very relevant line of work is that related to the optimal components selection and/or operation of MHPP in situations in which the plant layout, that is, the location of its main elements (namely water intake, penstock profile, and powerhouse), has been fixed. For example, Ref. [11] presents a numerical tool to maximize power production or economic profit by selecting the adequate penstock diameter and type of turbines. The work takes into account the dependence of the turbine efficiency on variables such as water flow, suction head, and rotational speed. Moreover, ref. [12] presents the most important features of the turbine model from a control point of view, and, in [13], the use of model predictive control to deal with prediction errors in the available water in the reservoir and is proposed.
In general, the number of variables and constraints and its nonlinear character involve a degree of complexity that makes the use of traditional gradient-based optimization strategies difficult. For this reason, the utilization of computational intelligence methods has gained great attention to deal with the previous optimization problems. Some examples of this include [14], where the authors present a stochastic evolutionary algorithm to find the blade of a Turgo water turbine that maximizes the hydraulic efficiency. Similarly, in [15], the bucket shape of Pelton turbines in various operation conditions is optimized using a Lagrangian formulation and solving the problem with evolutionary algorithms. In addition, ref. [16] proposes a complex simulation algorithm to analyze plant operation yearly and compute energy production and economic indices. The authors' findings show that the optimal sizing in terms of some economic indicators is not the same as the one maximizing the exploitation of the hydraulic potential. Moreover, ref. [17] investigates the potential of using a proposed metaheuristic method to provide optimal operations for multireservoir systems, with the aim of optimally improving hydro-power generation.
This work addresses the problem of optimizing the layout of a MHPP. The problem can be roughly stated as follows: given the profile of a river and its surrounding terrain, find the location of the water intake, the turbine, and the penstock layout in such a way that the mechanical stress in the pipe is below a certain level, σ max ; the obtained power is above a desired value, P min ; and the cost of the installation is minimized. Typically, this problem has been tackled, making some simplifications to use traditional analysis or optimization tools. For example, in [18], the authors propose a theoretical analysis to find the optimal penstock layout and diameter for low head plants. The optimization problem considers a 2D formulation of the MHPP layout, which, in addition, is considered composed of a unique straight segment. Despite the elegance of the obtained analytical results, these simplifications limit the practical implementation, for example, in the (frequent) situation in which the river profile is irregular. Removing this kind of simplification improves the applicability of the developed methodologies at the cost of a dramatic increase in the problem complexity. This results in optimization problems that cannot be solved resorting to linear programming or convex optimization tools, and this is when machine learning techniques and metauristic optimization come into play. For example, ref. [19] presents a method to select an adequate turbine and to compute the optimal and penstock diameter based on Honey Bee Mating algorithm, ref. [20] introduces the application of a genetic algorithm to optimize the flow rate and number of generators in a multi-objective problem where generated energy and investment cost are the objective functions, ref. [16] develops a stochastic evolutionary algorithm to select the optimal turbine capacity and lengths/diameters of the penstock segments, and [11] presents an evolutionary algorithms to maximize power production or net economic profit by optimizing, the penstock diameter, and the type and configuration of the turbines. In all previous works, the intake and turbine locations are assumed to be given. On the contrary, some works include the penstock layout and the intake and turbine locations in the optimization problems. Some examples of these are presented in [21,22], where arbitrary 2D river profiles are considered and integer programming and evolutionary methods are employed, respectively. The extension of these approaches to (discretized) 3D profiles is presented in [23]. Another interesting work presented in [24] makes use of three optimization modules and genetic algorithms to simultaneously determine the optimal intake location, penstock length and diameter, and turbine number, capacity, and discharge schedule.
As a significant improvement with respect to previous approaches, this work proposes the optimization of the layout considering a continuous, 3D formulation of the problem, capable of dealing with an arbitrary terrain and river profile, using a Genetic Algorithm (GA).

Contributions
This paper presents a new and improved method for computing optimal MHPP layouts considering cost, power, and flow constraints. As in [23], the 3D terrain is discretized based on the available topographic data, and civil work costs to deploy and install the penstock are taken into account. However, in the new developed method, the penstock is not assumed to be composed of straight lengths, which is an unrealistic constraint in real installations where the pipe length bends considerably in the horizontal plane to accommodate the penstock layout (see Figure 2).
The new method is formulated based on three main components. First of all, the main equations characterizing the MHPP power, flows, costs, and constraints are derived. Secondly, the penstock profile is approximated and used suitable approximation cubic Hermite splines for the vertical dimension. This choice is made to preserve, on the one hand, the monotonicity of the curve that describes the penstock (required to avoid air entrapment) and, on the other hand, to provide an easy formulation for the bending radius of the penstock length, as it can be determined in terms of the derivatives of the cubic polynomials. This consideration makes it possible to account for an extra degree of freedom that can be limited according to the material and diameter of the penstock. Finally, a specifically designed genetic algorithm is applied to characterize the optimal MHPP layout, studying both single-objective and multiple-objective problems. The constraint relaxation based on spline interpolation not only involves a better approximation of the penstock layout, but also makes it possible, as it will be shown in the paper, to obtain designs that are better in terms of cost and attainable power.

Power Generation
The obtainable power P of a hydropower plant can be estimated in terms of the net head, H t , and the water flow rate, Q, as where ρ is the density of the water, g is the acceleration of gravity, and η is the overall efficiency of the generation equipment. The net head, H t , represents the net height of the water at the entrance of the turbine, which can be written as the gross height, H g minus the friction loss h f ric : Considering an action turbine, in which the energy to be transformed in the turbine is entirely kinetic (through the formation of a jet), it can be written that The velocity of the jet, v jet , can be written in terms of the water flow rate Q and the nozzle injector section area, S noz , and after substituting the expression for h t can be rewritten as where a discharge coefficient C D has been introduced to model the formation of a vena contracta in the jet. Finally, a simple approximation for the height loss term from [25] as: with k p being a constant of the pipe material and D p its internal diameter. Now, substituting this last expression, together with Equation (4) in Equation (2), an expression for the water flow rate that will feed the plant can be obtained: Finally, introducing Equation (6) in Equation (4), and the resultant expression in Equation (1), it yields: It is relevant to note that this expression allows for estimating the power generated by any hydropower plant on the basis of the gross head H g , and penstock length and diameter, L p and D p . These three variables, indeed, are determined by the spatial layout of the plant over the terrain.

Terrain
To model the layout of an MHPP, the height map of the terrain is required to be properly characterized. To this end, a set of experimental topographic data points, T i (x i , y i , z i ), are considered to be obtained through a topographic survey. On the basis of these points, a continuous height function z = f (x, y) is built through a linear interpolation. The river layout is determined on the x − y plane using the aerial imagery from the topographic survey. This provides a second set of data points R i (x i , y i , f (x i , y i )) for the river, which is transformed into a continuous function using a cubic spline interpolation.

Spline-Based Penstock Layout
As shown in Figure 3, possible MHPP layouts are modeled as a parametrized continuous curves, Γ, connecting two points of the river: the water extraction and the turbine emplacement points. For an enhanced formulation, these curves Γ (candidate solutions) are spline-based interpolations of a subset of spatial points belonging to T i (x i , y i , z i ), named nodes (see Figure 4). This way, any given solution can be built through the interpolation of n nodes in the form of (x i , y i , z i ), as long as the first and last belong to the river. Thus, the solution Γ is written in terms of the cited coefficients as where S x (t), S y (t) and S z (t) are the interpolation functions for x, y, and z coordinates of the nodes, respectively. The parameter t is trivially defined to match the nodes index, and thus It is relevant to note that, for any layout to be feasible, it is required for the slope of the penstock not to change its sign [26]. For this reason, a Hermite cubic interpolation has been employed for S z (t), while natural cubic splines have been employed for S x (t) and S y (t) functions. This strategy guarantees that, as long as the nodes are ordered in height, the sign of the slope of the penstock will not change the layout. An illustrative example of this is shown in Figure 5 for the sake of understanding.

Figure 5.
Example of interpolation functions for a solution with five nodes, whose coordinates are represented using squares. Note that S x (t) and S y (t) (in blue) are natural splines, while S z (t) (in red) is a monotone Hermite spline.
Finally, to ease further calculations related to the length of the penstock, an arc-length reparametrization s(t) such that Note that, with this reparametrization, the curve Γ(s) is defined for s ∈ 0, L p . Once the curve Γ(s) has been built, the performance of the resulting MHPP (power and water flow rate) can be determined using Equations (6) and (7). In addition, this approach permits a simple estimation of the cost, as will be discussed in the next section.

Pipe Curvature
As it was mentioned in Section 1.3, in this work, the penstock is not considered to be composed of straight segments, as in previous approaches, but able to slightly bend along its layout, as a result of the real deformation that can be observed in long pipes (as shown in Figure 2). Nevertheless, these curvatures are required to be compatible with the material properties (in particular, its stiffness and resistance), and thus a limitation is required to be imposed for the curvature radius r.
Considering the pipe as a simple Euler beam under pure bending [27], a direct relation can be written between the radius or curvature r and the maximum mechanical stress σ, involving the Young modulus of the pipe material (typically mild steel [28]), E, and the diameter, D p : The Von-Mises yielding criterion [27] can be used to impose the safety of the pipe as follows: where S y is the tensile strength of the material. Substituting and reordering, it can be written as: It is relevant to note that the minimum curvature radius allowable depends on the diameter of the pipe.

Cost of the MHPP
The minimization of the cost of the plant is considered as the objective of the optimization problem addressed in this work, and thus an appropriate model is required to be formulated. First, as the generation equipment is sized for a range around the objective power generation level, the penstock layout is the main variable in the optimization problem, which includes not only the cost of the pipe itself, C p , but also the costs of the labor involved in its deployment, C cw , associated with the required excavation and supports.
For the cost of the pipe, the following polynomial expression is proposed: where a i and b i are experimentally adjusted coefficients to be fitted to the costs of the local manufacturers. The costs of the civil works can now be evaluated as the sum of those related to the supports, C sup , and those related to the excavations, C exc : To calculate these two costs, the height difference between the terrain and the penstock is required to be evaluated. This variable will be denoted with (s), which is written in terms of the arc-length variable s, shown in Figure 3: This gap (shaded in Figure 4) can reach positive and negative values along the path of the penstock, having different implications: positive gaps (the penstock lies over the terrain surface) results in the need for supports, while negative ones (the penstock lies under the terrain surface) result in the need for excavations. Now, both C sup and C exc can be calculated. The first is calculated through the integration along the path of the cost of a single support (that depends on its height) times the linear density of supports µ sup . The cost of a single support has been defined by a constant k sup times its squared height. This expression has been proposed to fit the average costs following the local technicians indications. On the other hand, the excavation cost is calculated as a unitary volumetric cost, k exc , multiplied by the total volume to be excavated, which is determined by integrating along the path a certain digging cross-section, defined by a cut angle β exc . These approximations result in the following expressions: The scheme of these two models is shown in Figure 6 for a clearer understanding. Note that the extra distance 0 to be nailed to the ground has been considered proportional to , and thus can be grouped in constant k exc .

Problem Formulation
Finally, the problem is formulated as the minimization of the cost, C, such that the solution represents a feasible MHPP layout, with a generated power P above a certain required level, P min . This is: s.t. (7) > P min (10) < S y

Complexity of the Problem
The target optimization problem is a non-convex one, where classical gradient-based solvers would fail to find optimal solutions. Genetic algorithms like the one used in this work are suitable for non-convex scenarios with restrictions. The complexity of the problem is high, since the number of design variables (nodes in the penstock layout) may be variable, and the variables are continuous. Consequently, the search space is both infinite and nonconvex, making it impossible to use brute force or exhaustive algorithms due to the computational time required. Therefore, a metaheuristic algorithm such as a Genetic Algorithm is a suitable approach to obtain optimal solutions in a reasonable computational time. Furthermore, Genetic Algorithms are appropriate for dealing with the restrictions of the target problem and for solutions of variable lengths like the ones used in this work.

Genetic Algorithm
Genetic algorithms (GA) are metaheuristic optimization algorithms that are widely employed to solve complex engineering problems [29,30]. GAs are population-based approaches. This means that they seek the optimum values (maximum and/or minimum) of a given problem from a population of random solutions. These random solutions evolve over generations improving at each step by genetic operators: selection, crossover, and mutation. Genetic operators are inspired by the Darwinian theory [31] in which those individuals who better adapt to their ecosystem are the ones that will have more probability to survive over time. In an optimization problem, the individuals are given by potential solutions, and the adaptation to the ecosystem is obtained by the quality of the potential solution in the fitness function. As a rule, the higher the quality of the solution, the better the adaptation. Thus, the population of the potential solutions evolves towards the optimum value until the stop criterion is reached, which is normally fixed as a number of generations.

Individual Encoding
The individual chromosome represents a potential solution of the target problem. The chromosome is composed of genes, each one representing a design variable of the problem. In this case, the variables consist of (see Figure 7): • The coordinates s 1 and s n corresponding to the end nodes; • The coordinates (x i , y i ) of the interior nodes of the penstock, being i the number of each node; • The height of the nodes relative to the surface of the terrain ∆Zi. Notice that it is a relative value with respect to f (x i , y i ), which determines the actual height of the terrain; • The diameter of the penstock D p .

Individual Generation
Given the complexity of the problem and the constraints, the generation of individuals on the basis of a purely random generation of nodes through the space might cause a high rate of either unfeasible or low-quality individuals. For this reason, a customized generation routine has been developed to guarantee the feasibility of the individuals and improve their initial fitness. The generation scheme developed is based on the generation of selection an arbitrary number of points (x, y) chosen from the river x, y layout. The highest and lower of these nodes are considered the location of the dam and the powerhouse, respectively, while the rest are considered the interior nodes. The positions of the interior nodes are displaced from the original emplacement through a Gaussian probability function in both x and y directions. The Gaussian distribution is the same for both axes, centered at zero and with a scale hyperparameter σ to be tuned. Finally, the inner nodes are assigned a z i coordinate as the terrain height at that point plus a distance ∆z randomly generated from this same Gaussian function. In Figure 8, an example of a generated individual with five nodes is shown.

Mutation Operator
The mutation operator used in this work is inspired by that from [23], as it demonstrated its efficiency in a related (discrete) problem. This operator is based on performing three different actions that are susceptible to being applied to individuals. These are: • With a certain probability, p mut,0 , one of the internal nodes can be removed from the individual (see node 4 in Figure 9); • With a certain probability, p mut,1 , a new node is attached to the individual. This new node is generated through a procedure similar to that in the generation scheme, beginning with the selection of an arbitrary point of the river between the dam and the powerhouse and its later Gaussian displacement (see node 6 in Figure 9). • With a certain probability, p mut,d , a gene changes its emplacement by means of a Gaussian displacement. This displacement is performed in the three dimensions of space if the node is interior (as nodes 2 and 3 in Figure 9), or constrained to the river profile if it is not (as nodes 1 and 5 in Figure 9).
In addition, the value of the diameter (stored in the last gene) is modified following the same Gaussian displacement cited before.

Crossover Operator
For the crossover operator, a tailored operator, based on an exchange of nodes between the two parents, is proposed as follows: 1.
The offspring is initialized by defining their two end nodes as the lowest and highest nodes contained by the parents;

2.
The interior nodes of both parents are grouped together, and then each of these are being randomly assigned to one offspring; 3.
The diameters of the offspring are determined using a simulated binary crossover between the diameters of the parents. This is being D 1 and D 2 , respectively, the diameter of the two parents, the diameter of the offspring, D * 1 and D * 2 are calculated as: where φ is generated through a random variable α ∼ U (0, 1) as: from where it can be seen that φ is generated between −α and 1 + α. With this approach, the blend crossover of both diameters is not limited to result in values within the range of the diameters of the parents.
In Figure 10, an example of the node exchange between two individuals during a crossover operation is represented for a better understanding. Figure 10. Example of the exchange of nodes between two individuals during a crossover operation. Note how the highest and lowest nodes (A1 and B3) are directly inherited by the offspring, while the internal nodes (A2, A3, and B2) are randomly distributed among them. End nodes A4 and B1 are thus not used.

Fitness Function
Death penalty is employed to deal with unfeasible individuals. Thus, as the objective is the minimization of the cost C of the plant, the fitness function, F, is then defined as: Note that the only two reasons for which an individual may not be feasible are (i) an excessive curvature of the pipe at any point of its layout or (ii) an insufficient power generation level.

Simulation Examples and Results
This section summarizes the results of the application of the method proposed to a real case.

Scenario Parameters
To evaluate the performance of the proposed approach, a real application case is proposed. The case study is based on the rural community of San Miguelito, in the town of Quimistán (Honduras), that lacks access to the electrical grid because of the geographical limitations. This community was chosen by the Honduran Foundation for Agronomic Research (FHIA) as a candidate for the installation of a micro-hydropower plant. In a first evaluation by the technicians, a minimum generation of 8 kW was established as the power required to supply the approximately 40 families that live in the community. An aerial drone topographic survey was performed to provide the dataset, composed of a grid of 2900 terrain data points and a set of aerial images, based on which an additional set of 59 points of the river profile were determined. Regarding the problem constants, those from [23] have been considered in this work, for the sake of comparison. These parameters are summarized in Table 1. Table 1. Summary of the scenario parameters considered for the example.

Parameter
Value 10 a 0 (c.u./m) 13.14 a 1 (c.u./m 2 ) 99.76 a 2 (c.u./m 3 ) 616.10 For a further analysis of the performance of the method, two additional study cases have been proposed by modifying the example presented in this section:

1.
Modified problem 1 is based on reducing the power output constraint. This models the design of a plant for a much smaller village, with a consequently lower power supply requirement. In particular, the required power output, P min , has been set to 4-kW.

2.
Modified problem 2 is based on (i) increasing the required power output of the plant and (ii) modifying the costs associated with the pipe and its deployment. The first of these modifications represents the application of the method to supply a more populated village. In particular, the required power output, P min , has been set to 14-kW. The second of these modifications is based on considering a low quality terrain that strongly makes the transport of the pipe difficult, translating into an increase of its cost per unit length, but eases the excavations labor involved. This has been modeled by using a 1.5 multiplier for C p , on one hand, and reducing the required cut angle of the excavations, β exc , to 10 • and the unitary volumetric cost, K exc , to 2 c.u./m 3 , on the other.

Algorithm Parameters
A µ + λ Genetic Algorithm has been employed to address the optimization problem developed (The complete code can be found in https://github.com/atapiaco/run_of_ river_plant_3D_optimization), using the coordinates of the nodes of the layout Γ as genes. To find an adequate value of the hyperparameter on the generation scale σ, a search has been performed. A total of 10 thousand individuals have been generated and evaluated for values of σ ranging from 0 to 10, with the results shown in Figure 11. The best fitness was obtained with σ = 4.2, and thus this value has been employed for the simulation.
Given the similarity of the mutation scheme to that proposed in the discrete version of the problem [23], the optimal probabilities that were determined have been considered in this work. These are p mut,mov = 0.01, p mut,01 = 0.05, p mut,10 = 0.20, β mut = 0.5 Figure 11. Influence of the scale parameter σ on the average fitness of the generated populations. Each dot represents the average fitness of a population of 10,000 individuals.
Finally, the algorithm has been executed for different values of the mutation and crossover probabilities, with 10 trials for combination. A summary of the main parameters of the GA is shown in Table 2.

Results
The results obtained for the different combinations of mutation and crossover probabilities obtained for the proposed reference case are summarized in Table 3. It can be observed that the best individual has been obtained using 0.7 and 0.3 for the crossover (p cx ) and mutation (p mut ) probabilities, respectively. The execution of the algorithm exhibited good convergence after approx. 500 generations for almost all trials, with slight improvements during the next hundred generations. In Figure 12, the best fitness of each generation has been represented by one of the trials of the cited probability values.  This individual represents a plant layout with a total cost of 20,966.11 (c.u.), significantly better than the one obtained by other configurations. The solution provides enough power for the electrical demand required (power generation is slightly superior to the 7 kW required) and satisfies the curvature constraint. It can also be seen how the minimal bending radius depends on the diameter of the pipe, according to Equation (12). Observing the layout that corresponds to this solution (see Figure 13), it can be seen how the penstock, with a 14 cm diameter, cuts through rough terrain and avoids local curvatures of the river. Once the optimal hyper-parameters have been determined, these have been used to solve the modified versions of the reference case. The best solutions obtained are represented in Figure 14, and the main variables associated with these are summarized in Table 4, together with the reference ones.  A few interesting comments can be made after observing these results. With respect to the first modification of the problem, it can be seen that, as the required penstock length is smaller, the layout can be drawn with a much smaller curvature (the minimum bending radius is more than twice the minimum allowed). It can also be noted that, in comparison with the reference case, the cost reduction is significantly higher than the power reduction. This is understandable, given that the shorter the length of the penstock, the easier to find a place to take advantage of the benefits of a region of the terrain (high river slope, low terrain bumps, etc.). With respect to the second modified problem, the most evident fact is the need of a larger penstock, which also has increased its diameter from 14 to 17 cm. As was expected, increasing the cost of the penstock and reducing the cost of the excavations causes the algorithm to take advantage of cutting through rough terrain at the curved part of the river, as the required excavations are now preferable with respect to a longer penstock laying over the ground. These two modified cases demonstrate the goodness of the approach and its capability to provide different solutions in accordance with the particularities of both the environment and the economic factors.

Comparison with Previous Approaches
As indicated in Section 1.2, the proposed method constitutes a substantial novelty relative to previous approaches in the literature, fundamentally due to (i) the 3D nature of the approach, which considers the real topography of the terrain avoiding simplification errors that are present in 2D-based traditional methods (such as those in [22,32], and (ii) its continuous formulation, which improves the search space and avoids the strong conditioning between the resolution of the terrain mesh and the efficiency of the method that arises from discrete methods (such as [23]. Regarding approaches based on 2D simplification, it is clear that their practical implementation is limited to those cases in which the curvature of the river is negligible. In those cases where this is not met, not only might the performance of the plant differ, but the difference in length of the optimal layout projected (2D) and the real one (3D) can cause incompatibility problems during the installation. These issues have been numerically demonstrated by the authors in [32], where the authors propose a 3D approach, in which the plant layout is defined as a connection of straight pipe lengths, connected to each other using elbows. For the sake of a fair comparison, the approach proposed in this work cited has been used to solve the reference example in Section 4.1. The method considered is defined on a discrete basis, the raw topographic data points considered as candidate positions for these elbows to be deployed on the terrain. It is relevant to note that, in addition to the different framework of the discrete approach, the cost function is slightly different, as it includes an additional term to account for the cost of the elbows and their installation. For this approach, Equation (13) is transformed into: where n c represents the total number of penstock pipe elbows, and the constants b i are adjusted to match the real costs from local manufacturers. For this problem, the values from [32] have been used; these are: The optimal solution obtained with this method is represented in Figure 15, and numerically summarized in Table 5. When these results are observed, it can be seen that the continuous approach proposed in this work provides a better solution. Nevertheless, some interesting additional comments can be made. First, it is relevant to note that the cost reduction is not very high (about 3% reduction), as both layouts are qualitatively similar. It is also interesting to note that the penstock obtained with the discrete approach is 11 m shorter with the same diameter, but it is the cost of the elbows that increases the cost. Finally, the fact that the continuous approach provided a power generation closer to the minimum constraint (7 kW) demonstrates how the discrete is strongly conditioned by the refinement of the topographic survey, that is, the number of terrain points. The fewer the data points, the lower the probability of finding a solution that satisfies the constraints more tightly.
To conclude the comparison between these two approaches, it is mandatory to note that these actually refer to two different alternatives for the physical installation of the penstock, and thus the superiority of the continuous approach is not to be taken for granted, as some particular cases (such very steep, irregular terrains) might be better suited to layouts with a penstock composed of straight segments connected through elbows, avoiding the curvature limitations of the continuous approach. For these reasons, both methods are recommended to be considered for the optimization of these plants.

Conclusions and Further Work
This work proposes the optimization of an MHPP using a continuous formulation of the problem from a three-dimensional approach. The problem is formulated as the minimization of the cost of the plant with a minimum power generation constraint. The problem considers not only the cost of the equipment, but also the cost of the civil works involved in its deployment, in such a way that the strong dependence of the path of the penstock through the terrain and the labor involved in terrain excavation and installation of supports is considered. A GA has been developed to solve the optimization problem, for which initial population generation, mutation, and crossover tailored operators have been designed, given the complexity of the constraints involved. The algorithm has been applied to an illustrative case study based on a real-case scenario in a small remote community in Honduras, and two additional modifications of this problem, to further evaluate its performance. The real topography of the terrain and the river profile have been determined through an aerial topographic survey, and an optimal layout for the MHPP has been precisely determined. The solution obtained permits the generation of 7 kW, with a total cost of 20,966 c.u. The analysis of the solution obtained demonstrates how the algorithm builds a layout that cuts through rough terrain, thus demonstrating the benefits of using this approach. Finally, this approach has been numerically compared with a previous approach published in the literature, which showed that the continuous approach proposed can lead to a 2.8% cost reduction of the installation.