## 4 Proposed Methodology
### Hosting Capacity Evaluation (Optimal Location and Sizing) by HHO Algorithm  
In formulating the distributed generator (DG) hosting capacity problem, the factors of optimal size and placement of DG are considered. Currently, this problem is represented as an optimization model using the Harris hawks optimization HHO algorithm. A novel population-based optimization method termed the HHO was proposed by the study of [30]. HHO's mathematical model imitates the way Harris hawks hunt (large, lanky rators with relatively long tails and long legs). To startle its prey, frequently a rabbit, a group of hawks may jump on it from various angles. One hawk is leading the attack and is encircling the target. Depending on the hunting environment and the rabbit's capacity to flee, the hawks can modify their hunting strategies. The three phases of exploration (investigation), the transition from exploration to exploitation, and the globalization of search are what the Harris hawks rely on algorithmically when they hunt (exploitation). The hawks search the area throughout their investigation phase using their keen vision to look for bunnies. They wait to spot a rabbit by randomly perching in high locations along the path. The hawks have two methods of assault when they spot a rabbit. The first tactic relies on all the hawks working together to stun the rabbit. In contrast, the second relies on letting the hawks' leader decide whether to attack the rabbit based on the rabbit's capacity to flee and his or her judgment. The hawks can sit based on the locations of the neighboring hawks to ensure a coordinated attack, as described in Equation (8), if an equal chance (**q**) is taken into account for each method, with the proviso that (**q** < 0.5). Alternatively, the hawks sit in random locations with the proviso (**q** \(\geq\) 0.5). \[H(\text{it}+1)=\{ \begin{matrix}\text{H}_{\text{rand}}(\text{it})-\beta\;|\;\text {H}_{\text{rand}}(\text{it})-2\tau\text{H}(\text{it})\;|&\text{q}\geq 0.5.\\ \text{H}_{\text{Best}}(\text{it})-(\frac{1}{\text{M}}\sum_{i=1}^{\text{M}} \text{H}_{i}(\text{it}))-\varphi(\text{LB}+\gamma(\text{UB}-\text{LB}))&\text{ q}<0.5.\end{matrix}  \tag{8}\]  
\(\boldsymbol{H}(\boldsymbol{it})\) denotes the hawks' location vector at iteration it, and \(\boldsymbol{H}(\boldsymbol{it}+1)\) denotes the hawks' location vector at iteration \(\boldsymbol{it}+1\), \(\boldsymbol{H}_{\text{rand}}(\boldsymbol{it})\) indicates a hawk taken at random from the current population, \(\boldsymbol{H}_{\text{Best}}(\boldsymbol{it})\) indicates the position of prey (rabbit), (\(\boldsymbol{M}\)) indicates the number of hawks overall, (\(\boldsymbol{LB}\)) and (\(\boldsymbol{LIB}\)) indicates the boundaries of variables' upper and lower limits, and (\(\beta\)), (\(\tau\)), (\(\varphi\)), (\(\gamma\)), and (\(\boldsymbol{q}\)) are randomly generated numbers between (0,1). Furthermore, by employing the rabbit escaping energy (**E**), which may be defined as in Equation (9), HHO can move from the exploration to the exploitation phase. \[E=2E_{O}\bigg{(}1-\frac{it}{it_{max}}\bigg{)}. \tag{9}\]  
where \(\boldsymbol{E_{O}}\) is the initial random energy generated by the rabbit in the interval (\(-\)1,1) at each iteration, and \(\boldsymbol{it}_{max}\) is the maximum number of repetitions. The rabbit's fleeing energy and probability of escape, denoted as \(\boldsymbol{r}\), have been used to describe the HHO exploitation process. A successful escape is defined as one where \(\boldsymbol{r}\) is less than 0.5, and an unsuccessful escape as one where \(\boldsymbol{r}\) is equal to or larger than 0.5. [PERSON]'s hawk hunting method for rabbits consists of four strategies: soft trapping, complex trapping, soft trapping with a rapid gradual dive, and complex trapping with a rapid gradual dive. The rabbit attempts to become free in the soft trapping at \(\boldsymbol{r}\geq\) 0.5 and \(|\boldsymbol{E}|\geq\) 0.5 by making erratic, deceptive hops, but ultimately fails.