## 4 Privacy-Preserving Optimization Based on Advanced CH Selection (P2O-ACH)
### Enhanced ROA-Based CH Selection
Pseudo code for ROA-based CH selection:```
Inputs--Rider inputs Output--Optimal CH selection Start Step 1--For CH selection * ROA rider's initialization--bypass rider, follower, overtaker, and attacker; * ROA group initialization--\(G^{t}=\left\{G^{t}(S_{a},S_{b})\right\};1\leq S_{a}\leq NR_{t};1\leq S_{b}\leq Dl_{t}\); * ROA steering angle of riders--\(SA^{t}=\left\{SA^{t}_{S_{a},S_{b}}\right\};1\leq S_{a}\leq NR_{t};1\leq S_{b} \leq Dl_{t}\); * Distance calculation for the current rider to reach the destination--\(CR_{dis}=\frac{S_{a}+D_{a}}{S_{a}-D_{b}}\); Step 2--Update the rider's positions * Bypass rider position * update--\(G^{BR_{t}}_{t+1}(S_{a},S_{b})=\gamma\left[G^{t}(\eta,S_{b})\times\mu(S_{b})+G^{t}( \epsilon,S_{b})\times[1-\mu(S_{b})]\right]\); * Followerider position * update--\(G^{F}_{t+1}(S_{a},S_{b})=G^{L_{intra}}(L_{index},c)+\left[\cos\left(SA^{t=0}_{S_{a},S_ {b}}\right)\times G^{L_{intra}}(L_{index},c)\times d^{t}_{S_{a}}\right]\); * Overtaker rider position * update--\(G^{O}_{t+1}(S_{a},S_{c})=G_{t}(S_{a},S_{c})+\left[Y^{l}_{t}(S_{a})\times G^{L_{ index}}(L_{index},S_{c})\right.\); * Attacker rider position * update--\(G^{AT}_{t+1}(S_{a},S_{c})=G^{L_{index}}(L_{index},S_{b})+\left[\cos\left(SA^{t=0}_{S _{a},S_{b}}\right)\times G^{L_{index}}(L_{index},S_{b})\right]+d^{t}_{S_{a}}\); Step 3--Enhanced ROA-based CH selection--riders' pattern bypass, follower, overtaker, and attacker CH is chosen; * CH pattern--\(CH_{by},CH_{fr},CH_{ol},CH_{at}\); Step 4--Attack prevention--trust model initialization--packets delivered, rate of packets loss, average latency, average energy, and integrity; * Calculation for packets delivered--\(DP_{rate}(t)=\frac{TP_{e}(t)}{AP_{e}(t)}\times 100\); * Calculation for rate of packet loss--\(LP_{rate}(t)=\frac{AP_{e}(t)}{TP_{e}(t)}\times 100\); * Calculation for average latency--\(L_{average}=\frac{\sum_{i=1}^{N}(PT_{i}(time)-PA_{i}(time))}{TP_{i}(t)}\); * Calculation for average energy--\(E_{average}=\frac{\sum_{i=1}^{N}RT_{i}^{CH}-C_{i}^{CH}}{IE_{i}^{CH}}\); * Calculation for integrity for a node to become CH--\(l_{CH-CM}(t)=\frac{1}{f}\ \frac{S_{CH-CM}(t)}{S_{CH-CM}(t)+US_{CH-CM}(t)}\); Step 5--Process is repeated until finding the best CH; Step 6--Return End. ```

**Algorithm 1** ROA-based CH selection

### Privacy-Preserving Mobility Model

A privacy-preserving mobility model is introduced here to secure the devices in the network. The major steps involved in this model are new node fusion and migration process. The process of new node fusion is defined as the frequent action taken to improve the computation and memory so as to reduce the transmission overhead of the network. The process of migration process is defined as for the active mobile node to endow with security during the process of joining the new code and migrating the node. The process of cluster creation and CH selection is done using a rider optimization-based CH selection approach. For the privacy-preserving mobility model, we concentrate on new node fusion and node migration. #### 4.4.1 New Node Fusion

Every node in the network is constructed with a chaotic map-based hash pin \(PIN_{hash}\) which helps to compute the secure key among the CH and the CM. In case the node \(N_{j}\) is interested in joining a cluster of \(CH_{j}\), the joining process is described below. At the initial condition, the \(S_{node}\) is ready to transmit the \(PIN_{hash}\) into a new node to compute the hash key among the \(CH_{j}\) and the node \(N_{j}\). Next, the \(N_{j}\) transmit the joining request message to the \(CH_{j}\) with its identification \(ID_{N_{j}}\), time stamp \(TS_{N_{j}}\) with the \(PIN_{hash}\) code. After receiving the joining request message, the \(CH_{j}\) completely checks the message and then the network maintains its blocked node list. The \(CH_{j}\) checks whether the current ID is present in the blocked node list or not, then the \(CH_{j}\) asks the \(S_{node}\) to transmit the \(PIN_{hash}\) code.