An Optimization Scheme for Task Offloading and Resource Allocation in Vehicle Edge Networks

The vehicle edge network (VEN) has become a new research hotspot in the Internet of Things (IOT). However, many new delays are generated during the vehicle offloading the task to the edge server, which will greatly reduce the quality of service (QOS) provided by the vehicle edge network. To solve this problem, this paper proposes an evolutionary algorithm-based (EA) task offloading and resource allocation scheme. First, the delay of offloading task to the edge server is generally defined, then the mathematical model of problem is given. Finally, the objective function is optimized by evolutionary algorithm, and the optimal solution is obtained by iteration and averaging. To verify the performance of this method, contrast experiments are conducted. The experimental results show that our purposed method reduces delay and improves QOS, which is superior to other schemes.


Introduction
Recently, the IOT is a research hotspot of academic and industrial sessions. It consists of all things in life that can connect to the internet, such as mobile phones, laptops, vehicles, etc., with limited CPU capacity and energy characteristics [1]. Vehicle network, as one of the important branches, has become a new research field. With the advent of the 5G era, virtual reality technology (VR), automatic driving and other applications in vehicle network have put forward new requirements for vehicle communication with low delay and low energy consumption [2]. Previous studies have focused on transferring data to cloud computing centers for data processing and feedback of results [3]. Although it takes less time than local processing, the process of data transfer creates additional delays because the physical distance in the cloud center is too remote for mobile devices. MEC technology can solve this problem very well, it transfers the computation of data from the center of cloud computing to the edge of mobile network, and is closer to the vehicle in physical distance [4,5]. By MEC technology, the vehicle can bypass the Internet delay, which can reduce the computation delay and transmission delay. However, the computing power of the edge server is also limited in reality, and it cannot support the computing tasks of all mobile users in the region [6,7]. Therefore, the reasonable allocation of computing resources in the edge server is very important for delaysensitive applications. In the vehicle edge network, this dynamic task offloading scheme is an effective way to reduce the delay of the network. It is decided by the mobile user according to the requirement of service quality and the computing resources of the edge server, that is, either offload the computing task to the edge server for task execution, or the task will be done locally in the mobile device.
Although task offloading is an effective solution for delay-sensitive applications such as automatic driving. However, issues such as which tasks are offloaded to the edge server and which edge servers are selected to perform the offloaded tasks have not been resolved. How to allocate computing resources of edge servers effectively becomes a new challenge. In 2014, a threshold strategy-based service migration mechanism in mobile micro-clouds was proposed [8]. The problems of service performance and service migration became important when users move to the coverage areas of different base stations. They modeled the problem as a Markov decision process (MDP) and demonstrated that the optimal strategy for service migration was a threshold strategy when mobile users follow a random walk mobile model. Aiming at the problem of computing offloading decision among mobile device users, the problem of decentralized computing offloading decision among mobile users as a decentralized computing offloading game was described [9]. This method can realize the Nash equilibrium of the game and concretize the efficiency ratio of the concentrated optimal solution, and finally realize the efficient computing unloading of mobile cloud computing. Based on the current research situation, an evolutionary algorithm-based task offloading and resource allocation scheme, which is used for increasing the delay caused by the unreasonable task offloading and resource allocation, is proposed in this paper. First, we concretize all offloading delay in the vehicle edge network, then the total delay is mathematically modeled. Finally, the evolutionary algorithm is used to optimize the target problem by initializing population, calculating fitness, selecting, crossover and mutation. And then the optimal solution can be obtained after 100 iterations. Based on the real-time task and resource situation, the optimal proportion of task offloading and the optimal scheme of resource allocation can be obtained finally.
This paper is organized as follows: In Section 2, related work will be discussed. Section 3 describes the network model and problem definition. And our proposed method is introduced elaborately in Section 4. Section 5 gives the experimental results of the proposed scheme. Finally, a conclusion is given in Section 6.

Related Work
In edge networks, task offloading and computing resource management have been the focus of research in mobile edge computing. Liu et al. [10] studied the computational resource management problem of delay sensitive class applications in mobile edge networks. They jointly considered the allocation of radio and computational resources to achieve the goal of reducing service delays. First, the delay of the service requested by the mobile user is modeled, including wireless delay, network delay and computing delay: where k d is the task size of the user k, k R is the data transfer rate. , (0,1) k n a ∈ represents whether mobile user k transfer a task to MEC Server n. , k n τ is the network delay between mobile user k and MEC Server n. k c represents the computing resources needed to complete the task of user k. , k n f is the computing resources allocated by MEC Server n.
Then, a delay minimization problem that jointly considers uplink transmission power, task allocation, and computational resource allocation is formed. Finally, using the proposed joint radio and computational resource management (iRAR) algorithm, the delay problem is optimized and its advantages are verified by a large number of simulations.
Luo et al. [11] focused on reducing energy consumption for task unloading in MEC. The authors first consider the energy consumption generated by the interaction between tasks and perform mathematical modeling. Then, the task execution flow is identified by computing k-hop connectivity, so that a directed graph is constructed based on the task interaction matrix and the delay of each task execution flow is formulated. Finally, the energy consumption minimization problem is expressed as a quadratic constrained integer mixed quadratic programming problem, and an effective heuristic method is proposed.
Although many scholars have studied resource allocation schemes in mobile edge networks. However, they only consider the time consumption of task offloading or the additional energy consumption caused by the process. Moreover, there are only two options for mobile user's task uninstall, all transfer and no transfer, ignoring the computing power of mobile user itself.

Network Model
We consider a vehicle edge computing system, as shown in Fig. 1, in which i vehicles are randomly distributed in the communication range of j MEC servers, which are connected by optical fiber between them. All vehicles in the system need to run computing-intensive and delay-sensitive services with the help of MEC servers. Each vehicle can only establish a connection with one MEC server and offload the task to that MEC server. When a vehicle is in multiple MEC server communication range at the same time, the vehicle needs to select the nearest MEC server to establish a connection according to the distance between the vehicle and the server.
where ( , ) i i x y is the location information of the vehicle i, ( , ) j j x y the location information of the MEC server j. Each vehicle has computing tasks, which can be processed locally or unloaded to a MEC server for execution. We denote the unloading ratio of the task j of the vehicle i as , [0,1] i j x ∈ , 0 as not transferred to the MEC server, and 1 as all tasks transferred to the MEC server for execution. We assume that in the vehicle edge computing system, the MEC server has sufficient computing resources to complete the task of vehicle publishing, and does not consider the energy consumption of the MEC server.

Cost of Local Model
Denote the data size of the task, the highest tolerance delay as , i j D (bit), j σ (s) respectively. For task j, the consumption of completing the task is mainly composed of two parts: 1. The energy consumption required to complete the task 2. The time taken to complete the task. For the local computing module, when , 1 i j x ≠ , the remaining , 1 i j x − tasks will be done locally.

Local Execution Delay
For the partly task performed locally, the latency is generated from calculating the task: where k C (cycles/bit) represents the number of CPU cycles of 1 bit data, and L i f (cycles/second) represents the computing capacity of the vehicle i.

Local Execution Energy Consumption
The local computational energy consumption is generated by the vehicle i performing the remaining tasks. We use , L i j E to represent the local computational energy consumption corresponding to the task j: where i Z (J/cycle) is the energy consumption per CPU cycle.

Cost of MEC Model
The whole offloading process consists three steps if the vehicle i decides to offload part of the task to the MEC server for execution: 1. The vehicle i offloads the relevant data of the task to the MEC server j (data size, maximum tolerance delay). 2. MEC server j assign computing resources to execute tasks. 3. MEC server j feedback the result of the task to the vehicle i. Hence, for vehicle i, delay and energy consumption are generated by these three processes.

Latency on MEC Sever
The delay of offloading a task to the MEC server is generated by the following three processes: offload the task, MEC server executes the task, and MEC server feedbacks the result of the task.

Latency of Offloading Task
According to the first step, when the vehicle decides to offload part of the task to the MEC server, it needs to upload the relevant data to the MEC server, and the delay of the task offloading is expressed as where , i j B is the allocated channel bandwidth and SINR is the signal-to-noise ratio. SINR can be obtained by the following formula: . , where , T i j P is the transmission power, , i j O is the channel gain between the vehicle i and the MEC server j, which can be expressed as: where α is the path loss factor and here is set to -4 [12].

Latency of Offloading Computing
For the computing delay in the second step, the MEC server will assign a certain computing resource to execute the task after receiving the task by the vehicle, which can be expressed as: Where M j f is the computing resource assigned by the MEC server to the task j, and its size is limited by the total computing resource of the MEC server M f :

Latency of Result Feedback
In the last step, the MEC server j will feedback the task execution results to the vehicle i, and the time required is the time the vehicle i receives the task results from the downlink, which is expressed as: where ε is the ratio of output data to input data, here we set to 0.1 [13][14][15]. , d i j r is the data transmission rate of the downlink. For vehicles i, we assume that the transmission rate of the uplink is the same as the downlink.
Overall, we represent the total time MEC server to complete the task as follows: , , , ,

Energy Consumption on MEC Sever
In the vehicle edge network, we do not consider the energy consumption of MEC servers. So for vehicles i, we divide the process of generating energy consumption into three steps, specifically: 1. Energy consumption for offloading task data 2. Energy consumption for task calculation 3. Energy consumption for receiving feedback

Energy Consumption of Offloading Task
Firstly, after the vehicle i decides to offload part of the task to the MEC server, the relevant data needs to be uploaded to the MEC server, and the energy consumption of this part can be expressed as , where , i j W is the transmission energy consumption of a bit data.

Energy Consumption of Local Computing
Secondly, when the vehicle i upload part of the task to the MEC server, the remaining tasks need to be performed locally, and the energy consumption of this part has been stated in 3.2.2, which is no longer stated here.

Energy Consumption of Receiving Feedback
Finally, MEC server j need to feedback the task result to the vehicle i after executing the task, and the vehicle needs to consume energy to receive the task result, which is expressed as: Above all, the total energy consumption of the vehicle i to complete the task is generated by the above three processes. We express the total energy consumption as:

Problem Formulation
In our proposed vehicle edge network system, we consider the delay and energy consumption cost synthetically. The total system cost is defined as the weighted sum of total energy consumption and delay, and a new cost function is proposed: λ µ = , λ and µ are the weights of delay and energy consumption, respectively. The values of λ and µ can be adjusted according to the type of service and the remaining energy of the vehicle. For example, when the remaining energy of the vehicle is less than 20%, the value of µ will be much bigger than λ . In our system, the task we study is delay-sensitive services such as automatic driving, so the requirement for delay is higher, λ is set to 0.8 [16][17][18][19] (17) Our goal is to minimize the total system cost by jointly optimizing the task offloading decision of the vehicle i and the resource allocation strategy of the MEC server. In addition, the constraints of limited communication and computing resources need to be considered. We define this joint optimization problem as: where the constraint C1 indicates that the value of the offload strategy is a value between 0 and 1. Constraint C2 ensures the delay constraint of the computational task, and j σ indicates the highest tolerance delay. Constraint C3 shows that the sum of the computing resources allocated by all tasks cannot exceed the computing resources of the MEC server. And constraint C4 ensures that the sum of bandwidth allocated by all tasks cannot exceed the total channel bandwidth.

Proposed Method
P1 is a single-objective optimization function. Our goal is to find optimal task offloading and MEC server resource allocation strategies to minimize the total cost. However, as the dimension of the variables increases, the computational complexity will increase dramatically. To solve this optimization problem, we propose an optimal task offloading and resource allocation scheme based on evolutionary algorithms.

Evolution Algorithm
Evolutionary algorithm is a computational model that simulates biological evolution in nature. It can automatically accumulate the knowledge of solution space in the process of evolution and control the search process adaptively to obtain the optimal solution of the target function. EA is a mature global optimization method with high robustness and wide applicability. Therefore, we use the optimal task offloading and resource allocation scheme based on evolutionary algorithm to minimize the cost function, specifically including the following five steps: 1. Population initialization; 2. Calculate individual fitness; 3. Selection; 4. Mutation; 5. Crossover.

Population Initialization
First, according to the characteristics of the problem (minimization problem) and the range of variables, N population individuals are randomly generated in the solution space: where N represents the population size, M is the dimension of the solution space. , denotes a random number, which is on the interval (0, 1).

Calculate Individual Fitness
The second step is to calculate the individual fitness, which can reflect the gap between the individual of each population and the optimal solution of the problem. Individuals with high fitness have a greater chance of being selected for the next evolution. The fitness of individual population can be obtained by fitness function. Considering that our objective function is a minimization problem, the fitness function Fit can be defined as follow:

Selection
After setting the fitness function, the individual population needs to be screened to leave better offspring for the next round of selection. We determine the rules of selection according to the fitness value of the individual. First, we call the sum fitness of all individuals in the population as the total fitness. Then divide the fitness of each individual by the total fitness to obtain the probability of the individual being selected. We express the selection probability as:

Mutation
In the g-th iteration, for individual { } , , , (g) (g) ;a 1, 2, , ;b 1, 2, , M are randomly selected from it, and r1≠r2≠r3. After mutation, an V + is produced: r is the random number within the interval and F is the scaling factor.

Crossover
At the last step, the g-th generation population { } (g 1), (0,1) where ω is the cross probability between two individuals. In summary, the flow chart of the proposed method is shown in Fig

Simulation
In this section, the environmental settings of the experiment and the results of the experiment are presented to demonstrate the performance of our proposed method. First, the number of all vehicles and MEC servers in the experiment, communication resources and computing resources, and the relevant parameters are set as shown in Tab. 1: To demonstrate the function and performance of the proposed method, we introduce two other computational offloading strategies: 1. The local offloading policy (LE), i.e., the task performs all computational tasks locally; 2. MEC execution policy (ME), i.e., all tasks are offloaded to the MEC server.  As shown in Fig. 3, the average objective function value of the population individual reaches the maximum at the 92nd generation, and the optimal solution of the objective function is 0.187. The values of the decision variables are shown in Tab. 2.
We compare the proposed scheme with the ME and LE schemes, and the results are shown in Fig. 4, which shows that our method is better. Compared to the LE scheme, our scheme significantly reduces the cost of completing the user's task, which is only 13% of the cost of the LE scheme, which is manifested in the fact that the user can get the required at little time and energy. Compared with the ME scheme, the cost of Vehicle 2 and Vehicle 3 decreased slightly, by 9% and 34% respectively, while the cost of Vehicle 1 decreased by 76%. So from the overall point of view of MEC server M, our scheme is better than the ME scheme and can provide better QOS.

Conclusion
In this paper, we combine the definition of vehicle edge network delay with evolutionary algorithm to improve service quality. First, all delays and energy consumption during vehicle task offloading are defined, including three processes: 1. Task offloading 2. Task computation 3. Result feedback. Then, this cost problem is modeled. Finally, the evolutionary algorithm is used to optimize the problem, including population initialization, calculating individual fitness, selection, mutation and crossover, and the optimal solution is obtained by iteration. By comparing experiments, we prove the superiority of this method, which can reduce communication delay and improve service quality (QOS).