# Random Exploration and Attraction of the Best in Swarm Intelligence Algorithms
## 5 REAB-Based Swarm Algorithms
### REAB Algorithms Derived from PSO  
Consider cognitive and social velocities in the PSO algorithm given by (20), that is  
\[\underbrace{k_{c}\cdot\rho_{1}\circ(\chi_{ihb}^{k}-\chi_{i}^{k})}_{\text{ cognitive vel.}}+\underbrace{k_{s}\cdot\rho_{1}\circ(\chi_{ihb}^{k}-\chi_{i}^{k})}_{\text{social vel.}} \tag{24}\]  
An example of a region where this vector may be is shown in Figure 5a. In Figure 5b, it is shown the region where the vector  
\[\underbrace{r_{k_{c}}\cdot(\chi_{ihb}^{k}-\chi_{i}^{k})}_{\text{ cognitive vel.}}+ \underbrace{r_{k_{s}}\cdot(\chi_{ihb}^{k}-\chi_{i}^{k})}_{\text{social vel.}} \tag{25}\]  
may be. It can be observed that like (24), expression (25) also provides a large region for space exploration and also captures the idea that an agent is attracted by its best historical position and by the best swarm historical position. In addition, only standard operations are required. Based on this observation, the following expression for the PSO algorithm is proposed. \[v_{i}^{k+1} =\underbrace{\omega\cdot v_{i}^{k}}_{\text{inertial vel.}}+ \underbrace{r_{k_{c}}\cdot(\chi_{ihb}^{k}-\chi_{i}^{k})}_{\text{cognitive vel.}}+ \underbrace{r_{k_{s}}\cdot(s_{hb}^{k}-\chi_{i}^{k})}_{\text{social vel.}} \tag{26a}\] \[\chi_{i}^{k+1} =\chi_{i}^{k}+v_{i}^{k+1} \tag{26b}\]  
Substituting (26a) in (26b) and making \(v_{i}^{k}=(\chi_{i}^{k}-\chi_{i}^{k-1})\), the next position can be written in terms of previous positions  
\[\chi_{i}^{k+1}=\chi_{i}^{k}+\underbrace{r_{\omega}\cdot(\chi_{i}^{k}-\chi_{i }^{k-1})}_{\text{inertial vel.}}+\underbrace{r_{k_{c}}\cdot(\chi_{ihb}^{k}-\chi _{i}^{k})}_{\text{cognitive vel.}}+\underbrace{r_{k_{c}}\cdot(s_{hb}^{k}-\chi_{i }^{k})}_{\text{social vel.}} \tag{27}\]Note that, like cognitive and social factors, the inertial factor is now also random: \(r_{\omega}\). The randomness of expression (27) can be increased by substituting \(s_{hb}^{k}\) with \(s_{ba}=s_{hb}^{k}+r_{\delta}\cdot u_{r}\); that is, substituting \(s_{hb}^{k}\), with a random point of its \(\delta\)-neighborhood. \(s_{ba}\) stands for _swarm best apparent_. This change could be justified by saying that an agent is not able to follow the leader exactly, but only to a certain extent. With this change, the algorithm (27) becomes  
\[s_{ba} =s_{hb}^{k}+r_{\delta}\cdot u_{r} \tag{28a}\] \[\chi_{i}^{k+1} =\chi_{i}^{k}+\underbrace{r_{\omega}\cdot(\chi_{i}^{k}-\chi_{i}^{ k-1})}_{\text{inertial vel.}}+\underbrace{r_{k_{c}}\cdot(\chi_{i_{bb}}^{k}-\chi_{i}^{k})}_{ \text{cognitive vel.}}+\underbrace{r_{k_{s}}\cdot(s_{ba}-\chi_{i}^{k})}_{\text{ social vel.}} \tag{28b}\]  
Instead of following one leader, an agent could follow more leaders. There are several ways to implement this idea; one of them is to take the average of all leaders, and then select a random point within a neighborhood of this average. With this change, each agent next position is given by  
\[s_{ba} =\left(\frac{1}{n_{l}}\sum_{j=1}^{n_{l}}s_{hb_{j}}^{k}\right)+r_{ \delta}\cdot u_{r} \tag{29a}\] \[\chi_{i}^{k+1} =\chi_{i}^{k}+\underbrace{r_{\omega}\cdot(\chi_{i}^{k}-\chi_{i}^ {k-1})}_{\text{inertial vel.}}+\underbrace{r_{k_{c}}\cdot(\chi_{i_{bb}}^{k}- \chi_{i}^{k})}_{\text{cognitive vel.}}+\underbrace{r_{k_{s}}\cdot(s_{ba}-\chi_{i}^ {k})}_{\text{social vel.}} \tag{29b}\]  
where \(n_{l}\) is the number of leaders and \(s_{hb_{j}}^{k}\) is the \(j\)-th best historical swarm position. Note that in (29), the radius \(\delta\) has to be specified. This radius can be changed during the algorithm execution. A reasonable decision is to make it large at the beginning and monotonously decrease it as the algorithm runs. Similarly, inertial \(\omega\), cognitive \(k_{c}\), and social factors \(k_{s}\) are not necessarily constants. In the beginning, the inertial factor can be large and cognitive and social factors be small to favor exploration; then inertia can be monotonously decreased and cognitive and social factors increased to favor attraction of the best. Since expressions (29) resemble REAB and were derived starting from the PSO, it can be called REAB-PSO.