# XOR Binary Gravitational Search Algorithm with Repository: Industry 4.0 Applications
## 4 Theoretical Analysis of the Proposed XOR Binary Gravitational Algorithm with Repository
### Full Statistical Analysis of the Proposed Method  
To perform theoretical analysis of the proposed XOR BGSA, a single dimensional optimization problem is considered. The parameter \(k_{b}\) in this case is equal to 1. Hence, in this section, we have a single particle whose behavior is studied and one best particle in the repository. The acceleration term, velocity term and the probability of change in the case of single dimensional optimization problem is obtained as follows:  
\[a\left(t\right)=\frac{r_{j}G\left(t\right)\left(M_{rb}\left(x_{rb}\left(t \right)\oplus x\left(t\right)\right)\right)}{\left\|x_{rb}\left(t\right)-x \left(t\right)\right\|^{r_{p}}+\varepsilon} \tag{18}\]  
\[v\left(t+1\right)=p_{i}v\left(t\right)+a\left(t\right) \tag{19}\]  
\[P\left(v\left(t\right)\right)=0.5+0.5\text{tan}h\left(0.5v\left(t\right)\right) \tag{20}\]  
where \(a\left(t\right)\), \(v\left(t\right)\), \(P\left(v\right)\) are single dimensional vectors representing the acceleration, velocity and the probability of change corresponding to the studied particle. Furthermore, \(x\left(t\right)\) is the single dimensional vector representing the current position of studied particle and \(x_{rb}\) is its corresponding value in the best particle in the whole population and \(M_{rb}\) corresponds to the mass of the best particle in the repository. The minimum value of \(G\left(t\right)\) is equal to \(\alpha_{1}\). Two cases are investigated: the case when \(p_{i}=1\) and the case when \(0<p_{i}<\)1. Case I: \(p_{i}=1\)  
**Lemma 1**. : _If \(p_{i}=1\) and \(x=x_{rb}\), \(\forall\)t \(>0\) we have \(a(\text{t})\leq\)0 and \(v(t+1)\leq\)\(v(t)\)._  
Proof. : Considering (13), we have the following equation for the acceleration term \(a(t)\):  
\[a\left(t\right)=-r(t)G(t)M_{rb}D\leq 0 \tag{21}\]  
where \(D=\left\lfloor\frac{1}{\varepsilon}\right\rfloor\) is the dimension of the optimization algorithm. Consequently, considering (18), one obtains the following inequality:  
\[v(t+1)=v(t)-r(t)G(t)M_{rb}D\leq v(t) \tag{22}\]  
This implies that \(v_{t}\) is monotonically non-increasing function of time. **Lemma 2**. : _If \(p_{i}=1\) and \(x(t)=x_{rb}\) then \(\forall\overline{v}\), \(\exists\)T \(>0\) s.t. \(\forall\)t \(>\)T we have \(E\left[v(t)\right]<\overline{v}\)._  
Proof. : In the case when \(v(t_{0}-1)<\overline{v}\), since according to Lemma 1\(v(t)\) is monotonically non-increasing function of time, we have:  
\[v(t_{0})\leq v(t_{0}-1)<\overline{v} \tag{23}\]  
which means that \(\forall t_{0}<\) T Lemma 2 holds. However, in the case when \(\overline{v}\leq\)\(v(t_{0}-1)\), we have:  
\[E\left[v(T)\right]= v(t_{0}-1)+E\left[\sum_{t-1}^{T}\frac{r(t)G(t)M_{rb}\left(x_{rb} (t)\oplus x(t)\right)}{\left\|x_{b}\left(t\right)-x\left(t\right)\right\|^{r _{p}}+1/D}\right] \tag{24}\]  
Since \(x(t)=x_{rb}\), we have the following equation:  
\[E\left[v(T)\right]= v(t_{0}-1)+E\left[\sum_{t-1}^{T}-r(t)G(t)M_{rb}D\right] \tag{25}\]Considering the fact that \(\min G\left(t\right)=\alpha_{1}\), one obtains the following inequality:  
\[v(t_{0}-1)-E\left[\sum_{t-1}^{T}r\left(t\right)G\left(t\right)M_{rb}D\right] \leq v(t_{0}-1)-\alpha_{1}M_{rb}D\;E\left[\sum_{t_{0}-1}^{T}r(t)\right]\]  
To find the appropriate \(T\), the following inequality needs to hold. \[v(t_{0}-1)-\alpha_{1}M_{rb}D\;\left[\sum_{t_{0}-1}^{T}E[r\left(t\right)] \right]\leq\overline{v} \tag{26}\]  
Considering the fact that \(r\left(t\right)\) is a random variable uniformly distributed in \(\left[0,\,1\right]\), the following equation holds. \[v\left(t+1\right)=p_{i}v\left(t\right)+a\left(t\right) \tag{19}\]0  
By applying expected value of \(r\left(t\right)\) as in (27) to (26), the following equation is obtained. \[v\left(t+1\right)=p_{i}v\left(t\right)+a\left(t\right) \tag{19}\]1  
and finally T is obtained as follows:  
\[v\left(t+1\right)=p_{i}v\left(t\right)+a\left(t\right) \tag{19}\]2  
Since \(v(t-1)<\overline{v}\), \(\forall t_{0}>1\) from (29) we have \(0\leq\)T s.t. \(\forall t>\)T one obtains \(E\left[v(t)\right]<\overline{v}\). This concludes the proof.