# Dynamic Allocation of SDN Controllers in NFV-Based MEC for the Internet of Vehicles
## 4 Problem Formulation
Since the execution time may directly impact on the response time for the infrastructure requests to the SDN controllers, aSDNalloc decision is based on three perspectives that must be taken into consideration by the heuristic, as described below:  
* How many controllers should be required to meet the vehicular demand without incurring in overload or underutilization of their resources? * How many computational resources (CPU, memory, bandwidth, storage) should be allocated to the SDN controllers? * Which infrastructures (eNBs and RSUs) should be assigned to the SDN controllers? The aSDNalloc was conceived based on the bin packing problem, since there is a need to reduce the number of required bins. In the context of SDN allocation, it means that the objective function will minimize the amount of allocated VNFs to meet the demand from communication infrastructures. This way, a heuristic takes the decision on the suitable number of controllers. aSDNalloc considers four input parameters, as described below:  
1. List of resource capacity templates: a list: \(V=v_{1},v_{2},...,v_{n}\) represents the capacities for each template describing the computational resources created in the MEC in order to allocate SDN controllers. This list aims to provide the necessary information for the heuristic to decide about the most suitable set of resources so that controllers can adequately support each infrastructures' demand. As an example, consider the input \([x,z]\) meaning that the template \(x\) has the capacity to meet a demand \(z\). Thus, aSDNalloc can group a set of \(n\) infrastructures by assuming that the demand of such set must be less or equal than the capacity \(z\). 2. List of requests by RSU: \(D=d_{1},d_{2},...,d_{m}\) is a set of all RSUs, eNBs and their corresponding demands to be supported by the SDN controllers. This input is described as \([a,t]\), where \(a\) is the infrastructure identifier and \(t\) its respective number of requests. 3. \(\omega\): Threshold for the maximum utilization of VNFs. It aims to avoid resource starvation due to excessive utilization of computational resources, which could degrade \begin{table}
\begin{tabular}{c c} \hline \hline
**Symbol** & **Definition** \\ \hline \(i,N\) & Index, set of VNF controllers. \\ \hline \(j,M\) & Index, set of RSUs. \\ \hline \(\omega\) & Resource reservation factor \\ \hline \(X_{ij}\) & Binary, \(X_{ij}=1\) if controller \(i\) is assignment to RSU \(j\)0, otherwise. \\ \hline \(\gamma_{i}\) & Binary, \(Y_{i}=1\) if controller \(i\) is chosen; 0, otherwise. \\ \hline \(C_{i}\) & Capacity of each VNF controller \(i\) \\ \hline \(D_{j}\) & Number of requests of vehicles to each RSU \(j\) \\ \hline \(V\) & List of resource capacity templates \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Notations. the QoS. Thus, aSDNulloc allows the definition of the amount of allocated resources that should be utilized to support a demand. For example, in a case where \(\omega=0.9\), 90% of the resources can be used, while 10% will correspond to a reservation to grant QoS and amortize the demand due to the vehicle mobility among communications infrastructures. 4. \(\beta\): defines a multiplier for the infrastructure load in order to determine the minimum capacity of the controller to meet a demand. This parameter aims at reducing the number of SDN controllers, hence, diminishing the management complexity for the environment. To this end, a hypothetical example where \(\beta=10\) should be interpreted in the following way: In the case of there is no already allocated controller with available resources to meet the demand of a certain infrastructure, a new controller should be created with a minimum capacity 10 times greater than the demand for that infrastructure. The pseudo-code is shown in Algorithm 1. aSDNulloc first assigns to \(d_{max}\) the RSU with the greatest number of requests from the list \(D\), and to \(g_{unsted}\) the controller with the largest wasted capacity from list \(G\) (lines 3-4).