# A Deep-Learning-Based Secure Routing Protocol to Avoid Blackhole Attacks in VANETs +
## 3 System Model
### The Proposed DLC Protocol: The Underlying Structure
Furthermore, (2c) explains that the cosine similarity must be greater than equal to the cosine similarity threshold, (2d) explains that the cosine distance must be lower than equal to the cosine distance threshold, and (2e) explains that the remaining energy of the CH must be greater than equal to energy threshold, respectively. To find the optimal weight in (2b), we use the proposed DNN model, which is elaborated on in detail in the forthcoming Section 4.1. Using a DNN model to optimize the weights of a fitness function can provide a more efficient and accurate solution compared to iteration-based algorithms, especially when dealing with large-scale, high-dimensional, and complex problems. Moreover, the iteration-based algorithm spends so much time finding the optimal weights compared to the DNN model. This efficiency can lead to reduced delays in the optimization process and ultimately improve the performance of the overall system. Here, we consider cosine similarity, which serves as a measure of similarity between the movement patterns of vehicles. Vehicles with high cosine similarity have similar movement patterns and, therefore, can be grouped together in the same cluster. The cosine similarity between two nodes can be defined as [36]  
\[\langle\texttt{Type},\texttt{S}_{\texttt{ID}},\texttt{D}_{\texttt{ID}}, \texttt{E}\rangle\]1  
where \(\vec{V}_{k}\) and \(\vec{V}_{l}\) are the \(k^{th}\) and \(l^{th}\) node's vector information list, respectively. Each node \(\vec{V}_{k}\) is associated with vector information metric values such as speed, direction, and location. It can be defined as \(\vec{V}_{k}=(\vec{V}_{1},\vec{V}_{2},...,\vec{V}_{l})\), where \(\vec{V}_{k}\) indicates a value that denotes the association between nodes. Furthermore, we consider the cosine distance between mode \(n_{k}\) and its neighbor. We may control CM to create a more stable CM from the perspective of mobility by taking into account the highest cosine similarity under the constrained communication distance. Therefore, the cosine distance can be defined as [37]  
\[\langle\texttt{Type},\texttt{S}_{\texttt{ID}},\texttt{D}_{\texttt{ID}}, \texttt{E}\rangle\]2  
Here, we also consider the remaining energy of the node. By considering the remaining energy, we can design energy-efficient clustering protocols that take into account the energy consumption of nodes, ultimately prolonging their lifetime. To establish an accurate and reliable energy model, we reference the work of [7; 8], which provide comprehensive insights into energy-efficient approaches in wireless networks. Then, the selected CM can be mathematically formulated as  
\[\langle\texttt{Type},\texttt{S}_{\texttt{ID}},\texttt{D}_{\texttt{ID}}, \texttt{E}\rangle\]3  
where \(\text{F}_{k}\) indicates the fitness function value of node \(n_{k}\), and \(\text{F}_{l}\) indicates the fitness function value of neighbor CH near node \(n_{k}\) and goes to **Step 5.2**. Step 5.2: If \(n_{k}\) chooses the CH, then the join cluster (JC) packet is sent by \(n_{k}\) to the CH. This happens when node \(n_{k}\) receives only one CHI packet; it directly sends the JC packet. The following fields are included in the JC packet:  
\[\langle\texttt{Type},\texttt{S}_{\texttt{ID}},\texttt{D}_{\texttt{ID}}, \texttt{E}\rangle\]4  
where Type represents the packet type, \(\texttt{S}_{\texttt{ID}}\) represents the source node ID, \(\texttt{D}_{\texttt{ID}}\) represents the destination node ID, and Stat represents the node status, whether it will be GW or not, respectively. Then, go to Step 6. * **Step 6: Cluster Members and Cluster Heads Table Updates**  
Node \(n_{k}\) sends the JC packet to CH. When the CH receives the JC packet, it replies with an accept cluster (AC) packet. The following fields are included in the AC packet:  
\[\langle\texttt{Type},\texttt{S}_{\texttt{ID}},\texttt{D}_{\texttt{ID}}, \texttt{E}\rangle\]5  
where Type represents the packet type, \(\texttt{S}_{\texttt{ID}}\) represents the source node ID, and \(\texttt{D}_{\texttt{ID}}\) represents the destination node ID, respectively.