# A Load Balancing Routing Mechanism Based on SDWSN in Smart City
## 4 SDSNLB Algorithm and Solution  
In SDWSN, data traffic can be assigned to multiple paths to improve network utility. In this part, we propose end-to-end multipath bandwidth allocation as an optimization problem to achieve efficient use of network resources. In a smart city, load balancing is realized by a multipath transmission of information. Therefore, constraining this problem includes two aspects: multiple paths from source to destination and link bandwidth that makes up each path. The parameters used in our model are summarized in Table 1. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameters** & **Meaning** \\ \hline V, E & The set of all devices and the set of links between them \\ \(C_{(e)}\) & The capacity of link e, e\(\in\)E \\ \(l_{(e)}\) & The load of link e, e\(\in\)E \\ \(f_{e}^{(s,t)}\) & The traffic of between the nodes s,t by link e \\ \(TM\) & The traffic matrix \\ \(TM_{(s,t)}\) & The traffic from the routing node s to node t \\ \(U_{(s,t)}\) & The utilization of link e \\ A & The set of all link utilization \\ m & The amount of utilization contained in A \\ \(x_{i,j}\) & The connection weight between the i-th hidden layer (or input layer) to the j-th \\ \(\beta_{j}\) & The output value of the jth input layer (or hidden layer) \\ \(g_{i}\) & The output value of the i-th output layer \\ \(y_{i}\) & The expected value of the i-th output layer \\ K & The number of expected cluster centers \\ \(\theta_{N}\) & The minimum number of samples in each cluster domain \\ \(\theta_{S}\) & The standard deviation of the sample distance distribution in a cluster domain \\ \(\theta_{C}\) & The minimum distance between two cluster centers. If it is less than this number, \\  & the two clusters are merged \\ L & The maximum number of cluster centers that can be merged in one iteration \\ I & The number of iterations \\ \(S_{j}\) & The cluster domain of traffic matrix \\ \(N_{j}\) & The number of traffic matrices in \(S_{j}\) \\ n & Dimension of sample feature vector \\ \hline \hline \end{tabular}
\end{table} 
Table 1: List of notation. Figure 3: Key components of OpenFlow switches. **Definition 1**. : _End-to-end path: A transmission line consisting of a series of store-and-forward nodes, transfer data information from the source to the destination._  
**Definition 2**. : _Available link bandwidth: Assume that an end-to-end path contains \(n\) links, \(C_{(e)}\) is the initial capacity of link \(e\). The carried traffic is \(l_{(e)}\), Define the available link bandwidth is \(C_{(e)}-l_{(e)}\). The available link bandwidth reflects the link characteristics actually transmitted._  
**Definition 3**. : _Link Bandwidth Utilization: For \(\forall(s,t)\in E\), the bandwidth utilization of the link is \(\mathcal{U}_{(s,t)}=\frac{l_{(s,t)}}{C_{(s,t)}}\times 100\%\)._  
**Definition 4**. : _Average utilization of links: The average utilization of links in the network is the average of the bandwidth utilization of all links, defined as \(\overline{U_{(s,t)}}=\frac{\sum_{U_{(s,t)}\in A}U_{(s,t)}}{k}\)._  
Because the fairness of the path selection strategy is quite important to load balancing, we derive a load balancing objective function by using the fairness principle of Min-Max. Therefore, the objective function of link load balancing is as follows:  
Objective function: minimize \(y=\frac{\sum_{U_{(s)}\in A}\left(U_{(s,t)}-\overline{U_{(s,t)}}\right)^{2}}{m}\)  
Subject to:  
\[\sum_{i<j(i,j)\in E}f_{(i,j)}^{(s,t)}-\sum_{k>j(j,k)\in E}f_{(j,k)}^{(s,t)}= \left\{ \begin{array}{l}-TM_{(s,t)}j=s\\ TM_{(s,t)}j=t\\ 0j\
eq s,t\end{array} \right.\]  
\[l_{(e)}=\sum_{(s,t)\in v\
eq t}f_{e}^{(s,t)}\leq C_{(e)}\in E\]  
\[f_{e}^{(s,t)}\geq 0e\in E;s,t\in v\]  
The Elman neural network, which is a typical dynamic recurrent neural network, which adds a receiving layer to the hidden layer as a one-step delay operator to achieve the purpose of memory, thus enabling it. The system has the ability to adapt to time-varying characteristics and enhances the global stability of the network.