## 4 Target Cooperative Capture  
### GA-Based Task Assignment  
In a 3D underwater space, a formation is judged to have successfully captured a target when the robots in the formation occupy each of the six neighborhood positions around the target. Therefore, task assignment is required to determine the capture position of each robot after the formation enters the capture phase, and the assignment result affects the deployment speed and capture efficiency of the robots. The traditional exhaustive enumeration method is widely used in task assignment. Although the exhaustive enumeration strategy can obtain the optimal solution, it contains randomness and uncertainty, and the complexity of the algorithm increases as the number of targets to be assigned increases (there are N! kinds of assignment schemes for N targets). If there are too many targets to be assigned, the strategy may not converge to obtain the optimal solution in finite time. In addition, when the target moves, the capture points around it are changing, and the task points assigned to each robot are also dynamically changing. If the grid density is large, the exhaustive method will seriously affect the real-time performance of the algorithm, while the small grid density cannot guarantee that the optimal assignment scheme will be obtained. The genetic algorithm is based on pattern theorem and Markov chain model, so its search possesses a better directionality, fast computation, and smaller probability of falling into local optimum; however, the problem of under- or over-assignment may occur. In addition, individuals with higher fitness in the genetic process have a higher probability of being inherited by the next generation, but the fitness function based on Euclidean distance cannot achieve dual evolution in time and space. The optimization goal of task assignment is the lowest total energy consumption required as the robot occupies the corresponding position. In this paper, we propose a GA-based task assignment method (Figure 6), where the formation obtains different position assignments that are actually equivalent to the robot team transformation again, so this paper introduces the FCC model to the GA process to replace the original fitness function and make the natural selection in the evolutionary process more realistic. This is integrated with the reassignment strategy to solve the possible over- and under-assignment problems. Figure 6: Flow chart of the improved genetic assignment algorithm. The fitness function chosen by the genetic algorithm to solve the minimization problem is:  
\[fit(x)=-\sum_{i=1}^{n}w_{i}x_{i} \tag{11}\]  
A new objective function is constructed by bringing Equation (8) into the objective function of the genetic algorithm:  
\[f(x)=\min\sum_{i=1}^{n}w_{i}x_{i} \tag{12}\]  
where  
\[x_{i}=(\sum_{j=1}^{\mathrm{k}_{i}-1}\lambda v_{i}^{3}\frac{\left|\frac{d_{i,j}d _{i,j+1}}{v_{g}}\right|}{v_{g}})+\frac{D_{\mathrm{max}}}{v_{g}}p_{0} \tag{13}\]  
Experimental verification: the number of individuals was set to 6, the maximum genetic generation was set to 100, the generation gap was set to 0.9, and the chromosome length was set to 6. After several iterations, the target assignment results of the six robots are shown in Table 1.  
As can be seen from Table 1, the initial genetic algorithm suffers from over- and under-assignment problems, while the improved GA method proposed in this paper achieves uniqueness in target assignment, which is consistent with the results obtained by the exhaustive method. In addition, the target assignment scheme based on the GA reflects the faster convergence speed, as shown in Figure 7. The greater the number of robots in the formation and the assignment target, the greater the computational advantage of the proposed scheme and the better its applicability to the assignment problem of different formations.