## 3 Using the SHC to Estimate the Deflection When the Crack Is Located at the Fixed End  
Stochastic Hill Climbing (SHC) is an optimization algorithm, which starts from a solution and expands it through incremental searches within a local area of the search space, using an objective function, until an optimum is found. This essentially makes it an ideal candidate in unimodal optimization problems, or after the application of a global optimization algorithm. Other similar types of algorithms, which aim to approximate a 'good-enough' solution instead of searching for a global best, exist. These include genetic algorithms, simulated annealing, random recursive search, and Tabu search. Most of these are applicable for a broad range of problems because they: (i) generally require little or no a priori knowledge, and (ii) can easily find an optimum solution by following local gradients using the objective function.  
The SHC algorithm as used in this study considers as input three points \(P_{k}(a,x_{k})\) with \(k=1\dots 3\). These points are the deflections of the beam at the free end when the crack is located at distances \(x_{1}\), \(x_{2}\) and \(x_{3}\), found involving the FEA. In addition, we indicate the deflection of the intact beam derived by the means of FEA, which is \(P_{u}\). The output consists of one point, which is the deflection of the beam at the free end \(\delta(a,0)\) achieved when the crack is located at the fixed end. The steps performed when running the algorithm are:  
1. Generate an initial point.
2. Evaluate the initial point.
3. Take a step \(s\).
4. Evaluate candidate point.
5. Check if we should keep the new point.  
The objective function used to evaluate a candidate solution is given by  
\[c(s)=\sqrt{\sum_{i=1}^{n}\left(\delta_{1}^{s}(a,x_{k})-P_{k}(a,x_{k})\right)^{ 2}} \tag{9}\]  
In Equation (9), the points \(P_{k}\) are the deflections found from the finite element analysis and \(\delta_{1}(a,x_{k})\) are the deflections calculated, for the locations \(x_{1}\), \(x_{2}\) and \(x_{3}\), with the mathematical relation  
\[\delta_{1}^{s}(a,x_{k})=\frac{\widehat{\delta}\left(a,0\right)\delta_{u}}{ \left(\sqrt{\widehat{\delta}\left(a,0\right)}-\left(\sqrt{\widehat{\delta} \left(a,0\right)}-\sqrt{\delta_{u}}\right)\left[\overline{\Phi_{1}}^{\prime \prime}\left(x_{k}\right)\right]^{2}\right)^{2}} \tag{10}\]  
Here, \(\widehat{\delta}\left(a,0\right)=s\cdot\delta_{u}\). The search process starts with considering \(s=1\), and its value is subsequently increased until \(c(s)\) achieves the lowest value possible. We exemplify here the case of a crack with a depth of 1 mm. Figure 2 shows the objective function evaluation for each improvement during the hill-climbing search. During the optimization process, we initially get big changes, and toward the end of the search, these changes become very small. After about 50 iterations the algorithm manages to converge on the optima.  
We have implemented our SHC algorithm in Python and created a basic user interface that allows us to easily estimate the deflections. Figure 3 shows the main window of the PySHC application.  
Figure 2: Objective function evaluation for each improvement during the Hill Climbing Search.  
In the developed Python application, it is necessary to input the damage depth \(a\), the coordinates \(x_{k}/L\), and the associated deflections \(P_{k}(a,x_{k})\) for the damaged beam \(P_{u}\). After the input values are introduced, the algorithm determines the theoretical deflection obtained for the free end, when the crack is located at the fixed end. It is recommended that the chosen points are not too close.  
If the crack is an open one, as shown in Figure 4, in addition to the crack depth it is necessary to indicate the crack width \(w\). This value is set to 0 by default in the application, indicating a closed crack. The input value for \(w\) should not exceed 5 mm, otherwise another damaged beam model is applicable [33; 34].