# Smart Bandwidth Assignation in an Underlay Cellular Network for Internet of Vehicles
## 4 Methodology
### RB Allocation: XueBlockSolver Algorithm  
In this section, the algorithm developed to face the designed radio resource assignation problem RBAP is described. In this case, we have formulated the RBAP as a combinatorial optimization problem [29]. Combinatorial optimization is one of the most studied fields in artificial intelligence, optimization, logistics, and other applications. Multiple research works are published annually in this area, both in journals [30], and conferences [31], and also in books [32]. Different sort of problems exist within this kind of optimization. In this specific study, we have modeled the RBAP as a combinatorial design problem [33]. In line with this, many different metaheuristics can be found in the literature that are able to deal with this type of problems. In this sense, some of these methods are based on a single search, such as Simulated Annealing [34] and Tabu Search [35], and some others are based on a multiple search (population based algorithms), such as genetic algorithm [36], and the ant colony optimization [37]. Metaheuristics can also be classified in search based algorithms and constructive algorithms. Search based algorithms start from an initial complete solution or an initial set of complete solutions which are modified until reaching a final solution, while constructive algorithms start from a partial solution or a set of partial solutions which are built until reaching an final complete solution. In this study, a population based search algorithm has been designed for solving the RBAP. The philosophy of the presented technique is to have a population of autonomous individuals, which perform single local searches in parallel until the ending criterion is reached. For this reason, the developed technique has been called Multiple and Parallel Block Solver Algorithm (MP-BSA). As it has been mentioned, the RBAP is formulated as a combinatorial design problem. The objective of this problem is to find a configuration which guarantees the QoS, minimizing the number of resource blocks used and maximizing the total throughput. Thus, the problem has been treated as a hierarchical multi-objective one, with a two-leveled objective function. In order to understand this objective function, it is convenient to clarify that we count with three different sets, containing the throughput of every singles CUE and VUE, and every CUE-VUE pair:  
\[X:\{T\_CUE_{1},T\_CUE_{2},T\_CUE_{3},\ \ldots,T\_CUE_{n}\}\]  
\[Y:\{T\_VUE_{1},T\_VUE_{2},T\_VUE_{3},\ \ldots,T\_VUE_{m}\}\]  
\[Z:\{T\_VUE_{CUE_{1}},T\_VUE_{CUE_{2}},\ \ldots,T\_VUE_{CUE_{l}}\}\]Now, the two-leveled objective function that we should minimize is as follows:  
\[\sum_{i=1}^{n}x_{i}\ \sum_{j=1}^{m}y_{j}\ \sum_{k=1}^{l}z_{k} \tag{16}\]  
\[\sum_{i=1}^{n}T\_CUE_{i}x_{i}\ \sum_{j=1}^{m}T\_CUE_{j}y_{j}\ \sum_{k=1}^{l}T\_ VUE\_CUE_{k}z_{k} \tag{17}\]  
The first objective (Equation (16)) is to minimize the number of resource block used. After that, and considering solutions with the same number of resource blocks, the objective is to maximize the total throughput (Equation (17)). To correctly understand these functions, it should be pointed out that \(x_{i},y_{i}\) and \(z_{i}\) are binary variables, which are 1 if the corresponding CUE, VUE and VUE-CUE pair are present in the solution. As can be read in some studies of the literature [38], something important when any algorithm is developed, or operator, is the codification used to represent the partial, or complete solutions of the problem. For this reason, the codification chosen has to be clearly described, since depending on the representation used, some operators can be developed or not. In this study, the permutation representation has been utilized. Thus, each solution is represented by a permutation of the different elements of the environment. Additionally, each resource block is divided by a semicolon, and the elements of the same pair by a coma.