## 2 Theoretical Basis of Time-Varying Target Formation
### Improved Hungarian Algorithm Design  
The problem of formation reconfiguration of multi-agent systems is considered when agents are randomly disabled in collaborative environments. If an agent randomly selects the target point, the path may be far away, and the overall energy consumption may be large. The Hungarian algorithm is often used in task allocation, so we use this algorithm to solve the problem of the allocation of target points after random failure. The algorithm usually traverses each target point to obtain the optimal allocation, which will take more time for urgent conditions. The auction algorithm combines the idea of auction algorithm ranking, and proposes a gradient weighting factor to improve the speed of target point allocation. Hence, this paper integrates the Hungarian algorithm with the auction algorithm and proposes an improved Hungarian algorithm. The expected target position can be quickly determined at the moment of failure, and the one-to-one correspondence between the agent and the target point in the expected formation can be ensured, which will help the system to increase the formation efficiency and improve the overall system reliability. The agent matched one-to-one with the target location can be briefly described as follows: there are N agents performing tasks on N target points and a single agent is allowed to reach only one of the planar locations. Then the model of the formation target assignment problem for a multi-agent system based on matrix maps can be described as follows. The decision variables are defined by:  
\[l(i,j)=\left\{ \begin{array}{ll}1&\text{$i$th agent assigned to the $j$th point}\\ 0&\text{$i$th agent doesn't assigned to the $j$th point}\end{array} \right. \tag{7}\] \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Formation** & **Number of** & **Total Number** & **Maximum** & **The Actual** \\
**Dimension** & **Leaders** & **of Agents** & **Number of** & **Number of** \\  & & & **Sides** & **Sides** \\ \hline
2 & 3 & 7 & 15 & 12 \\
2 & 3 & 6 & 12 & 11 \\
2 & 3 & 5 & 9 & 8 \\
2 & 3 & 4 & 6 & 6 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Graphics library formation information. Figure 2: Reconstructed formations in the graphics library. \[\text{Constraint condition}:\left\{ \begin{array}{l}\sum\limits_{i=1}^{n}l_{ij}=1, \quad j=1,2,\ldots,n\\ \sum\limits_{j=1}^{n}l_{ij}=1,\quad\text{i}=1,2,\ldots,n\\ x_{ij}=1\text{ or }0\end{array} \right. \tag{8}\]  
\[\text{Target function}:\,z=\min\limits_{i=1}^{n}\sum\limits_{j=1}^{n}C_{ij}l_{ij} \tag{9}\]  
The number 1 means that the allocation is complete, and the number 0 means that it is not allocated. \(C=\left(C_{ij}\right)_{n\times n}\) is the distance matrix. \(C_{ij}\) is the distance value between the \(j\)-th target point and the \(i\)-th agent. \(L=\left(l_{ij}\right)_{n\times n}\) is the solution matrix of the agent target assignment. When its value is 1, it means that the location assignment between the \(i\)-th agent and the \(j\)-th target point has been completed. When its value is 0, it means that the \(j\)-th target point has not been assigned to the \(i\)-th agent. Equation (9) is used to represent the minimum total distance from the agent formation to all target points, and the distribution matrix is calculated on this basis. For the assignment problem model, the conditions for the solution of the improved Hungarian algorithm are: (1) The objective function is the smallest; (2) The number of agent and target points is the same; (3) The efficiency is non-negative. The goal of the Hungarian algorithm is to find N zero elements in different rows and columns in the transformed distance matrix to optimize the assignment problem. The distance between each point and the target position is calculated. \[C_{ij}=\sqrt{\left(d_{i}^{x}-d_{j}^{x}\right)^{2}+\left(d_{i}^{y}-d_{j}^{y} \right)^{2}} \tag{10}\]  
Among them, \(d_{i}^{x}\) represents the X-axis coordinate of the \(i\)-th agent and \(d_{j}^{y}\) represents the y-axis coordinate of the \(j\)-th target points.