# Distributed Task Allocation for Multiple UAVs Based on Swarm Benefit Optimization
## 3 Method
### Individual Benefit  
To quantitatively assess the aforementioned individual benefit variation \(\kappa\), the subsequent section will elaborate on the specific computation process of individual benefits. This calculation not only takes into account the time at which the UAV commences its task but also considers the value of the task and how this value changes over time, ensuring a thorough and accurate assessment. Thus, the computation of the individual benefit \(B(\mathbf{a}_{i})\) attained by UAV \(i\), based on its task allocation plan \(\mathbf{a}_{i}\), is as follows:  
\[B(\mathbf{a}_{i})=\sum\zeta_{j}^{r_{i}^{j}(\mathbf{a}_{i})}\bar{b}_{j}\quad \forall j\in\mathcal{J},\quad\forall i\in\mathcal{I} \tag{12}\]  
where \(\bar{b}_{j}\) signifies the initial value of task \(j\), representing the benefit accrued if the UAV were to complete task \(j\) immediately. Conversely, \(\zeta_{j}\) represents the rate at which the value of task \(j\) decreases over time, indicating that if the UAV does not complete task \(j\) promptly, the associated benefit will diminish as time progresses. \(\tau_{i}^{j}(\mathbf{a}_{i})\) denotes the anticipated commencement time for UAV \(i\) to execute task \(j\) according to its individual task allocation plan \(\mathbf{a}_{i}\), which is contingent upon the spatial distance between the UAV and the task. Herein, the Euclidean distance is employed to quantify this distance.  
Hence, when task \(j\) is not included in the set of tasks \(\mathbf{a}_{i}\), the specific computation of the individual benefit variation \(\kappa_{j}^{+}\) for UAV \(i\) can be modified from Equation (8) to the following:  
\[\kappa_{ij}^{+}=\max_{\mathbf{a}_{i}\leq\mathbf{a}_{i}}\sum_{j}\zeta_{j}^{r_{i }^{j}(\mathbf{a}_{i}+\mathbf{a}\{j\})}\bar{b}_{j}-\sum\zeta_{j}^{r_{i}^{j}( \mathbf{a}_{i})}\bar{b}_{j},\quad\forall j\in\mathcal{J},\quad\forall i\in \mathcal{I} \tag{13}\]  
It is specifically noted that in the scenario where task \(j\) is not included in the task allocation plan \(\mathbf{a}_{i}\) of UAV \(i\), and the inclusion of task \(j\) would violate constraints (2)-(4), the individual benefit variation for task \(j\) to UAV \(i\) is zero, denoted as \(\kappa_{ij}^{+}=0\). Consequently, UAV \(i\) will not undertake task \(j\).  
Similarly, when task \(j\) is already contained within \(\mathbf{a}_{i}\), the computation can be altered from Equation (9) to the following:  
\[\kappa_{ij}^{-}=\sum\zeta_{j}^{r_{i}^{j}(\mathbf{a}_{i})}\bar{b}_{j}-\sum \zeta_{j}^{r_{i}^{j}(\mathbf{a}_{i}-\{j\})}\bar{b}_{j},\quad\forall j\in \mathcal{J},\quad\forall i\in\mathcal{I} \tag{14}\]  
Figure 1 presents a clear comparison between the benefit-first approach proposed in this study and the traditional distance-first approach in terms of task planning formation and swarm benefits. In the figure, the center of each circle represents the task location, the size of the circle indicates the initial benefit of the task, the color of the circle denotes the task type, and the shading of the circle reflects the rate at which the task's benefit decreases over time (the darker the color, the faster the benefit decreases over time). As observed in Figure 1a, the distance-first approach only considers the distance of tasks, and both UAV 1 and UAV 2 construct their respective task plans according to the distance of the task. In contrast, the benefit-first approach takes into account not only the distance of tasks but also the initial benefit of the tasks and the rate at which these benefits decrease over time (Figure 1b). It can be found that the benefit-first method proposed in this paper has higher swarm benefits than the traditional distance-first method.