## 3 A Resilient Routing Protocol
### Protocol Design
#### 3.1.1 Node Clustering  
In the initial phase, the SDN controller collects mobility-resilient parameters from each mobile node. These parameters are critical for both the clustering process and the DQN-based routing decisions:  
* Number of Neighboring Nodes (\(N_{i}\)): It quantifies a node's connectivity by counting its direct wireless connections. A higher number of neighbors indicates better connectivity and redundancy, reducing the risk of node isolation due to mobility and providing multiple routing options. Mathematically, \(N_{i}\) is calculated as: \[N_{i}=\sum_{j=1}^{M}\mathbb{I}_{ij}\] where \(M\) is the total number of nodes in the network, and \(\mathbb{I}_{ij}\) equals 1 if node \(j\) is within the transmission range of node \(i\), and 0 otherwise. * Average Connection Time (\(T_{i}\)): It measures the average duration that node \(i\) maintains active connections with its neighboring nodes over a specified observation period. This parameter reflects the stability and reliability of the node's connections, where longer average connection times suggest more stable links. Enhanced stability contributes to lower latency and higher PDRs, thereby improving the overall performance of the network. The average connection time is computed as: \[T_{i}=\frac{1}{C_{i}}\sum_{k=1}^{C_{i}}t_{ik}\] Here, \(C_{i}\) represents the total number of connection events for node \(i\), and \(t_{ik}\) denotes the duration of the \(k\)-th connection event for node \(i\). * Buffer Usage Rate (\(U_{i}\)): It indicates the current usage rate of node \(i\)'s buffer. This parameter is critical for assessing a node's ability to handle incoming and outgoing data packets without congestion. A higher buffer usage rate implies that the node is approaching its buffer capacity, increasing the risk of packet loss due to buffer overflow. By prioritizing nodes with lower \(U_{i}\) values in clustering and routing decisions, the network can maintain efficient data flow, minimize delays, and ensure smoother operations. The buffer usage rate is determined using the following formula: \[U_{i}=\frac{B_{i}}{B_{i}^{\max}}\] In this equation, \(U_{i}\) represents the buffer usage rate of node \(i\), \(B_{i}\) is the current buffer occupancy of node \(i\), and \(B_{i}^{\max}\) is the maximum buffer capacity of node \(i\). * RSSI Fluctuation Rate (\(R_{i}\)): It measures the variability in the Received Signal Strength Indicator (RSSI) for node \(i\). RSSI is an indicator of the quality and stability of the wireless link between two nodes. A lower fluctuation rate in RSSI implies more stable and reliable communication links, which are vital for maintaining high data transmission quality. High variability in RSSI can lead to increased packet loss and retransmissions, degrading the network's performance. By monitoring \(R_{i}\), the network can identify and prioritize nodes with stable link qualities, thereby enhancing communication reliability and reducing overhead associated with packet loss. The RSSI fluctuation rate is calculated as: \[R_{i}=\sqrt{\frac{1}{N}\sum_{k=1}^{N}(\mathrm{RSSI}_{ik}-\overline{\mathrm{ RSSI}_{i}})^{2}}\]Here, \(R_{i}\) denotes the RSSI fluctuation rate for node \(i\), \(N\) is the number of RSSI measurements collected for node \(i\), RSSI\({}_{jk}\) is the \(k\)-th RSSI measurement for node \(i\), and \(\overline{\text{RSSI}}_{i}\) is the average RSSI value for node \(i\). This standard deviation formula captures the extent of signal strength variability, providing a robust measure of link stability. In this study, the average RSSI value of node \(i\) was calculated by averaging the RSSI values of all its neighboring nodes. * Distance to Center (\(D_{i}\)): It represents the Euclidean distance of node \(i\) from the central point of the network area. This parameter provides insight into a node's geographical position within the network, which can influence its connectivity and routing efficiency.