## 3 Solution Methodology  
### Gravity Algorithm  
The gravity algorithm regards the optimal solution set as a space, and the single solution in the solution set is the scattered particles in this space [36]. These particles are attracted by each other and produce an aggregation effect. The cleverness of this algorithm lies in the correlation between the fitness of the solution and the gravity of the object [37]. Additionally, the particle with the lower gravity is attracted to the particle with the higher gravity. In the end, the space appears to be the result of the particles being clustered in an optimal position.  
Assume that the total number of particles in the gravitational space is \(N\), and the position of the \(i\)th particle is defined as:  
\[X_{i}=\left(x_{i}^{1},x_{i}^{2},\cdots,x_{i}^{N}\right),\ i=1,\ 2,\...,\ N \tag{15}\]  
where \(x_{i}^{d}\) represents the position of particle \(i\) in the \(d\) dimension.  
Because of gravity, the particles move with varying accelerations, thus renewing their positions. The particle position update formula is as follows:  
\[v_{i}^{d}(t+1)=rand\cdot v_{i}^{d}(t)+a_{i}^{d}(t) \tag{16}\]  
\[x_{i}^{d}(t+1)=x_{i}^{d}(t)+v_{i}^{d}(t+1) \tag{17}\]  
\[a_{i}^{d}=\frac{F_{i}^{d}(t)}{M_{ii}(t)} \tag{18}\]  
where \(F_{i}^{d}\) represents the sum of the attractive forces on particle \(i\) in the \(d\) dimension; \(a_{i}^{d}(t)\) represents the \(d\) dimensional acceleration of particle \(i\) at time \(t\); \(M_{ii}(t)\) represents the inertia of particle \(i\), and it is proportional to the mass of particles.  
In the simplified model, the particle inertial mass can be expressed by the fitness value of the particle solution. The larger the fitness value is, the larger the inertia mass of the particle is, and the smaller the motion acceleration of the particle is, the more stable the particle position is. The specific formula of particle mass expressed by the solution fitness value is as follows:  
\[m_{i}(t)=\frac{fit_{i}(t)-worst(t)}{best(t)-worst(t)} \tag{19}\]  
where \(fit_{i}\) represents the fitness value of the particle solution; \(worst(t)\) represents the minimum fitness value of the solution set, representing the worst particle; \(best(t)\) represents the maximum fitness of the solution set, representing the optimal particle.  
The inertia value of the particle can be obtained from the particle mass:  
\[M_{ii}(t)=\frac{m_{i}(t)}{\sum\limits_{j=1}^{N}m_{j}(t)} \tag{20}\]  
According to the law of universal gravitation, the attraction of a particle is proportional to its own gravity and the gravity of other particles. Therefore, the core formula of GSA algorithm--namely, the particle gravity formula--can be obtained:  
\[F_{i}^{d}(t)=\sum\limits_{j=1,j\
eq i}^{N}rand\cdot F_{ij}^{d} \tag{21}\]  
\[F_{ij}^{d}(t)=G(t)\cdot\frac{M_{pt}(t)\times M_{uj}(t)}{R_{ij}(t)+\varepsilon} \cdot\left(x_{j}^{d}(t)-x_{i}^{d}(t)\right) \tag{22}\]  
\[G(t)=G_{0}\times e^{-\alpha\frac{t}{T}} \tag{23}\]  
\[R_{ij}(t)=\left\|X_{i}(t),X_{j}(t)\right\| \tag{24}\]  
where \(F_{ij}^{d}\) represents the attraction of particle \(i\) attracted by particle \(j\) in the \(d\) dimension space; \(G(t)\) represents gravity constant, which is the correction constant used to calculate the gravity of particles. Its value decreases with time, indicating that particles tend to be stable; \(G_{0}\) represents initial gravitational constant; \(T\) represents time constant, which refers to the maximum number of iterations in the algorithm; \(R_{ij}(t)\) represents the distance of particle \(i\) and \(j\) at time \(t\); \(\alpha,\varepsilon\) represents the correction constant.