# Global Resource Scheduling for Distributed Edge Computing
## 4 Algorithm Design
### Pheromone Updating and Improvement  
The improvement of pheromone updating rules and pheromone incremental updating rules interact. The traditional ACO for pheromone incremental updating rules converges too slowly. The reason is that the pheromone updating is too slow, which makes the algorithm unable to converge to the path at a low cost quickly. After analyzing the original pheromone incremental update, Formula (8), even though the cost of different nodes on the path is very different, the pheromone increment calculated by the formula is not significantly different. It is meaningless to choose a better path and cannot change the final selection strategy. Therefore, some improvements have been made to Formula (8) to increase the difference of pheromone increments on the path with significant cost difference so that it has a more vital ability to select multiple paths. The improved formula is as follows:  
\[\Delta\tau_{ij}^{k}=\left\{\begin{array}{cl}\frac{Q}{e^{\lambda_{k}-Avg}}& \text{if edge}(i,j)\text{ in its tour}\\ 0&\text{otherwise}\end{array}\right. \tag{15}\]  
where \(Q\) is constant; \(L_{k}\) is the length of the current path; \(Avg\) is the average cost of all ants' paths in this round. When the cost of an ant's path is small, the concentration of the pheromone update is greater than that of \(Q\). Furthermore, when the cost of an ant's path is high, the concentration of the pheromone update is much smaller than that of \(Q\), which can highlight the difference in the pheromone update value and increase the convergence speed of the algorithm. We have improved the pheromone updating rule to prevent the algorithm's convergence rate from exceeding expectations.  
\[\tau_{ij}(t+n)=(1-\rho)\times\tau_{ij}(t)+\rho\times\Delta\tau_{ij} \tag{16}\]  
In Algorithm 1, the heuristic algorithm flow designed in this paper is as follows:Initialize the parameters, randomly generate the parameters of the particle swarm (including the speed and position of each particle), and convert the parameters into \(\{\alpha,\beta\}\).
2. Initialize the pheromone and other parameters of the ACO; set \(N_{sa}\) ants of each ant population on these nodes.
3. Make all ants in each ant population search for all nodes according to Formula (14). Select the target node to apply for resources, modify the scheduling table, and calculate the total cost of scheduling resources.
4. Calculate the total scheduling cost of each population scheduling resource, and record the ant path corresponding to the optimal scheduling cost. The optimal scheduling generation value is used as the fitness value of the particle. The particle with the optimal fitness value selected is the best record of the current iteration number of the population. Update the best record of each particle's history and the best record of the population's history. After updating the speed and position according to Formula (13), convert the position parameters to new \(\{\alpha,\beta\}\) according to Formula (12). Update the value of pheromone according to Formula (16).
5. If the number of iterations has reached the target number of iterations, stop the iteration; if the number of iterations does not meet the requirements, re-execute step (3).  
```
0: Large-scale distributed network P
0: Resource scheduling optimization scheme R
1: Initialize parameters of particle swarm \(v_{id}\), \(x_{id}\), \(tabu_{k}\), \(N_{sa}\)
2:\(\{\alpha,\beta\}<-v_{id},x_{id}\)
3:for\(\text{k}<-1\) to \(N_{sa}\)do
4:for i in P do
5: ant \(k\) choose next park
6: modify taboo list \(tabu_{k}\) of ant k
7:if\(\text{L}(i)<\text{L}(known-best)\)then
8: replace best route
9:\(\text{L}(best)<-\text{L}(i)\)
10: Shortest route \(<-\text{L}(i)_{route}\)
11:endif
12: activity of pheromone updating is executed
13: activity of \(v_{id}\),\(x_{id}\) updating is executed
14:endfor
15: R updating is executed
16:endfor
17:Return R
```  
**Algorithm 1** Adaptive dynamic migration algorithm for large-scale distributed resources.