# Gaslike Social Motility: Optimization Algorithm with Application in Image Thresholding Segmentation
## 2 The Proposed Gaslike Social Motility (GSM) Algorithm
### Gaslike Social Motility Behavior: Inspiration and Application  
In [19], each particle \(i\) interacts within a bounded, time-varying neighborhood defined by the proximity and affinity between the gas particle \(i\) and its surrounding particles. These interactions determine whether a particle \(i\) forms groups with its neighbors or moves away from them. The behavior of each particle is governed by the following dynamic rules:  
\[x_{t+1}^{i}=(1-\epsilon)f(x_{t}^{j})+\frac{\epsilon}{|\eta_{t}^{i}|}\sum_{j\in \eta_{t}^{i}}f(x_{t}^{j}), \tag{1}\]  
\[r_{t+1}^{i}=r_{t}^{i}+\gamma\left(\sum_{j\in\eta_{t}^{i}}\frac{r_{t}^{j}-r_{t} ^{i}}{|r_{t}^{j}-r_{t}^{i}|}\right)\left(x_{t+1}^{i}\sum_{j\in\eta_{t}^{i}}x_{ t+1}^{j}\right). \tag{2}\]  
Here, \(x_{t}^{j}\) denotes the feature (state or mood) of the \(i\)-th particle at the time step \(t\), where \(i\) ranges from \(1\) to \(N\), the total number of particles. The position vector \(\mathbf{r}_{t}^{i}\) lies in a \(d\)-dimensional space, and the neighborhood of each particle is defined as \(\eta_{t}^{i}=\{j:|\mathbf{r}_{t}^{i}-\mathbf{r}_{t}^{i}|\leq R\}\), with \(|\eta_{t}^{i}|\) representing its cardinality. The parameter \(\gamma\) controls the coupling strength, determining how quickly a particle \(\mathbf{r}_{t}^{i}\) adjusts its position to approach or retreat from others. The constant \(R\) defines the interaction radius for each particle, while \(\epsilon\) represents the bounded coupling strength within the range \(0\leq\epsilon\leq 1\).  
The state of the particle \(x_{t}^{i}\) is influenced not only by its own mood but also by the moods of its neighboring particles. The parameter \(\epsilon\) determines the extent of this influence: a higher value of \(\epsilon\) increases the contribution from neighbors, while a lower value diminishes it. This dynamic models a highly relevant social interaction mechanism, making it particularly suitable for application in metaheuristic algorithms.  
In Equation (1), the function \(f(x)\) governs the internal behavior of each particle and is applied across the entire network. The dynamics are coupled through a weighted sum of the influences exerted by the neighboring particles of the particle \(i\). In this work, a network is defined as the set of relationships or connections that particles establish with their neighbors within their environment.  
From Equation (2), it is clear that the particle \(i\) evaluates its environment globally before deciding whether to stay close to or move away from its neighbors. This decision is primarily determined by the two factors on the right-hand side of (2). The movement, which can be either inward or outward, is driven by the term \(x_{t+1}^{i}\sum_{j\in\eta_{i}^{i}}x_{t+1}^{j}\). Here, particles exchange information about their \"affinity\" with their neighboring group, reflecting the similarity of their characteristics at time \(t+1\). The direction of movement is influenced by the first factor in the equation, which assesses the angular distribution of neighbors relative to the particle \(i\). Greater asymmetry in the angular distribution of neighbors results in a larger displacement magnitude for \(i\).