# A Heterogeneous Multi-Satellite Dynamic Mission Planning Method Based on Metaheuristic Algorithms
## 3 Algorithm Design
```
0: sat manager, user infos, num particles = 200, iterations = 50
0: best global position, best global fitness
1: Initialize particles, local best positions, local best fitness, best global position, fitness history
2:for i = 1 to initialize do
3: Initialize particle and local bests for each user in user infos
4:for each user info in user infos do
5: Select a random covered satellite for the user
6: Initialize local best position and fitness for the user
7:endfor
8: Add particle and local bests to their respective lists
9: Evaluate fitness of the particle
10:if fitness > best global fitness then
11: Update best global fitness and best global position
12:endif
13:endfor
14:for iteration = 1 to iterations do
15:for each particle in particles do
16: Evaluate fitness of the particle
17:if fitness > best global fitness then
18: Update best global fitness and best global position
19:endif
20:for each user in user infos do
21: Choose new satellite based on local and global best positions, with some randomness
22: Update satisfaction and position for the user
23:if new fitness > local best fitness then
24: Update local best fitness and position
25:endif
26:endfor
27:endfor
28: Append best global fitness to fitness history
29:endfor
30: Save fitness history and plot fitness improvement
31:return best global position, best global fitness
```  
**Algorithm 1** PSO for Satellite Connection Optimization  
The optimization objective of this algorithm is to maximize the following fitness function:  
\[max\sum_{u=1}^{N} \begin{cases}P_{u}{\cdot}(1-H_{u}){\cdot}\frac{C_{R}^{u}}{C_{R} ^{u}}\cdot SNR_{MEO}-Z&S=MEO\\ P_{u}{\cdot}H_{u}{\cdot}C_{R}^{u}{\cdot}\frac{C_{R}^{u}}{C_{R}^{u}}\cdot SNR_{GEO }-Z&S=GEO\end{cases}  \tag{3}\]\[s.t.\sum_{u\in Sat_{i}}C_{O}^{u}\leq C_{Sat_{i}}\qquad for\;i=1,\;2,\;\ldots,\;8 \tag{4}\]  
\[Pu\in\{1,\;2,\;3,\;4,\;5\} \tag{5}\]  
\[0\leq Hu\leq 1 \tag{6}\]  
In the equation, \(S\) has two possible values, GEO and MEO, representing the satellite assigned to the user. Depending on the value of \(S\), the corresponding fitness function will vary. \(SNR_{GEO}\) and \(SNR_{MEO}\) represent the link budgets when assigning GEO and MEO satellites to the user, respectively. The differences between these two values are mainly due to satellite altitude and antenna gain, which are set as fixed values in the calculation. When combined with user preferences and priority, SNR ensures that the optimization process not only focuses on meeting capacity needs but also on providing the highest quality of service possible. The optimization is subject to several constraints to ensure feasible and efficient resource allocation. Capacity Constraint: The total capacity allocated to users assigned to a satellite \(Sat_{i}\) cannot exceed the satellite's maximum capacity \(C_{Sat_{i}}\): (4). User Priority: The user priority must be a positive integer between 1 and 5, thus ensuring that users are prioritized appropriately: (5). User Preference: The user preference for different satellite types must lie between 0 and 1, inclusively (6). \(Z\) represents the penalty. To better meet user needs, \(Z\) is set to 0 when the user's capacity satisfaction is 1. Otherwise, a penalty is applied, with \(Z\) taking a constant value greater than zero. If the capacity satisfaction of a high-priority user is not met, a more severe penalty is imposed, with \(Z\) taking an even larger constant value. The interaction between \(Z\) and other variables helps create a feedback loop: unmet needs lead to penalties, which prompt adjustments in resource allocation, ultimately driving the system towards greater efficiency and user satisfaction. In conclusion, the interaction between user priority, preference, capacity satisfaction, SNR, and the penalty mechanism forms a comprehensive framework for optimizing satellite resource allocation. This approach ensures that the system can dynamically respond to user demands, thus effectively managing the complexities of satellite communication in a multi-user environment.