## 2 Materials and Methods
### Optimization Mechanism Design
These configurations, such as Beacon interval in the GPSR protocol and Hello Interval in the AODV, are different for each routing protocol, and the evaluation process is achieved by comparing their values in the OCM message and the current configuration in the protocol. The evaluation comes with a decision of whether this message receivable or not. Once the REP_OCM is generated, the OBU will start to send it to the RSU and re-broadcast the original OCM to its neighbors. The implementation pseudocode of this process is presented in Figure 6.  
The second type of message received by the OBU is a profile OCM. The profile OCM contains the optimized configuration, as calculated in the RSU. For the OBU to adopt the received profile, it first checks if the OCM id is fresh or not, this is achieved by comparing the current profile id and the RSU id with the received one. For example, if the received OCM id is greater than the current adopted profile and the RSU id is registered as the closest RSU, the received profile will take over the current one. Otherwise, the message will be ignored. The pseudocode of this process is show in Figure 7.  
The RSU is responsible for initiating the operation, receiving and processing responses from the OBU, and calculating and obtaining the optimized configuration and distributing the obtained configuration to OBUs. The time process following these operations is presented in Figure 8. The initialization of the optimization process should take place for a noticeable change in the network scenario. RSUs are static (immobile) nodes in VANETs; this implies their attachment to the same network scenario all the time. VANET network conditions may change in terms of scalability (number of OBUs) for different times during a day \"the road traffic condition changes during high traffic hours\"; for that, a day time-based approach is preferable to start the optimization process in RSUs and should be controlled by the network administration or  
Figure 6: Pseudocode of the receive OCM message in the OBU. Figure 7: Receive profile process pseudocode in the OBU. The first step in the RSU is the construction of the OCM messages. The RSU starts by generating a new id for this process to be attached with all OCM messages in the process. This followed by generating a set of 9 OCM messages. Each OCM contains a different set of configurations for one experiment in the OA sets for AODV and for GPSR, as shown in Table 1. OCM k parameters are the experiment number in the OA set. For example, to generate an OCM with k = 2 for AODV protocol with id = 231, the OCM protocol will produce the OCM depicted as presented in the supplementary file provided in [1]. Once messages are generated, a protocol is responsible for generating a table of 9 rows. These rows will be used to store the evaluated performance from the received responses of OCM id mapped to row numbers. This mapping process is necessary for TOM calculations. Following the generation of OCM messages and creation of the results table, the protocol starts to broadcast the OCM messages in the network and starts REP_OCM receiving mode for a certain time duration called the Optimization Process Time (OPT). The OPT is used to define a total time for the whole process and should be more than twice the time needed for a message to go through the network. For example, assuming that the maximum number of hopes in the network is 5, then this time should be more than 2x5 xRTT. Where RTT is the maximum expected round trip time for one hope. The RSU during REP_OCM receiving mode is responsible for receiving REP_OCM from OBUs, collecting statistics from the incoming responses, and mapping them to the results table. The results table is used to store the collected statistics for optimization calculations and contains 9 rows. The simulation study was validated based on three sets of experimental work conducted, as shown in the Supplementary Materials provided.