## 4 The Proposed Hybrid PSOGSA Algorithm  
This manuscript has identified the supremacy of the hybrid PSOGSA algorithm compared to other algorithms such as PSO [30], GSA [31], MVO [32], SCA [33], HBO [34], and PO [35] techniques. Using the modified single-diode, the modified double-diode, and the modified three-diode identical models, these algorithms have been used to optimize the parameters of monocrystalline and polycrystalline PV cells.  
In general, the hybrid PSOGSA combines the exploitation ability of the PSO algorithm and the exploration ability of the GSA algorithm to obtain optimal results more effectively. This provides a better balance between the two algorithms for an optimal solution. [PERSON] and [PERSON] first introduced the hybrid PSOGSA algorithm [21]. The best solution achieved using the PSO algorithm is saved for further exploration in the GSA algorithm. The purpose of using the best solution is that GSA suffers from regression and exploitation delays in the initial iterations [38]. The PSOGSA has been shown to be effective enough to find the optimal solution compared to the PSO and GSA techniques. However, the primitive hybrid algorithm PSOGSA is a continuous algorithm that is not explicitly capable of solving binary problems. The flowchart of the hybrid PSOGSA algorithm is represented in Figure 5 and the steps are described below.  
**Step 1:** In this step, the acceleration and position of all the particles are first initialized.  
**Step 2:** According to Equation (11), the fitness values of all particles are found and updated for their constant gravity. In Equation (11), \(G_{t}\) and \(G_{o}\) stand for the gravitational constant of the universe at the moment \(t\) and \(t_{o}\), respectively. T stands for the maximum number of iterations.  
\[G_{t}=G_{o}\cdot e^{\frac{-\pi t}{T}} \tag{11}\]  
**Step 3:** In this step, the quality of the particle is obtained according to Equations (12)-(14). Using Equations (15)-(17), the acceleration of the particle is found. _Lit_ stands for the fitness value in Equations (14) and (15).  
\[n_{j}(t)=\frac{Lit_{j}(t)-worst(t)}{best(t)-worst(t)} \tag{12}\]  
\[N_{j}(t)=\frac{n_{j}(t)}{\sum_{N}n_{i}(t)} \tag{13}\]  
\[best(t)=max_{j=(1,2,...n)}Lit_{j}(t) \tag{14}\]  
\[worst(t)=min_{j=(1,2,...n)}Lit_{j}(t) \tag{15}\]  
\[F=G\left(M_{1}M_{2}/R\right) \tag{16}\]\[a=F/M \tag{17}\]  
Equation (16) obeys the law of gravity, and Equation (17) follows the law of motion. The maximum number of iterations is set to 1000 whereas the search agents are kept at 30 for all the algorithms.  
**Step 4:** In this step, the position and velocity of the particle are calculated, and updated according to the position and velocity in Equation (19).  
\[V_{di}(t+1)=\omega\cdot V_{di}(t)+M_{1}\cdot rand()\cdot(P_{di}-X_{di})+M_{2} \cdot rand()\cdot\left(P_{dg}-X_{di}\right) \tag{18}\]  
\[X_{di}\left(t+1\right)=V_{di}\left(t+1\right)+X_{di}\left(t\right) \tag{19}\]  
where \(M_{1}\) and \(M_{2}\) are two positive constants of acceleration; \(rand\) () is a uniform random number (0, 1); \(P_{di}\) and \(P_{dg}\) are the best positions so far found by the \(i\)th particle and all the particles, respectively; \(t\) is the iteration count; and \(\omega\) is an inertial weight that usually decreases linearly during the iterations. The weight of inertia is used to balance local and global searches [39].  
**Step 5:** This is the last step of the algorithm. If the system has met the criteria, then the output is optimum; otherwise go back to step 2.