## 4 Distributed Real-Time Computation Offloading Algorithm Based on MDPSO
### Solving RCO Using Multi-Dimensional Discrete Particle Swarm Optimization Algorithm  
To resolve this game problem, we employed a multi-dimensional discrete particle swarm algorithm [32] to search for NE point \(\hat{\mathrm{V}}^{d,t}\). The modeling process begins by initializing a set of multi-dimensional random particles, represented by the set \(\mathcal{J}_{\mathrm{N}_{d}}^{l,i}=\{J_{1}^{l,i},J_{2}^{l,i},...,J_{N}^{l,j}\},\forall i\in I,\forall l\in L\). Here, \(i\) denotes the iteration rounds of the particles, \(L\) represents the population size, and the particle dimension corresponds to the total number of users \(\mathrm{N}d\) participating in the RCO game. Each particle symbolizes a feasible solution set for the game, with the solution vector's domain in any dimension \(n\) following \(\forall l_{n}^{l,i}\in\{0,1,2,...,F\}\). It is important to note that for users without service requests at slot \(t\), the corresponding dimensional value remains consistently zero, as indicated by the expression \(\mu_{n}^{t}=0\to J_{n}^{l,i}\equiv 0\). These particles are initially distributed randomly within the solution space and are assessed for estimated energy consumption \(q_{d,t}(\mathcal{J}_{\mathrm{N}_{d}}^{l,i})\) based on the fitness function \(q_{d,t}()\), which reflects the quality of the particle's current position. The solution vector with the best fitness in the global historical iterations for population \(L\) is designated as \(\mathcal{J}_{\mathrm{N}_{d}}^{globe}=\{J_{1}^{globe},J_{2}^{globe},...,J_{N}^{ globe}\}\), while the local historical optimal fitness solution vector for particle \(\forall l\in L\) is named by \(\mathcal{J}_{\mathrm{N}_{d}}^{local}=\{J_{1}^{local},J_{2}^{local},...,J_{N}^ {local}\}\). In the \(i\)-th iteration, particles determine their displacement vector \(\mathcal{Z}_{\mathrm{N}_{d}}^{l,i}=\{Z_{1}^{l,i},Z_{2}^{l,i},...,Z_{N}^{l,j}\}\) for the subsequent iteration by considering the global optimal solution in the \((i-1)\)-th iteration, local optimal solution, and the particle's current position, where positive integer \(\forall Z_{n}^{l,i}\in[0,F]\). The formula for updating the displacement vector in the \(n\)-th dimension for the \(i\)-th iteration is as follows:  
\[Z_{n}^{l,i}=Z_{n}^{l,i-1}+\left\lfloor H1(x_{1})\times(J_{n}^{local}-J_{n}^{ l,i-1})\right\rfloor+\left\lfloor H2(x_{2})\times(J_{n}^{globe}-J_{n}^{l,i-1})\right\rfloor \tag{44}\]  
In cases where the user request is null, the particle displacement vector should be zero. To increase the randomness of particle movement, we set two exploration coefficients, \(H1(x_{1})\) and \(H2(x_{2})\). Both of them follow uniform distribution. The random variablesand \(x_{2}\) have value ranges of \([h1_{\min},h1_{\max}]\) and \([h2_{\min},h2_{\max}]\), respectively, and satisfy the following equation:  
\[ \begin{split} H1(x_{1})&=\left\{\begin{array}{cc} \frac{1}{(h1_{\max}-h1_{\min})},&x_{1}\in[h1_{\min},h1_{\max}]\\ 0,&\text{elsewhere,}\end{array}\right.\\ H2(x_{2})&=\left\{\begin{array}{cc}\frac{1}{(h2_{\max}-h2_{\min})},&x_{2} \in[h2_{\min},h2_{\max}]\\ 0,&\text{elsewhere.}\end{array}\right.\end{split}  \tag{45}\]  
Nevertheless, the exploration coefficient results in the weighted displacement vector fail to comply with the domain definition of the action space, specifically concerning decimal values. To mitigate the impact of the decimal component in our calculations, we employed the floor function \(\lfloor*\rfloor\) to handle the increments. This approach guarantees that the displacement vector adheres to the constraints imposed by the offloading space. The iterative formula to determine the particle's position is delineated as follows:  
\[\mathcal{J}_{\text{N}_{d}}^{Li}=\mathcal{J}_{\text{N}_{d}}^{lj-1}+\mathcal{Z}_ {\text{N}_{d}}^{l,i}. \tag{46}\]  
After \(i\) iterations, the algorithm arrives at the final global optimal solution vector \(\mathcal{J}_{\text{N}_{d}}^{final}\), which minimizes the real-time energy consumption function \(q_{d,i}^{\min}(\mathcal{J}_{\text{N}_{d}}^{final})\).