# Optimizing Routing Protocol Design for Long-Range Distributed Multi-Hop Networks
## 4 Load-Balancing Routing Optimization Scheme Design
### Business Routing Model  
The traditional OLSR protocol establishes routes based solely on hop count, ignoring the link quality. Thus, it struggles in high traffic volumes or uneven network conditions. This leads to issues like delayed route updates and traffic congestion. Therefore, hop-count-based routing may fail to find the optimal path. The routing optimization problem is decomposed into transmission path planning for terminal nodes with different business priorities, calculating the node cost matrix. Under constraint satisfaction, the path with the minimum cost is selected as the transmission path for business data. The following analysis covers the establishment of the business routing model. 1. Establishing the link weight matrix Assuming in a distributed multi-hop LoRa network, the number of terminal nodes is \(n-1\), and the gateway is 1, the network model can be represented by the coordinate matrix node_Positions, distance matrix node_Distance, and adjacency matrix node_Adjoin. Suppose the terminal nodes are numbered (1, 2, 3... \(n\)\(-\)2, \(n\)\(-\)1), and the gateway is numbered \(n\). The coordinates of terminal nodes and gateways are known and fixed, represented by the coordinate matrix node_Positions, as shown in Equation (27). The first \(n\)\(-\)1 rows represent the coordinates of terminal nodes from \((x_{1},y_{1},z_{1})\) to \((x_{n-1},y_{n-1},z_{n-1})\), and the \(n\)-th row \((x_{n},y_{n},z_{n})\) represents the gateway's coordinates. \[\text{node\_Positions}=\left( \begin{array}{ccc}x_{1}&y_{1}&z_{1}\\ x_{2}&y_{2}&z_{2}\\ \vdots&\vdots&\vdots\\ x_{n}&y_{n}&z_{n}\end{array} \right)_{n\times 3} \tag{27}\]  
The distance matrix between terminal nodes node_Distance is shown in Equation (28), where \(d_{ij}\) represents the distance between terminal node \(i\) and terminal node \(j\). \[\text{node\_Distance}=\left( \begin{array}{ccc}d_{11}&\cdots&d_{1n}\\ \vdots&\ddots&\vdots\\ d_{n1}&\cdots&d_{nn}\end{array} \right)_{n\times n} \tag{28}\]  
In route planning, to prevent loops or improper routing between terminal nodes and the aggregation node, the distance matrix node_Distance needs adjustment and optimiza \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Load Rate** & **Occupancy Rate** & **Low** & **Medium** & **High** \\ \hline Low & WILL\_HIGH & WILL\_HIGH & WILL\_DEFAULTULT \\ Medium & WILL\_DEFAULTULT & WILL\_DEFAULTULT & WILL\_LOW \\ High & WILL\_LOW & WILL\_LOW & WILL\_LOW \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Load-Balanced willingness settings. tion according to constraints, as shown in Equation (29), where \(d_{ij}=\infty\) indicates that terminal node \(i\) is unreachable from terminal node \(j\). \[d_{ij}=\left\{ \begin{array}{cc}\infty,i=j\\ \infty,d_{in}<d_{jn}\end{array} \right. \tag{29}\]  
From the distance matrix, the link loss matrix link_Loss between terminal nodes can be derived, as shown in Equation (30), where \(l_{ij}\) represents the path loss between terminal node \(i\) and terminal node \(j\). \[\text{link\_Loss}=\left( \begin{array}{ccc}l_{11}&\cdots&l_{1n}\\ \vdots&\ddots&\vdots\\ l_{n1}&\cdots&l_{nn}\end{array} \right)_{n\times n} \tag{30}\]  
Similarly, adjustments and optimizations are made to the link loss matrix link_Loss to prevent loops or improper routing between terminal nodes and the aggregation node, adhering to constraints shown in Equation (31), where \(l_{ij}=\infty\) denotes that terminal node \(i\) is unreachable from terminal node \(j\). \[l_{ij}=\left\{ \begin{array}{cc}\infty,i=j\\ \infty,d_{in}<d_{jn}\end{array} \right. \tag{31}\]  
The adjacency matrix node_Adjoin is a three-dimensional matrix, as shown in Equation (32), representing adjacency for different SFs of (7, 8, 9, 10, 11, 12). \[\text{node\_Adjoin}=\left( \begin{array}{ccc}a_{11}&\cdots&a_{1n}\\ \vdots&\ddots&\vdots\\ a_{n1}&\cdots&a_{nn}\end{array}