# A Stigmergy-Based Differential Evolution
## 3 Stigmergic Differential Evolution
### The Proposal-Action, Agent, Medium, Trace and Coordination  
As in other bioinspired algorithms, in Stigmergic Differential Evolution, we do not try to precisely copy every aspect of the stigmergy concept but only to use it as an inspiration source. Let us consider a stigmergy process [51; 52]: the nesting construction/repairing made by termites. This process is parallel, it needs only local information and it has no apparent global leadership. By considering Figure 1, for a single stigmergic loop, it happens that individual, (previously stimulated by \(\text{trace}_{i}\) or other traces) produces an action, that leaves a \(\text{trace}_{i}\) which probabilistically stimulates either individual, or near individuals. We also consider that, as in the case of real termites, only a few individuals can share a physical space (Figure 2), and only one of them could leave a trace/mark in the medium at a time. Many termites work in the nest, then, they complete the previous steps in parallel, and they repeat the stigmergic cycle until the mound is complete and functional [37]. As in other metaheuristics, Stigmergic DE considers a population of candidate solutions as the agents, while evaluating the candidate solutions represents the traces. Like its real counterpart, the stigmergic approach considers that few candidate solutions can share consecutive memory spaces with one another. For example, in Table 2, candidate solutions \(\mathbf{x}_{i-1},\mathbf{x}_{i}\) and \(\mathbf{x}_{i+1}\), and their respective fitness function evaluations, are neighbors, as they share consecutive locations in memory. As in other algorithms, Equation (1) serves to initialize the population of candidate solutions in SDE. Prior to the action step, we compare the traces of the actual with the next and the previous individuals in the memory:  
\[\mathbf{x}_{lead}^{k}=argmin\Big{(}f\Big{(}\mathbf{x}_{i-1}^{k}\Big{)},f\Big{(}\mathbf{x }_{i}^{k}\Big{)},f\Big{(}\mathbf{x}_{i+1}^{k}\Big{)}\Big{)} \tag{5}\]  
for \(i=2,\ldots,N_{p-1}\); the original index of \(\mathbf{x}_{lead}^{k}\) is also stored, e.g., \(lead=i-1\), \(lead=i\), or \(lead=i+1\). The remaining two candidate solutions after applying Equation (5) are randomly labeled, with 50% probability, as \(\mathbf{x}_{work1}^{k}\) and \(\mathbf{x}_{work2}^{k}\); also, their respective indexes are stored. The action step considers the mutation DE operator with the differential weight \(F\): \begin{table}
\begin{tabular}{c c} \hline \hline
**Agent** & **Trace** \\ \hline \(x_{1}\) & \(f(\mathbf{x}_{1})\) \\ \(\cdots\) & \(\cdots\) \\ \(x_{i-1}\) & \(f(\mathbf{x}_{i-1})\) \\ \(\mathbf{x}_{i}\) & \(f(\mathbf{x}_{i})\) \\ \(\mathbf{x}_{i+1}\) & \(f(\mathbf{x}_{i+1})\) \\ \(\cdots\) & \(\cdots\) \\ \(\mathbf{x}_{Np}\) & \(f(\mathbf{x}_{Np})\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Population and fitness arrangement in SDE. Figure 2: Termites sharing a working area. \[\mathbf{v}_{i}^{k}=\mathbf{x}_{lead}^{k}+F\cdot\left(\mathbf{x}_{work1}^{k}-\mathbf{x}_{work2}^{k}\right) \tag{6}\]  
together with the original trial DE operator using the crossover rate \(C_{r}\) :  
\[u_{ij}^{k}= \begin{cases}\mathbf{v}_{ij}^{k}&if\ rand()<C_{r}\ orj=j_{rand}\\ \mathbf{x}_{ij}^{k}&otherwise\end{cases}  \tag{7}\]  
After the trial vector is complete, the next phase of stigmergic DE is the trace update:  
\[\mathbf{x}_{lead}^{k+1}= \begin{cases}\mathbf{u}_{i}^{k}&if\ f\left(\mathbf{u}_{i}^{k} \right)<f\left(\mathbf{x}_{lead}^{k}\right)\\ \mathbf{x}_{lead}^{k}&otherwise\end{cases}  \tag{8}\]  
\[\mathbf{x}_{work1}^{k+1}= \begin{cases}\mathbf{u}_{i}^{k}&if\ f\left(\mathbf{u}_{i}^{k} \right)<f\left(\mathbf{x}_{work1}^{k}\right)\\ \mathbf{x}_{work1}^{k}&otherwise\end{cases}  \tag{9}\]  
\[\mathbf{x}_{work2}^{k+1}= \begin{cases}\mathbf{u}_{i}^{k}&if\ f\left(\mathbf{u}_{i}^{k} \right)<f\left(\mathbf{x}_{work2}^{k}\right)\\ \mathbf{x}_{work2}^{k}&otherwise\end{cases}