## 3 Numerical Results
### Comparison of the Q-Learning-Based and PSO-Based GMPPT Methods  
The time required for convergence, the number of search steps performed during the GMPPT process until the P&O process starts its execution and the MPPT efficiency were calculated for each shading pattern for both the Q-learning-based and PSO-based GMPPT algorithms. The execution of the P&O MPPT process was not included in this analysis. The corresponding results are presented in Tables 5 and 6, respectively. The MPPT efficiency is defined as follows:  
\[n=\frac{P_{PV}}{P_{GMPP}} \tag{10}\]  
where \(P_{PV}(\text{W})\) is the PV array output power after convergence of the Q-learning-based, or the PSO-based GMPPT method, respectively and \(P_{GMPP}(\text{W})\) is the GMPP power of the PV array for the solar irradiance conditions (i.e., shading pattern) under study. Figure 17: Results during execution of the PSO-based GMPPT process for shading pattern 1: (a) duty cycle versus time and (b) PV array output power versus time. Figure 18: Results during execution of the PSO-based GMPPT process for shading pattern 9: (a) duty cycle versus time and (b) PV array output power versus time. The results presented in Table 5 indicate that the knowledge acquired initially by the Q-learning agent during the learning process performed when executing the proposed GMPPT algorithm for shading pattern 1 does not affect the number of search steps required when applying shading patterns 2 and 3, respectively. After the learning process of shading patterns 1-3 has been accomplished, the agent needs less time in order to detect the GMPP location for shading pattern 4, which was unknown till that time, with an MPPT efficiency of 99.7%. At that stage, the agent knows how to react when the unknown shading patterns 5-7 are applied, which further reduces significantly the number of search steps required to converge close to the GMPP. Finally, after the execution of the proposed GMPPT algorithm for shading patterns 1-7, the agent needed only 12 and 4 search steps, respectively, when shading patterns 8 and 9 were applied, which were also unknown till that time, and simultaneously achieved an MPPT efficiency of 99.3%-99.6%. Therefore, it is clear that the training of the agent was successful and the subsequent application of the P&O MPPT process is necessary only for compensation of the short-term changes of the GMPP position without re-execution of the entire Q-learning-based GMPPT process. As demonstrated in Table 6, the PSO-based GMPPT algorithm needs 11.3-11.6 sec in order to detect the position of the GMPP for each shading pattern, with an MPPT efficiency of 99.6%-99.9%. This is due to the fact that each time that the shading pattern changes, the positions of the particles comprising the swarm are re-initialized and any prior knowledge that was acquired about the location of the GMPP is lost. In contrast, due to its learning capability, the proposed Q-learning-based GMPPT algorithm reduced the convergence time when shading patterns 5-9 were applied by 80.5%-98.3%, compared to the convergence time required by the PSO-based GMPPT process to detect the GMPP with a similar MPPT efficiency. The MPPT efficiency achieved by the proposed Q-learning-based GMPPT algorithm was lower than that of the PSO-based algorithm by 1.3% when shading pattern 1 was applied, since the learning process was still in evolution. However, the application of a few additional shading patterns (i.e., shading