## 2 Materials and Methods
### Optimization Mechanism Design  
This section describes the proposed design of integrating TOM and DEM with AODV and GPSR routing protocols. The goal of this method is to find the optimum protocol's configurations for a running VANET scenario and save them as routing protocols profiles. A routing profile is a set of routing configuration values that have been optimized to improve network performance. The TOM involves experimental-based optimization, where the optimum solution is found for a set of experiments (OA). The implementation of this method in a routing protocol is presented here, where we perform these experiments (OA) by broadcasting a special message in the network; then, we measure the network performance for the received responses. This operation results in measuring the performance of the network for different routing configurations, in line with OA design of experiments, and storing them in a results table. By repeating the last process N times, the mechanism will be able to perform the TOM calculations and obtain the TOM solution. This operation is followed by performing the DEM calculation to find a solution for all  
Figure 4: CM-Routing mechanism overall process flow diagram. network performances combined. The implementation of the optimization process divides the network nodes into RSUs and vehicles (OBUs). RSUs are authorized to initiate the optimization process and store the optimum solution as a routing profile. OBU responses to the RSU message with a formatted reply message. The communication between RSU and OBU are accomplished with the use of a special designed message named an Optimization Control Message (OCM). The OCM structure is shown in Figure 4. The OCM has three types: OCM, REP, and profile. OCM type is used for broadcasting the optimum desired configuration when the RSU starts the process. OCM-type data carry values for three parameters that represent the control factors values for one experiment in the OA set. OCM id is a unique incremental sequenced number generated by the RSU to identify the optimization operation. OCM k is the number of experiments in the OA set for the message. OCM id and OCM k are generated by the RSU and used by the OBU to identify and differentiate between the optimization experiments of the received messages. REP type has the same header as OCMs but carries different data. REP data contain the OBU IP address and the decision made for its parent OCM. REP is generated by the OBU and sent in unicast to a specific RSU. REP is used by the RSU to calculate the network performance for the kth experiment in the OA set, where k is the OCM k field in the header, as shown in Figure 5. Profile type is generated by the RSU at the end of the optimization operation. OCM profile type carries the optimum configuration for the network and broadcasts to all OBUs within the reach of the RSU. The OCM id is used by OBUs to identify the freshness of the carried configuration. Other parameters in the header are ignored for this type. The process of optimization is divided into two parts: OBUs and RSUs. The following subsection details this process for each part. The OBU receives two types of requests from the RSU: OCM and profile. OCM type is received during the optimization operation, and profile type is received at the end of the operation. When an OBU receives an OCM, it starts by evaluating the carried configuration to process the message accordingly, and then creates a REP_OCM message. REP_OCM contains two pieces of information, the OBU id and the possibility to receive the parent OCM RES. OBU id is the IP address of the OBU, and the second parameter is a decision made based on the information contained in the parent OCM. For the OBU to make this  
Figure 5: Optimization Control Message structure. decision, it starts by evaluating the configurations in the OCM.