# Comparison of Heuristic Algorithms in Discrete Search and Surveillance Tasks Using Aerial Swarms
## 3 Proposed Search Algorithm, a Set of Behaviors: A1
### Keep Distance Behavior  
Imitating several animal species in nature, such as bird flocks, fish schools and ungulate herds, this behavior is proposed. Each agent tries to keep a stable distance with the surrounding agents, by means of the result of attractive and repulsive forces. These are normally implemented similarly to the attractive-repulsive forces presented in the molecules' interactions. The total force over an agent \(i\) due to the presence of an agent \(j\) is made up of two forces:  
\[\mathbf{F}_{ij}^{\;i}=\mathbf{F}_{aj}^{\;i}+\mathbf{F}_{ij}^{\;i}=\left(\frac{ A_{a}}{|\mathbf{d}_{j}^{i}|^{m_{a}}}-\frac{A_{r}}{|\mathbf{d}_{j}^{i}|^{m_{r}}} \right)\frac{\mathbf{d}_{j}^{i}}{|\mathbf{d}_{j}^{i}|} \tag{32}\]  
where \(\mathbf{F}_{aj}^{\;i}\) is the attractive force, \(\mathbf{F}_{ij}^{\;i}\) is the repulsive force and \(\mathbf{d}_{j}^{i}\) is the vector from the position of agent \(i\) to the position of agent \(j\), \(\mathbf{d}_{j}^{i}=\mathbf{r}_{j}-\mathbf{r}_{i}\). \(A_{a}>0\), \(A_{r}>0\) and \(m_{r}>m_{a}>0\) are parameters to be set. Since the configuration is expected to be valid no matter how many agents are carrying out the task or the size of the search area, it is convenient to adimensionalize the distance \(\mathbf{d}_{j}^{i}\). There are two candidates for this purpose, the footprint radius:  
\[d_{c_{1}}=R_{f} \tag{33}\]  
and a distance representing the size of the search area:  
\[d_{c_{2}}=\sqrt{L_{x}^{2}+L_{y}^{2}} \tag{34}\]  
Figure 5: In (**a**), energy costs considered in the energy saving behavior. The arrow indicates the current flight direction. In the upper left corner of each search cell, the cell number has been indicated. In (**b**) collision avoidance costs. Agent 2 is already heading to a cell, so that traveling to that one would imply a cost of \(-10^{9}\) for the agent. In Figure (**c**), an example of the keep distance behavior has been represented; Agents 2 and 3 apply a total force \(F_{T}^{1}=1\), being \(\psi_{F}=\pi/4\), over the agent. The incomes \(I_{D_{x}}\) have been calculated using Equation (42). In (**d**), an example of income due to the keep velocity behavior is; see Equation (47). In this example, \(V_{T}^{1}=1\) m/s. If one takes the first option, the keep distance behavior will be related to the covered area at each moment, and it will lead the agents to behave more as a flock. On the other hand, if the second option is chosen, the agents will tend to cover bigger zones, spreading out themselves across the search area. In order to let the optimization choose any combination of these characteristic distances, a weighted distance is considered:  
\[d_{c}=\beta_{d}d_{c_{1}}+(1-\beta_{d})d_{c_{2}} \tag{35}\]  
where \(\beta_{d}\) is a coefficient to be chosen. The adimensionalized distance \(\mathbf{\tilde{d}}_{j}^{i}\) is then obtained by:  
\[\mathbf{\tilde{d}}_{j}^{i}=\frac{\mathbf{d}_{j}^{i}}{d_{c}} \tag{36}\]  
Making \(\mathbf{F}_{ij}^{i}=0\) in Equation (32), we get the equilibrium distance, whereas differentiating that equation and equaling it to zero, we get the distance at which the attractive force is maximum:  
\[\tilde{d}_{0} =\left(\frac{A_{r}}{A_{a}}\right)^{\frac{1}{n_{r}-n_{a}}} \tag{37a}\] \[\tilde{d}_{max} =\left(\frac{A_{r}m_{r}}{A_{a}m_{a}}\right)^{\frac{1}{n_{r}-n_{ a}}} \tag{37b}\]  
where \(\tilde{d}_{max}>\tilde{d}_{0}\). To reduce the number of parameters, we consider, as well:  
\[m_{r}=m_{a}+1 \tag{38}\]  
so that Equation (37a) becomes:  
\[\tilde{d}_{0}=\frac{A_{r}}{A_{a}} \tag{39}\]  
With this assumption, we finally get the relationship:  
\[d_{c_{1}}=R_{f} \tag{33}\]0 \[d_{c_{1}}=R_{f} \tag{33}\]1  
Again, since this behavior will be multiplied by a coefficient, the actual value of the total force is irrelevant, and therefore, we can take \(F_{t_{max}}=1\).