## 2 Adaptive Streaming Algorithm for Internet of Autonomous Vehicles
### Real-Time Vehicle Speed Calculation at a RSU  
To predict autonomous vehicle driving speeds, the BILSTM model mentioned earlier is utilized with historical data. This architecture processes information simultaneously in both the forward and backward directions, with the overarching goal of enhancing the accuracy of driving speed predictions for autonomous vehicles. The BILSTM model, as introduced in [27] and depicted in Figure 3, serves the purpose of estimating the average speed of autonomous vehicles as they enter specific road segments. The BILSTM framework builds upon the foundation of the Long Short-Term Memory (LSTM) model [33] and incorporates two distinct LSTM components. One component specializes in processing forward time sequences, while the other is tailored for handling backward time sequences. This dual-component configuration allows for the simultaneous integration of bidirectional information, effectively addressing the limitations encountered in conventional LSTM models due to data scarcity. The outcome is a noticeable improvement in prediction accuracy, as demonstrated by findings in the literature [34]. The conventional LSTM architecture comprises an input layer, a recurrent hidden layer composed of memory blocks as foundational components, and an output layer. Within each memory block, interconnected memory cells preserve temporal states. Moreover, three adaptable multiplication gate cells--the input gate, output gate, and forget gate--oversee the information flow within the block. In the context of the unidirectional LSTM model, it predicts information for a specific future time by utilizing historical data in the following manner:  
\[f_{t}=\sigma\Big{(}W_{f}\cdot[y_{t-1},x_{t}]+b_{f}\Big{)} \tag{1}\]  
\[i_{t}=\sigma(W_{i}\cdot[y_{t-1},x_{t}]+b_{i}) \tag{2}\]  
\[s_{t}=\tanh(W_{s}[y_{t-1},x_{t}]+b_{s}) \tag{3}\]  
\[C_{t}=f_{t}C_{t-1}+i_{t}s_{t} \tag{4}\]\[o_{t}=\sigma(W_{o}\cdot[y_{t-1},x_{t}]+b_{o}) \tag{5}\]  
\[y_{t}=o_{t}\text{tanh}(C_{t}) \tag{6}\]  
where \(f_{t}\) and \(i_{t}\) denote the forget and input gates of the LSTM, respectively. \(y_{t-1}\) is the previous output result. \(x_{t}\) stands for the input at time \(t\), and \(\sigma(\cdot)\) represents the sigmoid activation function. \(W_{f}\) and \(W_{i}\) denote the weights of the forget and input gates, respectively, and \(b_{f}\) and \(b_{i}\) are the bias vectors of the forget and input gates, respectively. The input values \(x_{t}\) and \(y_{t-1}\) play a role in deciding the relevant updates to the cell state, utilizing the sigmoid activation function of the input gate. This process leads to the generation of a new cell candidate state, denoted as \(s_{t}\), which is achieved through the \(\text{tanh}(\cdot)\) activation function of the input gate.\(W_{\text{s}}\) and \(b_{\text{s}}\) denote the weights and bias of the cell candidate state, respectively. By utilizing the forgetting gate and the input gate, the cell state \(C_{t-1}\) undergoes an update to become \(C_{t}\). Following this update, the output gate \(o_{t}\) is activated using the sigmoid function. Here, \(f_{t}C_{t-1}\) represents the information to be forgotten, and \(i_{t}s_{t}\) stands for the information to be added. In the final step, the new cell state \(C_{t}\), after undergoing the \(\text{tanh}(\cdot)\) transformation, is multiplied by the output gate \(o_{t}\), resulting in the output value \(y_{t}\). \[\overrightarrow{y}_{t}=\text{LSTM}\left(x_{t},\overrightarrow{y}_{t-1}\right) \tag{7}\]  
\[\overleftarrow{y}_{t}=\text{LSTM}\left(x_{t},\overleftarrow{y}_{t-1}\right) \tag{8}\]  
\[y{{}_{t+1}}=\text{OL}\left(W_{\overrightarrow{y}_{t}}\overrightarrow{y}_{ t}+W_{\overleftarrow{y}_{t}}\overleftarrow{y}_{t}+b_{y^{\prime}}\right) \tag{9}\]  
Here, \(\overrightarrow{y}_{t}\) and \(\overleftarrow{y}_{t}\) represent the output results of the forward and backward LSTM, respectively. The LSTM \((\cdot)\) mentioned in Equations (8) and (9) denotes the unidirectional LSTM.