# GA-PSO Algorithm for Microseismic Source Location
## 2 Materials and Methods
### Implementation of GA-PSO Algorithm
Different magnitudes of adjustment are provided in each iteration stage through the nonlinear variation of the sinusoidal function, and this nonlinear dynamic variation is able to adapt to the different stages of the search process more efficiently than the traditional fixed-value learning factor. The dynamic learning factor is defined by the following formula:  
\[c_{1}(t)=2\cdot\left(sin((\pi/2)\cdot(1-t/T))\right)^{2} \tag{7}\]  
\[c_{2}(t)=2\cdot\left(sin((\pi t/2)\cdot T)\right)^{2} \tag{8}\]  
Here, \(t\) represents the current iteration number and \(T\) denotes the maximum iteration number. The function \(c_{1}(t)\) is approximately 2 in the early stages of iteration \((t\to 0)\), emphasizing the particle's reliance on its own historical best, thereby promoting global exploration. As the iteration progresses, \(c_{1}(t)\) gradually decreases, reducing the reliance on individual experience and preventing excessive dispersion. Initially \((t\to 0)\), \(c_{2}(t)\) is close to 0, reducing the influence of the global best and preventing premature convergence; in later stages \((t\to T)\), \(c_{2}(t)\) approaches 2, strengthening collective cooperation and facilitating local exploitation. Both \(c_{1}(t)\) and \(c_{2}(t)\) remain within the range of \([0,2]\), consistent with the empirical bounds of classical PSO learning factors (typically \(c_{1}+c_{2}\ \leq\ 4\)), ensuring the algorithm's stability. The inertia weight functions to adjust the update of particle velocity. When the inertia weight is relatively large, the particle retains more of its historical motion trend during the velocity update process, resulting in a wider search range. Conversely, when the inertia weight is relatively small, the particle tends to search around the current optimal position,thereby accelerating the convergence speed. The adaptive inertia weight is computed using the following equation [35]:  
\[w=w_{max}-(w_{max}-w_{min})\cdot(i/T)^{2} \tag{9}\]  
where \(i\) is the current iteration number and \(T\) is the maximum iteration number. This enhancement enables the algorithm to focus on extensive global search during the initial phase and local search in the latter phase. Additionally, integrating the improved PSO with the GA increases solution diversity through cross-mutations, thereby allowing the algorithm to adaptively adjust its search strategy across different stages. The algorithm process is shown in Figure 1.  
The steps for the implementation of the GA-PSO algorithm are as follows:  
(1) Initialize GA and PSO parameters: Since real-valued encoding outperforms binary encoding in solving optimization problems [36], real-valued encoding is utilized for the chromosomes in the present study. Set the chromosome length to 3, denoting the three spatial coordinates of the microseismic source, the value range of the three coordinate axes is determined by the size of the model space. Set crossover probability to 0.8, mutation probability to 0.2, maximum iterations to 100, and population size to 20. Set \(w_{max}=0.8\), \(w_{min}=0.4\). Define limits for particle velocities and positions. Figure 1: GA-PSO algorithm flowchart. The number of iterations depends on the problem's complexity, convergence speed, and optimization objectives. Under the experimental conditions of this study, the GA-PSO algorithm achieves stability within 100 iterations. Setting the maximum number of iterations to 100 ensures convergence while minimizing unnecessary computational overhead. A typical population size ranges from 20 to 50 [37]. Given the moderate complexity of the objective function in this study, a population size of 20 is sufficient to ensure an effective search while minimizing computational waste associated with larger population sizes. (2) Generate the initial particle population by creating a two-dimensional array of shape (popsize, lenchrom). The array values are randomly drawn from a uniform distribution within \([pop_{min},\ pop_{max}]\), with velocity \(V\) randomly generated within \([V_{min},\ V_{max}]\).