# An Optimization Framework for Wind Farm Design in Complex Terrain
## 3 Optimization Framework
### Optimization Algorithm  
To solve the optimization problem, the Random Search (RS) algorithm is used in the current framework. This algorithm was first proposed by [PERSON] in [PERSON] and Shen in Feng and Shen (2015) and improved in [PERSON] and Shen (2015). Recently,  
Figure 3: Constraint modelling: (**a**) TRI (terrain ruggedness index) map; (**b**) feasibility map with one inclusive (red line) and one exclusive (green line) boundary, and bounds on TRI (\(\text{TRI}_{max}=0.05\) ) and \(v^{mean}\) (\(v^{mean}_{min}=6.5\) m/s ). they also extended the algorithm to cover multiple objective cases [28] and overall design cases with multiple types of turbines [19], and to maximize the robustness of wind farm power production under wind condition uncertainties [29]. It has shown a superior performance when compared to other popular algorithms, such as GA (genetic algorithm) [16], NSGA-II (Non-dominated Sorting Genetic Algorithm II) [28], and mixed-discrete PSO (Particle Swarm Optimization) [19]. RS is a single solution search method. At each step, a new feasible design, i.e., a design satisfies all the constraints and bounds, is generated by slightly changing the current design, i.e., randomly choosing a turbine and moving it to a random position inside the feasible area. This new design is then compared with the current design with respect to the objective function. If the new design is better, it becomes the current design. If not, the current design remains unchanged. This step is iteratively repeated until a given stop condition is met. Normally, the stop condition can be set as a maximal number of steps (equivalent to the number of objective function evaluations). The procedure of this algorithm is shown as a flowchart in Figure 4.  
There are two parameters controlling the RS algorithm: maximal step size, \(M_{\max}\), which controls how far away a chosen turbine can be possibly moved from its current position; and maximal number of evaluations, \(E_{\max}\), which defines when to terminate the optimization process. \(M_{\max}\) should be set large enough to allow the algorithm to explore the design space more thoroughly and escape local minima more likely. When no trials and experimentations are first applied, \(M_{\max}\) could be set in the order of the maximal distance between any two points in the feasible wind farm area and \(E_{\max}\) should be in the range of 1000 to 10,000. Due to the randomness involved in the optimization process, meta-heuristics, such as RS, exhibits a stochastic nature, meaning different runs typically obtain different results. This also means that the quality of the initial solution(s) can have profound influences on the final optimization results and the convergence speed [30]. [PERSON] et al. [31] tackled this problem by seeding an evolutionary algorithm with initial solutions obtained by a greedy heuristic algorithm, and applied this method in wind farm layout optimization. In this study, a simple algorithm called Heuristic Fill is proposed to find a good initial design, based solely on site conditions and constraints. As described in Section 3.2, the feasibility of each grid, \((x_{i},\ y_{j})\), can be calculated as \(F(x_{i},\ y_{j})\) based on constraints defined in Equations (13), (16), and (17). The mean wind speed of each grid, \(v^{mean}(x_{i},\ y_{j})\), can also be obtained from site conditions. The algorithm then tries to fill the feasible grids with \(N_{\mathrm{wt}}\) wind turbines one by one according to the  
Figure 4: Flowchart of the Random Search algorithm. corresponding mean wind speed from high to low, while respecting the minimal distance constraints in Equation (14). This algorithm can be summarized in the pseudo code shown in Algorithm 1. 1. Find the set of feasible grid points: \(G_{feasible}=\left\{(x_{i},\,y_{j})\,\left|F(x_{i},\,y_{j})=1,\,\text{for}\ i=1,\,2,\,\ldots,\,N_{x},\,j=1,\,2,\, \ldots,\,N_{y}\right\}\right\}\);
2.