# Resource Allocation in C-V2X Mode 3 Based on the Exchanged Preference Profiles
## 4 Resource Allocation via Matching
### Exchanged Preference Profiles
It is noted that if multiple VUEs propose to the same CUE simultaneously, the CUE reserves its most-preferred one and sends a signal to the others. Those VUEs receiving the signal add the CUE to their preference profiles again to eliminate the externalities. The algorithm does not terminate until the two consecutive matching results remain unchanged. The stability can be proved by Theorem 1. Theorem 1: _Algorithm 1 converges to a stable allocation._```
1:Initialization: Establish the preference profiles of VUEs \(\mathcal{P}_{k}\) and CUEs \(\mathcal{P}_{m}\). Set the rejected set \(\mathcal{L}_{m}=\emptyset\) and the unassigned set \(\mathcal{A}=\mathcal{K}\). Set the initial time slot \(t=1\) and the candidate set \(\mathcal{C}_{m}=\emptyset\), which denotes the VUEs propose to CUE \(m\) simultaneously. 2:while\(\mu^{(t)}\
eq\mu^{(t-1)}\)do
3:\(t\gets t+1\). 4:for\(\forall k\in\mathcal{A}\)do
5: VUE \(k\) proposes to its most-preferred CUE \(m\) according to \(\mathcal{P}_{k}{}^{(t)}\), and removes CUE \(m\) from \(\mathcal{P}_{k}{}^{(t)}\). 6:if\(\left|\mathcal{C}_{m}{}^{(t)}\right|>1\)then
7:\(\mu^{(t)}(m)=k^{*},k^{*}\succ_{\mathcal{C}}k^{\prime},\forall k^{\prime}\in \mathcal{C}_{m}{}^{(t)}\backslash k^{*}\). 8:\(\mathcal{P}_{k^{\prime}}{}^{(t)}\leftarrow\mathcal{P}_{k^{\prime}}{}^{(t)}\cup m\). 9:endif
10:if\(\left|\mu^{(t)}(m)\right|=n_{q}\)then
11:if\(\exists k^{\prime}\in\mu^{(t)}(m),k\succ_{\mathcal{C}}k^{\prime}\)then
12:\(\mu^{(t)}(m)\leftarrow\mu^{(t)}(m)\backslash k^{\prime}\). 13:\(\mu^{(t)}(m)=\mu^{(t)}(m)\cup k\). 14:\(\mathcal{L}_{m}{}^{(t)}\leftarrow\mathcal{L}_{m}{}^{(t)}\cup k^{\prime}, \mathcal{A}\leftarrow\mathcal{A}\backslash k\). 15:else
16:\(\mathcal{L}_{m}{}^{(t)}\leftarrow\mathcal{L}_{m}{}^{(t)}\cup k\). 17:endif
18:else
19:\(\mu^{(t)}(m)=\mu^{(t)}(m)\cup k\). 20:\(\mathcal{A}\leftarrow\mathcal{A}\backslash k\). 21:endif
22:endfor
23: Update the preference profile \(\mathcal{P}_{k}^{(t)},\forall k\in\mathcal{A}\). 24:\(\mathcal{P}_{k}^{(t)}\leftarrow\mathcal{P}_{k}^{(t)}\backslash m,k\in\mathcal{ L}_{m}{}^{(t)},\forall m\in\mathcal{M}\). 25:endwhile
```

**Algorithm 1** Spectrum Resource Allocation Algorithm

**Input:** The \(k\)-th generation of VUEs \(\mathcal{P}_{k}\) and CUEs \(\mathcal{P}_{m}\). **Output:** The \(k\)-th generation of VUE \(k\). putational complexity of Algorithm 1 is \(O(KM\log(KM)+KM)\), which is reasonable for a practical implementation. ## 5 Numerical Results and Discussion

### Scenario Setup

In this section, the objective was to validate the resource allocation efficiency and fairness performance of our proposed algorithm compared to the minimum capacity maximization (MCM) algorithm in [8] and the random selection scheme. We used the [PERSON]'s fairness index to measure the fairness performance of different algorithms [30]. The MCM algorithm was a max-min scheduler that exploited the Hungarian method and bisection search, and the spectrum-sharing assignment of the MCM algorithm was what the Hungarian method yielded when the bisection search ended. The Hungarian method of the MCM algorithm was to find the minimum capacity among all CUEs, and the bisection search was to maximize the minimum capacity value. In the random selection scheme, the reused pairs between the CUEs and VUEs were selected randomly. We considered a highway segment of 800 m with three lanes in each direction, and the road width was set to 3 m. The BS was located at the midpoint of the highway and 35 m away from the road. The vehicles were dropped on the highway segment according to the Poisson process, and a vehicle could only be a CUE or a VUE. The CUEs and VUEs were randomly selected among the generated vehicles, and the V2V links were formed between neighboring vehicles. The vehicle's mean velocity was 70 km/h, and the standard deviation of the velocity was 10 km/h. The simulation scenario setup is shown in Figure 4. We assumed that the vehicles' velocities remained constant during the communication process. The channel models for V2V and V2I links were consistent with those of [8].