# An Approach for Deployment of Service-Oriented Simulation Run-Time Resources
## 5 Simulation Run-Time Resources Deployment Algorithm
### Mutation Operators  
We design two crossover operators, which can be understood as random and heuristic. The first approach is random. It randomly selects two servers within the mutated chromosome, swapping the BSs deploying them, and randomly changing the locations of the middleware and constructive members. As for micro-services, it randomly selects a server and decides whether to increase or decrease the number of micro-services deployed \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**PK** & \multicolumn{3}{c}{**Historic Performance**} & \multicolumn{3}{c}{**Probability of Selection**} \\
**Operator** & **Operator 1** & **Operator 2** & **Operator 3** & **Operator 1** & **Operator 2** & **Operator 3** \\ \hline Initialization & 1 & 1 & 1 & 33.3\% & 33.3\% & 33.3\% \\ mutation1 & 1 & 2 & 1 & 25\% & 50\% & 25\% \\ mutation2 & 1 & 2 & 1 & 25\% & 50\% & 25\% \\ \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Update and application performance knowledge of mutation operators. on it based on its resource usage rate, i.e., the second optimization objective. The purpose of designing this operator is to enhance the randomness of our algorithm, thereby increasing its ability to escape from local optimal solutions. ```
0: Set of micro-services \(MS\); Resource demand of micro-services \(r_{MS}\); Set of composite services \(S\); Set of edge servers \(R\); Resource capacity of edge servers \(R_{C}\); Location of base stations \(L_{BS}\); Set of users \(U\); Resource demand of constructive members \(R_{C}\); Location of live and virtual members \(L_{LV}\); User demand for composite services \(d\); Counts of interactions among users \(Ita\)
0: Deployment schemes \(\mathcal{DS}\) and EP
1:\(g\gets 1\)
2:\(FailCount\gets 0\)
3: Randomly generate \(\mathbb{P}\) individuals \(DS_{1},\cdots,DS_{\mathbb{P}}\) to form the population \(\mathcal{DS}\)
4: Calculate \(f(\mathcal{DS})\) according to Equation (22)
5: Select the top \(\mathbb{E}\) individuals in \(\mathcal{DS}\) to form the first generation EP
6:while in the single-objective stage do
7: Perform parent selection, crossover, and mutation operations to generate the next generation \(\mathcal{DS}\) according to OPK
8: Calculate \(f(\mathcal{DS})\)
9: Update OPK based on \(f(\mathcal{DS})\)
10: Update EP based on \(\mathcal{DS}\) and \(f(\mathcal{DS})\)
11: Update parameters including \(\mathbb{M}\), \(e\) and \(P_{m}\)
12:\(g\gets g+1\)
13:endwhile
14: Calculate \(f_{1}(\mathcal{DS})\) and \(f_{2}(\mathcal{DS})\) according to Equations (10)-(12)
15: Select the top \(\mathbb{E}\) individuals in \(\mathcal{DS}\) based on \(f_{1}(\mathcal{DS})\), \(f_{2}(\mathcal{DS})\) and their Pareto rank and congestion to form EP in the second stage
16:while in the multi-objective stage do
17: Perform parent selection, crossover, and mutation operations to generate the next generation \(\mathcal{DS}\) according to OPK
18: Calculate \(f_{1}(\mathcal{DS})\), \(f_{2}(\mathcal{DS})\) according to Equations (10)-(12)
19: Update EP and OPK according to Equations (23)-(25)
20:if fail to update EP then
21:\(FailCount\gets FailCount+1\)
22:else
23:\(FailCount\gets 0\)
24:endif
25:if\(g\%Replace\_Freq==0\)then
26: Replace one of the worst individuals in \(\mathcal{DS}\) with one of the best individuals in EP
27:endif
28:if\(FailCount==\mathbb{G}\times Stop\_Ratio\)then
29: break
30:endif
31: Update parameters including \(\mathbb{M}\), \(e\) and \(P_{m}\)
32:\(g\gets g+1\)
33:endwhile
34:return\(\mathcal{DS}\), EP
```  
**Algorithm 1** Learnable GA-based Simulation Resources Deployment (LGASRD)  
The second variation operation is heuristic. It defines the weighted distance between live and virtual users and a BS, using the size of the communication data generated by these users as the weight to add up the physical distance between these users and the BS.