# Task Assignment of UAV Swarm Based on Wolf Pack Algorithm
## 2 Task Assignment Model  
In this section, a background incorporating a UAV swarm that executes an attack mission in a large field is presented. Then, a mathematical formulation is established.  
There are \(N_{T}\) static targets whose initial positions have been revealed, and \(N_{V}\) attacking UAVs planning to attack these targets with the minimum cost.  
In actual task assignment for ground attack, the task assignment model is very complex; it includes many factors, such as fuel constraints, ammunition quantity, timing constraints between multiple tasks, UAV mobility, threats, and redundancy tolerance. The factors considered in different combat scenarios are different, so the task assignment model varies with the actual situation. This paper considers a more general task assignment model which is not limited to a specific scenario and a specific UAV type. The point is to verify whether the proposed PSO-GA-DWPA is suitable for solving high-dimensional discrete optimization problems.  
To avoid the influence of uncertain factors on the analysis of simulation results, the following ideal assumptions are set up to simplify the formalization of the problem.  
1. There are no obstacles and no-fly zones in the task scenario. A flight trajectory can be described as connections of straight lines.
2. It does not take into account the consumption of time spent preparing and firing the weapon. In other words, only the time the UAV swarm takes to reach the target positions is considered.
3. The UAV swarm maintains the same constant velocity and hence the flight time can be represented with the flight distance.
4. Each target can be attacked only once. There are more targets than UAVs in the swarm, which means each UAV will probably be assigned multiple targets.  
The targets can be expressed as \(T=\left\{T_{1},T_{2},\cdots,T_{N_{T}}\right\}\), and the attacking UAV swarm can be expressed as \(V=\left\{V_{1},V_{2},\cdots,V_{N_{V}}\right\}\).  
The task assignment plan of UAV \(V_{i}\in V\) is  
\[\begin{array}{c}plan_{i}=\left\{stage_{1}^{(i)},stage_{2}^{(i)},\cdots,stage _{N_{ini}}^{(i)}\right\}\\ \hskip 14.226378 ptstage_{k}^{(i)}=(T_{j}L_{k}^{(i)}),T_{j}\in T\end{array}, \tag{1}\]  
where \(stage_{k}^{(i)}\) is the stage \(k\) of UAV \(V_{i}\in V\), \(N_{ini}\) is the task number assigned to UAV \(V_{i}\in V\), \(T_{j}\) is the target of the UAV \(V_{i}\in V\) at stage \(k\), and \(L_{k}^{(i)}\) is the distance to \(T_{j}\) of UAV \(V_{i}\in V\) at stage \(k\).  
Without loss of generality, two cost indicators that must be considered in task assignment are adopted: the shortest total range of all UAVs (i.e., the lowest fuel cost) and the shortest time to complete all tasks.  
1. Total range of all UAVs \[J_{1}=\sum_{i=1}^{N_{V}}\sum_{k=1}^{N_{ini}}L_{k}^{(i)}.\] (2)For all UAVs in the swarm, the average range is  
\[\int_{1}^{*}=\frac{\sum\limits_{i=1}^{N_{V}}\sum\limits_{k=1}^{N_{mi}}L_{k}^{(i)} }{N_{V}}. \tag{3}\]
2. Time to complete all tasks \[J_{2}=\max\limits_{i\in V}Time_{i},\] (4) where \(Time_{i}\) is the time of UAV \(V_{i}\in V\) to finish all of its tasks. With consideration of the same constant velocity for all UAVs, the time of UAV \(V_{i}\in V\) to finish all of its tasks can be expressed as its total range. Therefore, Equation (4) can be represented as Equation (5). \[J_{2}^{*}=\max\limits_{i\in V}\sum\limits_{k=1}^{N_{mi}}L_{k}^{(i)}.\] (5)  
The optimization goal is to minimize both the total range of all UAVs and the maximum range among all UAVs.  
Thus, the cost function of task assignment is  
\[\min J=\omega_{1}J_{1}^{*}+\omega_{2}J_{2}^{*}=\omega_{1}\frac{\sum\limits_{i=1 }^{N_{V}}\sum\limits_{k=1}^{N_{mi}}L_{k}^{(i)}}{N_{V}}+\omega_{2}\max\limits_{ i\in V}\sum\limits_{k=1}^{N_{mi}}L_{k}^{(i)}, \tag{6}\]  
where \(\omega_{1}\) and \(\omega_{2}\) are weighting factors reflecting the importance of each performance criterion, decided by the commander, and \(\omega_{1}+\omega_{2}=1\)