## 4 Data Acquisition via V2U Communications
### Multi-Replica Content Preprocessing Algorithm  
In a vehicular network, a content may be replicated at more than one roadside unit, while the stable matching algorithm only supports one-to-one mapping. In order to address this contradiction, a multi-replica content preprocessing algorithm, as displayed in Algorithm 1, is conducted before executing the problem transformation. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \(p(c_{k},u_{j})\) & \(u_{1}\) & \(u_{2}\) & \(u_{3}\) & Ranking \\ \hline \(c_{1}\) & 0 & 0 & 1 & \(u_{3}\succ u_{1}=u_{2}\) \\ \(c_{2}\) & 2 & 1 & 1 & \(u_{1}\succ u_{2}=u_{3}\) \\ \(c_{3}\) & 1 & 1 & 2 & \(u_{3}\succ u_{1}=u_{2}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The preference profile of contents. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \(q(u_{j},c_{k})\) & \(c_{1}\) & \(c_{2}\) & \(c_{3}\) & Ranking \\ \hline \(u_{1}\) & 4 & 1 & 1 & \(c_{2}=c_{3}\succ c_{1}\) \\ \(u_{2}\) & 4 & 3 & 3 & \(c_{2}=c_{3}\succ c_{1}\) \\ \(u_{3}\) & 1 & 2 & 1.5 & \(c_{1}\succ c_{3}\succ c_{2}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The priority rankings of roadside units. Figure 2: An instance of stable matching. (a) the relationships among \(\mathcal{C}\), \(\mathcal{V}\) and \(\mathcal{U}\); (b) the stable matching. ```
Input:\(\mathcal{V}\), \(\mathcal{U}\), \(\mathcal{C}\), \(F\) Output \(\mathcal{C}\), \(F\) for\(\forall\)\(c_{k}\in\mathcal{C}\)do  initialize: \(FK\leftarrow\emptyset\), \(FV\leftarrow\emptyset\);  initialize: \(HC\leftarrow\emptyset\), \(HU\leftarrow\emptyset\), \(HV\leftarrow\emptyset\); for\(\forall\)\(v_{i}\in\mathcal{V}\)do if\(f_{k}\)=1 then \(FK\gets FK\cup\{v_{i}\}\); for\(\forall\)\(u_{j}\in\mathcal{U}\)do if\(g_{ij}\)=1 then \(FV(u_{j})\gets FV(u_{j})\cup\{v_{i}\}\);  end if  end for  end for  end for  sort \(\mathcal{U}\) in descending order of \(|FV(u_{j})|\); for each roadside unit \(u_{j}\in\mathcal{U}\) in the above order do if\(HC=FK\)then  break;  end if if\(FV(u_{j})\
ot\subset HC\)then \(HV(u_{j})\gets FV(u_{j})-HC\); \(HC\gets HC\cup HV(u_{j})\); \(HU\gets HU\cup\{u_{j}\}\);  end if  end for if\(|HU|>1\)then for\(\forall\)\(u_{j}\in HU\)do  create a replica of \(c_{k}\) denoted by \(c_{k}^{l}\);  add \(c_{k}^{l}\) into \(\mathcal{C}\);  add the requests of \(c_{k}^{l}\) from \(HV(u_{j})\);  end if  remove the original content \(c_{k}\) from \(\mathcal{C}\);  remove the requests of \(c_{k}\);  end if  end for  update \(F\) on the basis of the new contents and requests; return\(\mathcal{C}\), \(F\)
```  
**Algorithm 1**Multi-replica content preprocessing algorithm. This algorithm aims to generate a minimum number of replicas for every potential multi-replica content, each of which is regarded as an independent content and serves for a part of the original requests in the following stable matching process. Five variables are introduced, including: \(FK\) is the vehicular nodes requesting \(c_{k}\); \(FV(u_{j})\) is the vehicular nodes which request \(c_{k}\) and will meet \(u_{j}\); \(HC\) is the vehicular nodes whose requests of \(c_{k}\) could be satisfied already; \(HU\) is the roadside units which need to carry a replica of \(c_{k}\); \(HV(u_{j})\) is the vehicular nodes which need to download \(c_{k}\) from \(u_{j}\). In addition, the replication checking is carried out by \(\mathcal{U}\) in descending order of \(|FV(u_{j})|\). It helps to reduce the number of replicas to be generated because a roadside unit which may satisfy more requests should have a higher possibility to carry one replica, and hence the number of remaining unsatisfied requests decreases quickly. This algorithm substitutes several new independent contents each having one replica for content having two or more replicas. In this way, a one-to-many mapping is formulated as several one-to-one mappings, and hence the Gale-Shapley algorithm works. Still discussing the instance shown in Figure 2, we assume \(v_{3}\) also requests \(c_{2}\). In other words, \(c_{2}\) has three requests from \(v_{1}\), \(v_{2}\) and \(v_{3}\), as displayed in Figure 3a.