## 3 Optimization Algorithms
### The GWO Algorithm
The parameter \"\(a\)\" used in this algorithm decreases linearly in the interval [2,0] for the successive iterations using Equation (15). Thus, it will model the behavior of the wolves when approaching the victim (exploration phase). For this phase, if the condition \(\mid A\mid<1\) is verified, the wolves attack the victim. The alpha group are said to have the best possible knowledge of the location of prey. Once the position of the prey is determined, the hunt will be guided by the alpha group followed by the beta and delta wolves. The latter two groups participate in the hunt occasionally. The rest of the group is limited to take care of the injured wolves of the pack. When the prey stops moving, the wolves attack and finish the hunt [43]. The flowchart of this algorithm is illustrated in Figure 7.  
C. The PSO and GWO MPPT controllers  
To apply the previous evolutionary algorithms, we need to define the functions and parameters for the proposed problem. The objective is to maximize the energy extraction from the PV cells installed on EVs, even when there are shadowing areas involved in the scenario to consider. For the PSO algorithm, the function to optimize is expressed in Equation (17). \[\max(Ppv)=f\Big{(}x_{i,j}^{t},\ v_{i,j}^{t+1}\ \Big{)} \tag{17}\]  
In the GWO, each wolf position corresponds to the duty cycle factor applied on the MPPT. Thus, the \(Gmax\) represents the global best position of all of the wolves and \(Pmax\) is the corresponding best position of the corresponding wolf. If no partial shading exists, the global best wolf best position and the local wolf best position will be the same. However, for the partial shading case, there is several (\(Pmax\)) wolf best positions, and the global best position (\(Gmax\)) will be related to the max of the best wolf position \(Gmax=max\) (\(Pmax\)). Figure 7: PSO and GWO algorithms flowchart. The proposed GWO algorithm aims to compensate for the limitations of conventional maximization algorithms, which cannot find the overall maximum, especially during a partial shading phenomenon. Regardless of the partial shading profile, this algorithm can find the maximum power point on the power-voltage characteristic of a photovoltaic system. Towards this goal, the objective function for this algorithm is defined as it is in Equation (18). \[\max(Ppv)=f(\alpha,\ \beta,\ \Delta,\omega) \tag{18}\]  
The proposed MPPT algorithm is based on the application of GWO to control the duty cycle. The expected consequence is that this will turn into decreasing the steady-state oscillations presented by the conventional MPP tracking algorithms. Consequently, the power loss due to oscillation is reduced, which increases the photovoltaic system efficiency. For the implementation of GWO MPPT algorithm, duty cycle \(d\) is defined as a grey wolf. Therefore, the Equation (14) can be rewritten as follows:  
\[d_{i}(k+1)=d_{i}(k)-A.d \tag{19}\]  
The fitness function of the GWO algorithm is formulated to have the objective of function 20. It is for the two optimization algorithms. \[P\left(d_{j}^{k}\right)>P\left(d_{j}^{k-1}\right) \tag{20}\]  
where P represents the PV power, \(d\) is the duty cycle of the boost converter, \(j\) is the current grey wolves number, and \(k\) is the iteration number. The flowchart and the parameters of the PSO and GWO MPPT algorithms are detailed in Figure 7 and Table 3, respectively. The choice of these parameters was fixed after several online simulation tests, where the goal is to find the best combination in terms of the algorithm running speed and the best performances. Specifically, we have varied the number of particles/wolves and the maximum number of iterations. The first test had the configuration of 150 iterations and 10 particles. The corresponding simulation time was evaluated to 30 min when using an I5 laptop with 8-GB as RAM memory. The resulting performances were found perfect.