## 4 GWO Algorithm Based on the Dynamic Adjustment of the Proportional Weight and Convergence Factor
### Improved GWO Algorithm
\begin{array}{l}w_{1}=\frac{\overset{\rightarrow}{(A_{1}\cdot \overrightarrow{K_{1}})^{2}}\overset{\rightarrow}{(X_{1})^{2}}}{\overset{ \rightarrow}{(X_{1})^{2}}+\overset{\rightarrow}{(X_{1})^{2}}+\overset{ \rightarrow}{(X_{1})^{2}}}\cdot\frac{1}{t_{\text{max}}}\\ w_{2}=\frac{\overset{\rightarrow}{(A_{2}\cdot\overrightarrow{K_{2}})^{2}} \overset{\rightarrow}{(X_{2})^{2}}}{\overset{\rightarrow}{(X_{1})^{2}}+ \overset{\rightarrow}{(X_{1})^{2}}+\overset{\rightarrow}{(X_{1})^{2}}}\cdot \frac{1}{t_{\text{max}}}\\ w_{3}=\frac{\overset{\rightarrow}{(A_{3}\cdot\overrightarrow{K_{3}})^{2}} \overset{\rightarrow}{(X_{3})^{2}}}{\overset{\rightarrow}{(X_{1})^{2}}+ \overset{\rightarrow}{(X_{1})^{2}}+\overset{\rightarrow}{(X_{1})^{2}}+ \overset{\rightarrow}{(X_{1})^{2}}}\cdot\frac{1}{t_{\text{max}}}\\ \end{array} \right. \tag{20}\]  
\[\overset{\rightarrow}{X}(t+1)=\frac{(w_{1}X_{1}(\overset{\rightarrow}{t}+1) +w_{2}\overset{\rightarrow}{X_{2}}(t+1)+w_{3}\overset{\rightarrow}{X_{3}} (t+1))}{3}, \tag{21}\]  
where \(w_{1}\), \(w_{2}\), and \(w_{3}\) are proportional weight factors; \(\overset{\rightarrow}{A_{1}}\), \(\overset{\rightarrow}{A_{2}}\), and \(\overset{\rightarrow}{A_{3}}\) are convergence factors; and \(\overset{\rightarrow}{K_{1}}\), \(\overset{\rightarrow}{K_{2}}\), and \(\overset{\rightarrow}{K_{3}}\) are swing factors. The improved GWO algorithm was used to solve the dispatching model of the upper distribution network, and the lower micro energy grid in this study. The solving steps of the upper and lower models were similar. Therefore, the solving process for the dispatching model of the lower micro energy grid was used as an example. The solving steps were as follows:  
(1) Initialize the population  
\(N\) was the size of the grey wolf population, and \(n_{2}\) was the dimension of the grey wolf population (that is, the dimension of independent variables in the micro energy grid). The parameter \(t_{\text{max}}\) was the maximum number of iterations. The grey wolf population was randomly initialized between the upper and lower limits of the independent variables in the micro energy grid. (2) Calculate the fitness value for each grey wolf  
The fitness value of each grey wolf was calculated (that is, the integrated operating cost of the micro energy grid corresponding to the initial independent variables of each grey wolf). Then, the fitness values were compared. The optimal solution \(\overset{\rightarrow}{X_{\text{a}}}\), suboptimal solution \(\overset{\rightarrow}{X_{\text{g}}}\), and third-best solution \(\overset{\rightarrow}{X_{\text{g}}}\) of the initial independent variables of the grey wolves were determined. (3) Calculate the distance between the grey wolf and the prey (that is, approach the prey)  
When the grey wolves are hunting prey, they identify its position first. Then, they approach the prey. The formulas for this step were as follows:  
\[\overset{\rightarrow}{D}=\Big{|}\overset{\rightarrow}{K}\cdot\overset{ \rightarrow}{X_{\text{p}}}(t)-\overset{\rightarrow}{X}(t)\Big{|}. \tag{22}\]  
\[\overset{\rightarrow}{X}(t+1)=\overset{\rightarrow}{X_{\text{p}}}(t)- \overset{\rightarrow}{A}\cdot\overset{\rightarrow}{D}. \tag{23}\]  
\[\left\{ \begin{array}{c}\overset{\rightarrow}{K}=2\overset{\rightarrow}{ r_{1}}\\ \overset{\rightarrow}{a}=a_{\text{ini}}^{\rightarrow}-(a_{\text{ini}}^{ \rightarrow}-a_{\text{fin}}^{\rightarrow}+1)(\frac{t}{t_{\text{max}}})^{2} \\ \overset{\rightarrow}{A}=2\overset{\rightarrow}{a}\overset{\rightarrow}{r_{2}} -\overset{\rightarrow}{a}\end{array}