# Analyzing Physics-Inspired Metaheuristic Algorithms in Feature Selection with K-Nearest-Neighbor
## 2 Methodology
### Physics-Inspired Metaphor Algorithms
#### 2.3.4 Atom Search Optimization  
Atom Search Optimization (ASO) [32], which is inspired by molecular dynamics, has shown a tremendous performance on a variety of applications in the literature. Each atom is considered a candidate solution, and the mass is mapped with the fitness in the optimization algorithm, where the higher the mass, the fitter the solution. Every atom in the population pulls or repels other atoms in the search space. The heavier atoms generate more force and pull lighter objects rapidly, and the heavier objects are pulled slowly towards the others due to their mass. The slowly moving atoms create exploitation in the algorithm, because they can search more locally, whereas the rapidly moving atoms allow the algorithm to explore the search space because of longer and quicker jumps. The algorithm starts with random initializations. In every iteration, the atoms move and accelerate, and the location of the atom that has performed the best up to that point is also likewise adjusted. Atomic acceleration is also caused by two other factors: L-J potential and constraint forces. The acceleration helps to update the velocity of the solutions (atoms). Finally, the velocity is added to the previous position to update the current position of the solution. The position-updating mechanism of the algorithm is discussed below.  
The population is generated by randomly generating position and velocity vectors for each atom in the population.  
\[X_{i}=\left[X_{i}^{1},\ X_{i}^{2},\ \ldots,\ X_{i}^{D}\right] \tag{12}\]  
\[V_{i}=\left[V_{i}^{1},\ V_{i}^{2},\ \ldots,\ V_{i}^{D}\right] \tag{13}\]  
The fitness of each solution in the population is computed, and the global best \(X_{best}\) is determined.  
The mass of each atom is computed using the following equation:  
\[m_{i}=\frac{M_{i}}{\sum_{j=1}^{N}M_{j}} \tag{14}\]  
where \(M\) is computed from the fitness of the current solution, the best solution, and the worst solution.  
The value of \(K\) is computed, where \(K\) denotes the size of the subset of atoms:  
\[K=N-(N-2)\sqrt{\frac{t}{T}} \tag{15}\]  
where \(N\) is the size of the population.  
The interaction force on an atom is calculated, which is accomplished using the following equation:  
\[F_{i}^{d}=\sum_{j\in K}rand_{j}F_{ij}^{d} \tag{16}\]  
where \(rand_{j}\) is a random number in the range of \([0,1]\).  
The constraint force is computed using the following equation:  
\[G_{i}^{d}=\lambda\ \left(X_{best}^{d}-X_{i}^{d}\right) \tag{17}\]  
where \(\lambda\) is the Langrangian multiplier that is computed as follows:  
\[\lambda=\beta\ e_{T}^{-20t} \tag{18}\]  
where \(\beta\) is the multiplier weight.  
Once the mass, constraint forces, and interaction forces are computed, the acceleration is computed as follows:  
\[a_{i}^{d}=\frac{F_{i}^{d}}{m_{i}^{d}}+\frac{G_{i}^{d}}{m_{i}^{d}} \tag{19}\]  
Once the acceleration is computed, the velocity of an atom can be computed as follows:  
\[V_{i}^{d}(t+1)=r_{1}V_{i}^{d}(t)+a_{i}^{d}(t) \tag{20}\]  
Using the updated velocity, the position of a solution is updated as follows:  
\[X_{i}^{d}(t+1)=X_{i}^{d}(t)+V_{i}^{d}(t+1) \tag{21}\]