# Ant Colony Optimization Task Scheduling Algorithm for SWIM Based on Load Balancing
## 4 Ant Colony Optimization Algorithm Based on Load Balancing
### Ant Colony Optimization Task Scheduling Algorithm Rule  
In the actual SWIM, in order to achieve effective load balancing, the hardware performance of the node resources must be considered. First, reasonably assign tasks to each node according to the node processing capacity. The hardware performance is represented by two key indicators--computing \begin{table}
\begin{tabular}{c c c} \hline \hline
**Serial Number** & **Symbol** & **Notation** \\ \hline
1 & \(P_{ij}^{k}(t)\) & The transition probability value \\
2 & \(\tau_{ij}(t)\) & The pheromone value \\
3 & \(\eta_{ij}(t)\) & The heuristic function \\
4 & \(\alpha\) & The information heuristic factor \\
5 & \(\beta\) & The expect heuristic factor \\
6 & \(Mip(s_{j})\) & The computing power \\
7 & \(Bandwidth(s_{j})\) & The communication bandwidth \\
8 & \(Performance(s_{j})\) & The hardware performance \\
9 & \(LB_{j}\) & The load balancing value \\
10 & \(C(s_{j})\) & The CPU utilization rate \\
11 & \(M(s_{j})\) & The memory usage \\
12 & \(B(s_{j})\) & The bandwidth occupancy \\
13 & \(LA\) & The average value of the load \\
14 & \(LS\) & The load standard deviation \\
15 & \(\mu\) & The information residual factor \\
16 & \(\Delta\tau_{ij}\) & The pheromone increment value \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The mathematical symbols notations. power and system communication bandwidth of resource nodes. The hardware performance can be expressed by Equation (2). \[Performance(s_{j})=\omega_{1}*Mip(s_{j})+\omega_{2}*Bandwith(s_{j}). \tag{2}\]  
In Equation (2), \(Mip(s_{j})\) represents the computing power of resource node \(s_{j}\), \(Bandwidth(s_{j})\) represents the communication bandwidth of resource node \(s_{j}\), and \(\omega_{1}\) and \(\omega_{2}\) are constants. In SWIM, the indicators of impact on resource nodes load are mainly composed of CPU utilization, memory utilization and system bandwidth occupancy. The load balancing value of SWIM resource nodes can be expressed by Equation (3). \[LB_{j}=\delta_{1}*C(s_{j})+\delta_{2}*M(s_{j})+\delta_{3}*B(s_{j}). \tag{3}\]  
In Equation (3), \(LB_{j}\) represents the load balancing value of resource node \(s_{j}\); \(C(s_{j})\) represents the CPU utilization rate of resource node \(s_{j}\); \(M(s_{j})\) represents the memory usage of resource node \(s_{j}\); \(B(s_{j})\) represents the bandwidth occupancy of resource node \(s_{j}\); the coefficients \(\delta_{1}\), \(\delta_{2}\) and \(\delta_{3}\) are constants, representing the weights of the three items, and \(\delta_{1}+\delta_{2}+\delta_{3}=1\). The average value of the load of all resource nodes in SWIM is expressed by Equation (4). \[LA_{j}=\sum_{j=1}^{m}LB_{j}\Bigg{/}m\,. \tag{4}\]  
Then the resource node load standard deviation is expressed by Equation (5). \[LS_{j}=\sqrt{\frac{1}{m}\sum_{j=1}^{m}\bigl{(}LB_{j}-LA_{j}\bigr{)}^{2}}. \tag{5}\]  
By calculating the resource node load standard deviation \(LS\) in SWIM, it can reflect the system load balance degree. The larger the value of \(LS\), the more unbalanced the system load. The smaller the value of \(LS\), the more balanced the system load. The ant colony algorithm pheromone update is expressed by Equation (6). \[\tau_{ij}(t+n)=(1-\mu)\tau_{ij}(t)+\Delta\tau_{ij}. \tag{6}\]  
In Equation (6), \(\mu\) is the information residual factor, \(1-\mu\) is the pheromone volatilization coefficient, which is employed to avoid the pheromone infinite accumulation. The \(\mu\) value range is limited to \(0<\mu<1\). \(\tau_{ij}(t+n)\) is the pheromone concentration value on the path \((i,j)\) at time \(t+n\); \(\Delta\tau_{ij}\) is the pheromone increment value on the selected path \((i,j)\), the initial time is \(\Delta\tau_{0}=0\). This paper uses the resource node hardware performance parameters and the system average load difference to update the pheromone \(\tau_{ij}\), as expressed by Equation (7).