# An Emergency Message Routing Protocol for Improved Congestion Management in Hybrid RF/VLC VANETs
## 4 Algorithm Description
### Proposed Routing Protocol
The bin packing formulation finds the minimum number of frequencies \(F^{\prime}\) from the available set \(F\) to assign all ROI weights \(W\) while respecting bin capacities \(B\) (B is the set of frequency bin capacities \(b_{1},b_{2},...,b_{m}\)) and avoiding interference \(I\). Let \(F\) be the set of available VLC frequencies (bins), \(w_{i}\) is the weight of ROI \(i\) based on density \(T_{i}\) (item size), \(b_{f}\) is the capacity of frequency bin \(f\), and \(I_{ij}\) is the interference between ROIs \(i\) and \(j\). The bin packing formulation treats \(w_{i}\) as items to pack into bins \(f\) while respecting interference constraints. Specifically, \(g(T_{i},I_{i})\) aims to minimize the number of bins/frequencies used:  
\[g(T_{i},I_{i})=\operatorname*{argmin}_{F^{\prime}}|F^{\prime}| \tag{19}\]  
Subject to:  
\[C_{1}:F^{\prime}\subseteq F\text{ is the set of assigned frequencies}\] \[C_{2}:\forall i\in 1,\ldots,n,\exists\text{ single }f^{\prime}\in F^{\prime}\text{ such that }w_{i}\text{ is packed in bin }f^{\prime}\] \[C_{3}:\forall f^{\prime}\in F^{\prime},\sum_{i}w_{i}\leq\ b^{ \prime}_{f}\] \[C_{4}:\forall(i,j)\text{ where }I_{ij}>0,\text{ assign }w_{i},w_{j}\text{ to distinct }f^{\prime},f^{\prime\prime}\in F^{\prime}\]  
where \(C_{1}\) ensures that the assigned frequencies \(F^{\prime}\) are chosen from the available set of frequencies \(F\). This confines the solution to the feasible space. \(C_{2}\) guarantees that each ROI weight \(w_{i}\) is assigned only one frequency bin \(f^{\prime}\). It enforces a one-to-one mapping between weights and bins. \(C_{3}\) requires the total weight packed in any single bin \(f^{\prime}\) cannot exceed the capacity \(b^{\prime}_{f}\) of that bin. It avoids overfilling frequency channels. For any pairs of ROIs \(i\),\(j\) that interfere (\(I_{ij}>0\)), \(C_{4}\) allocates their weights \(w_{i}\), \(w_{j}\) to different bins \(f^{\prime}\) and \(f^{\prime\prime}\). It ensures interfering weights do not share the same frequency. **Schedule Publishing**: After RSU determines all available RF channels and VLC frequencies/beams that can be used across different zones, RSUs broadcast schedules S over RF and VLC. The S contains the set of hopping sequences for RF channels/VLC frequencies \(H=h_{1},h_{2},\ldots h_{i}\) of channels/frequencies and transmission time, with \(T_{i}\) as the set of all time slot allocations. The RSU defines hopping sequences for each resource, specifying the cyclic order in which the resource will hop between other candidates over time. \[C_{ROI_{i}}=f(T_{i},I_{i}) \tag{15}\]0  
\[C_{ROI_{i}}=f(T_{i},I_{i}) \tag{15}\]1  
where \(h\) is a schedule, \(T_{n}\) is the end time of vehicle n, \(T_{0}\) is the ideal finish time. This chooses schedule \(h\) to minimize latency variance from optimal time. (\(T_{n}-T_{0}\)) is simply calculating the error/difference between the actual time \(T_{n}\) and desired/target time \(T_{0}\). The \({}_{+}\) indicates rectification. This sets any negative errors/differences equal to 0. So if (\(T_{n}-T_{0}\)) was negative, it would be truncated to 0. The \(S\) is broadcast periodically by the RSU to synchronize all the vehicles. Resources are dynamically hopped per \(S\) to enhance throughput over time as traffic patterns change. **Association**: Vehicles are associated with the best RSU using the received signal strength indicator (RSSI) as given in Equation (22)  
\[C_{ROI_{i}}=f(T_{i},I_{i}) \tag{15}\]2The RSSI would be based on the schedule S broadcast periodically by the RSU, as S contains the hopping sequences and time slots defining when and how the assigned RF/VLC resources for that RSU's zone. **Beacon Splitting**: The RSU divides the beacon B transmitted by the vehicles at location L over RF into \(P_{even}\) or \(P_{odd}\) depending on NLoS or LoS as shown.