## 2 Hybrid Algorithm of AFS and Improved BAS
### Hybrid Strategy of FAS-MMSBAS Algorithm  
The FAS-MMSBAS algorithm is composed of the BAS algorithm and the AFS algorithm combined through a simple hybrid strategy. In the early stage, the AFS algorithm is used for global optimization and fast convergence, and in the later stage, the improved BAS algorithm is used to replace it and continue optimization. The hybrid algorithm reduces the instability of the BAS algorithm caused by individual random initialization to a certain extent, accelerates the convergence speed, and improves the optimization accuracy. The most important consideration regarding the hybrid algorithm is to determine when to end the AFS algorithm. If it is too early, the global optimization ability of the AFS algorithm will be too small. If it is too late, it will converge too slowly and waste time. Therefore, according to the characteristics of the AFS algorithm, this paper proposes the termination of the AFS algorithm when the optimal value remains unchanged or the convergence speed becomes significantly slow. The optimal individual obtained by the AFS algorithm is taken as the initial individual of the BAS algorithm. The interruption rule of the AFS algorithm is shown in Algorithm 2:  
```
1. Input: parameters p and q
2. if the repeat times of best individual == q, or maximum iterations of AFS > q then
3. initial individual of the BAS = The optimal individual of AFS
4. endif
5. do Improve BAS
```  
**Algorithm 2** FAS algorithm termination rule pseudo code  
The parameters p and q are manually set values, where p represents the number of iterations of the best value, and q represents the maximum number of iterations of the AFS algorithm in the hybrid algorithm. When the fish swarm iterates p times and the optimal position remains unchanged, the AFS algorithm ends. This means that the current fish population may find the best value or fall into a local extreme value. In addition, because the AFS algorithm converges slowly in the later period, if condition p is not met under certain conditions, q is set as the termination condition of the AFS algorithm to avoid wasting time. The implementation steps of FAS-MMSBAS algorithm are as follows:  
Step 1. Set the initial parameters of the algorithm, including the populations, visual properties, attempt number, crowding factor, steps of the fish, antenna number, antenna length, and variation rate.  
Step 2. Use the AFS algorithm to continuously optimize until the AFS iteration termination condition is met.  
Step 3. Take the best individual in the optimization stage of the AFS algorithm as the initial position for the optimization of the beetle.  
Step 4. Judge whether there is variation. If there is, go to step 5; if not, go to step 6.  
Step 5. Allow the dimension to be mutated, until the end of the mutation.  
Step 6. Perform multi-directional and multistep detection on the beetle; then, select the best beetle to continue to move forward and update the current beetle step length and whisker length.  
Step 7. If the termination conditions are met, the algorithm is ended; if not, go to step 4.  
Figure 4 provides a flow chart of the AFS-MMSBAS algorithm depicted according to the above steps.