Research on task-offloading decision mechanism in mobile edge computing-based Internet of Vehicle

As a technology integrated with Internet of things, mobile edge computing (MEC) can provide real-time and low-latency services to the underlying network and improve the storage and computation ability of the networks instead of central cloud infrastructure. In mobile edge computing-based Internet of Vehicle (MEC-IoV), the vehicle users can deliver their tasks to the associated MEC servers based on offloading policy, which improves the resource utilization and computation performance greatly. However, how to evaluate the impact of uncertain interconnection between the vehicle users and MEC servers on offloading decision-making and avoid serious degradation of the offloading efficiency are important problems to be solved. In this paper, a task-offloading decision mechanism with particle swarm optimization for MEC-IoV is proposed. First, a mathematical model to calculate the computation offloading cost for cloud-edge computing system is defined. Then, the particle swarm optimization is applied to convert the offloading of task into the process and obtain the optimal offloading strategy. Furthermore, to avoid falling into local optimization, the inertia weight factor is designed to change adaptively with the value of the objective function. The experimental results show that the proposed offloading strategy can effectively reduce the energy consumption of terminal devices while guarantee the service quality of users.

limited computing power, long-term continuous low latency and high quality of service requirements [2].As a technology usually integrated with IoT, MEC can supply services and cloud computing functions needed by wireless users nearby and has the potential to provide real-time, low-latency services to the underlying network [3].Compared with the traditional cloud architecture, the number of data centers with mobile edge computing is relatively small, and seems to be more suitable for the delay, responsiveness and privacy requirements of those advanced services.At present, it is a trend to promote the development of MEC technology through the integration of technology of mobile computing and wireless communication [4][5][6].In order to further reduce the response delay of user requests and the energy consumption of mobile terminal and network, it is necessary to exploit more feasible ways to improve the efficiency of resource utilization.
In order to improve the urban traffic conditions, the Internet of Vehicle (IoV) as a new paradigm is introduced to enhance the information interaction between vehicles and people [7].In the IoV environment, the vehicle is connected to devices such as smart cameras, sensors and actuators.By the transmitters and receivers in above signal collecting system, vehicles can connect to remote infrastructure and other vehicles [8].However, with the rapid increase in road traffic, the gap between the requirements of communication services and the limited vehicle capacity has become a serious problem.The on-board network is facing the challenge of providing ubiquitous connection and high-quality service for many vehicles.In order to solve those problems, MEC has been explored as a promising technology in vehicular networks by using computing resources at the edge of vehicular wireless access networks [9,10].As a typical application of IoT technology in the field of the intelligent transportation system, IoV can realize intelligent traffic management and introduce more mature conventional applications, which include path planning, navigation, autonomous driving, intelligent-assisted driving and augmented reality for vehicles, online interactive games and other rich media applications for passengers [11,12].However, focusing on the various computing tasks with different granularity and quality of service (QoS) requirements, it is not enough to rely on the lightweight edge server placed on the roadside unit.It is a great challenge to ensure the normal and efficient operation of those highly complex services, especially to provide stable and reliable connections and high-quality network services for a large number of vehicles [13,14].
MEC can be applied as the core access points for task transmission and processing of the edge computing resources in IoV [15].Due to the delay caused by the distance between the edge IoT devices and the data center, the function related to the average task latency and resource cost should not be ignored in the centralized cloud model [16,17].As the number of edge devices grows exponentially, high latency can be a huge challenge for many applications that involve end-to-end communication.
The remainder of the paper is organized as follows.Section 2 reviews the related works.Section 3 presents problem formulation.The proposed task-offloading decision mechanism is presented in Sect. 4. The simulations and analysis are provided in Sect.5, and the conclusions are presented in Sect.6.

Related work
Due to the limited computing power, storage and energy of mobile devices, task scheduling is a classic method to transfer tasks to external platforms [18,19].It can improve computing efficiency, reduce task completion time and effectively make use of the resources of other devices.Since the edge computing network has the characteristics of ultra-dense deployment and simultaneous access of a large number of users, the selection of user computing task mode is extremely important and directly determines the computing time and cost of the system.
Wang et al. [20] designed a multilayer model integrated with user layer, access layer and cloud to jointly process user data, which defined the allocated computing and transmission resources for each device and constructed a convex optimization problem to obtain the optimal resource allocation strategy.Zhang et al. [21] exploited the virtualization technology to allocate resources online in dense cloud wireless access network and used Lyapunov optimization theory to achieve the tradeoff between the average energy consumption and delay.Prof. Chen et al. [22] proposed an improved the search tree algorithm by using the branch and bound method to solve the delay minimization problem of computational offloading and resource allocation.By establishing the cloudedge cooperation model, Zhao et al. [23] designed the optimal decision making scheme to transfer the request to the edge server or cloud server for serial processing, in which different mobile device requests should pass through the access point in chronological order.In order to maximize resource utilization, Dr. Ning et al. [24] proposed to combine multiple edge servers for cache allocation and computational offload.Based on the Stackelberg game theory, Salahuddin et al. [25] introduced a strategy to decide whether to unload the computation tasks or not according to the decision of the operator and other devices, so as to achieve the optimal profit.Lee et al. [26] adopted the idea of user centered fair resource allocation and defined a user-centered utility function with weighted the user's delay tolerance, bit error rate and energy consumption.
The introduction of edge computing can greatly shorten the physical distance between on-board tasks and computing resources.Compared with the central cloud infrastructure, the IoV cloud-edge computing can provide real-time and low-latency services.Aiming at the problem of energy consumption control based on edge server, Kumar et al. [27] constructed an efficient and energy-saving IoV resource scheduling framework based on mobile edge computing for large scale and wide distribution of the vehicles.Yu et al. [28] proposed a MEC based offloading method in IoV for the selection of the optimal MEC server for task management.The method comprehensively considered the vehicle mobility and computing tasks to make the offloading decision.Zhang et al. [29] developed an energy-saving computing offloading scheme in multi-user fog computing system and proposed a distributed algorithm based on the alternating direction multiplier method.Wang et al. [30] designed a framework for jointly optimizing task allocation decisions and the CPU frequency, in which semidefinite relaxation algorithms are proposed to solve the problem of fixed and elastic CPU frequency.Zuo et al. [31] investigated the power minimization problem under the constraint of task buffer stability and proposed an online algorithm based on Lyapunov optimization for local execution and computational offloading.Ma et al. [32] investigated the multi-user computational offloading problem in multi-channel wireless interference environment and proposed a game theory computational offload algorithm.Xiong et al. [33] designed an optimization algorithm for the allocation of network resources and computing resources to minimize the transmission delay and computation time.Aiming to minimize the average response time of vehicle computing tasks, Dai et al. [34] implemented the real-time traffic management of vehicle offloading based on fog computation.The vehicle based fog node is modeled mathematically according to the queuing theory, and an approximate method for solving the unloading optimization problem is introduced.
The cost for using the cloud resources is neglected in above methods.Hence, in this paper, we will provide a task-offloading decision mechanism with particle swarm optimization, which considers both the completion time of tasks and monetary cost of computing resources.

Problem formulation
Consider a IoV cloud-edge computing (IoV-CEC) system with N vehicle users and mul- tiple MEC servers to perform computation offloading operation.Assuming that there is a bidirectional road and all computing devices share the same uplink spectrum of the system.All channel gains are modeled as large-scale path loss and small-scale Rayleigh fading, and H ij denotes the channel gain from i th vehicular user to associated j th MEC server.The additional noise of the user's destination is an independent cyclosymmetric complex Gaussian random variable with mean zero and variance σ 2 .E i denotes the transmission power of the i th user is, and C i denotes the number of CPU cycles required by the user to execute unit data.Assume that the total amount of workload for i th user is L i , αL i will be offloaded to the MEC and the rest will be processed locally.The user's local CPU frequency is F i , which is measured by the number of CPU cycles per second.Then, the time consumption for local computing of the i th user can be given by: Once the IoV user conducts the computation offloading decision, the time consumption of the offloading task includes the time consumption of workload transmission in uplink channel, the time consumption of task execution on the MEC server and the time consumption of results feedback.Therefore, the time consumption of computation offloading can be calculated by: where t u,i , t c,i and t d,i represent the time consumption of workload transmission in uplink channel, task execution on the MEC server and results feedback, respectively.
Since the local processing and offloading of the workload can be performed simultaneously, the time consumption of i th user to execute the task can be expressed as follows: After the offloaded task is processed, the corresponding results will be sent back to the IoV user through the downlink channel.Let βL k denote the amount of the results, and β represents the ratio of the output to input offloaded workload.Hence, the time con- sumption of result transmission through downlink channel can be given by: (1) where υ i is the uplink transmission rate of i th user.According to Shannon's theory, the uplink transmission rate can be defined as: where N 0 is the power spectral density of the noise.Besides, B i is the communication band obtained by the communication between the user and the MEC server, i.e., the bandwidth being occupied by i th user for offloaded workload.
Furthermore, if f i denotes the computing ability allocated to i th user by the associated MEC server, the time consumption of task processing can be obtained by For simplicity, the equal distribution is taken into account, and we have where F c represents the total computing ability of the MEC server and can be measured by the number of CPU cycles per second.
Meanwhile, owing to the user's communication overhead of the interaction with the MEC server, the user's transmission power can be regarded as a constraint condition, and it can be described by E i ≤ E max .
Since the user will consume the resources of the MEC server to perform the offloading task, the MEC server should provide enough computing capacity to complete the offloaded task.Therefore, in order to balance the demand and supply of resources, it is necessary to consider the energy consumption of the data generated by the communication between vehicle users and the MEC servers when they make offloading decisions.
The energy consumption for local computing can be given by where γ is the energy consumption of the user's CPU.
The MEC server can rent the corresponding computing resources to the user, and the user will cause energy consumption for workload transmission during the course of offloading, which can be expressed by: Similarly, the energy consumption of the computing tasks offloaded from i th user in the MEC server can be given by (4) where γ c is the CPU's energy consumption of the MEC server.
Let µ = {µ 1 , µ 2 , • • • , µ N } be the monetary cost corresponding to the user's energy consumption and the goal of IoV-MEC system is to maximize the utility of MEC provider by offering limited resources to IoV users.Mathematically, the optimization problem can be formulated by For IoV user, the cost of the workload includes the energy consumption of local processing with specific delay, the energy consumption for communication, and the energy consumption of task processing at the MEC server, which can be calculated by For each IoV user, the determination of the optimal offloading workload according to the monetary cost of the MEC servers can reduce the payment to the greatest extent.Therefore, the optimization problem can be described as follows: where F max is the maximum processing time of MEC server.

Proposed method
Particle swarm optimization is a swarm intelligence optimization algorithm, which is derived from the behavior of birds looking for habitat by Kennedy and Eberhart in 1995.It has the advantages of less parameters, easy implementation and fast convergence [35].For computing-intensive task offloading, the process can be regarded as different task particles to choose their best location and to quickly search for the location set in accordance with the scene under different conditions [36].Therefore, the particle swarm optimization (PSO) method is adopted to realize the transformation between the decision-making of unloading and the dynamic search process.In PSO, according to the foraging behavior of birds, the search space of the problem is compared with the flight space of birds.Each bird is treated as a particle to represent the search for the target food, and the position of the particles is evaluated by the defined fitness function [37].During the search phrase, the best position found can be also shared and dynamically the position of particles should be adjusted through their own experience and peer experience.
Suppose the i th user generates M i B i , f i , E max tasks, and S = {s 1 , s 2 , • • • , s K } denotes the set of all MEC servers, and the maximum transmission rate of tasks transmitted to MEC server can be calculated by the matrix of channel gain: (11) where H ij is the channel gain for the task generated by i th user to be transmitted to j th MEC server.
The particles will represent a specific MEC server to which all tasks will be offloaded, and the dimension of particle is the same as the number of task sets [38].The offloading decision vector of each particle is X[i] , which can represent the optimal execution loca- tion of all tasks and each element is randomly selected from 0 to K .X[i] = 0 indicates that the current task is executed locally.Otherwise, it indicates that the current task is loaded to the corresponding MEC server.
The speed of particles indicates the processing efficiency of the current task assigned to other MEC servers, which is recorded as V [i] [39,40].The dimension of particle speed is the same as the number of task sets.The optimal position of each particle during all iterations is denoted as Pbest , and the optimal position of all particles is denoted as Gbest.
To reflect the total cost of all tasks assigned to different MEC servers, the fitness of particles can be represented by the combination of above optimization problems.Thus, the fitness function can be given by The update of the particle's velocity can be given by: where c 1 , c 2 are the learning factors, and rand is a random number between 0 and 1, and w i is the inertia weight factor.
To avoid falling into local optimization, the inertia weight factor should be dynamically changed with the objective function value of particle swarm optimization.Hence, the inertia weight factor w i will be updated according to the following equation: where w min and w max represent the minimum and maximum value of the inertia weight factor, respectively.In addition, g i is the current fitness value of each particle.g min and g max are the average fitness value of all particles whose fitness value is lower or greater than the average fitness value of the particle swarm, respectively.
Furthermore, the position of the particles can be updated as follows: Next, the detailed computation offloading process is demonstrated as follows: (14 Step 1: Initialize the random position and velocity of i th particle.The delay and energy consumption are measured by local tasks, MEC server set and channel gain matrix H .The fitness of each particle is calculated according to Eq. ( 15).
Step 2: The current position of the particles is chosen as the individual optimal allocation scheme Pbest , and the position of the particle with the minimum fitness value will be set as Gbest.
Step 3: If t ≤ t max , the velocity X[i] and the position V [i] will be updated indepen- dently according to all dimensions for i th particle.
Step 4: The updated position of each particle is calculated according to Eq. ( 17).If the corresponding fitness value is less than the current fitness value, the particle optimal Pbest will be replaced.Meanwhile, the population optimal allocation scheme Gbest and the total cost fitness will be updated.
Step 5: At the end of iterations, the optimal vector X[i] = Gbest and the offloading strategy with optimal fitness can are obtained.Through centralized control, the cloudedge computing enables the IoV users to offload the computing tasks to MEC servers for execution according to the optimal offloading strategy.

Results and discussion
In this section, the simulation experiments are performed to evaluate the performance of the proposed algorithm.An MEC-IoV system with a hexagonal symmetric cellular structure is considered, in which the number of MEC servers is 6 and the number of IoV users is 10.The reference signal-to-noise ratio is set to be 20 dB, and the bandwidth of uplink and that of downlink is 20 MHz.The computing ability of the MEC server is 4 GHz, the CPU cycles required for computing one bit of the task are between 500 and 3000, and the maximum latency for completing the task is set to 5 s.The channel gain for the task generated by the IoV user to be transmitted to associated MEC server is varied from [2 × 10 −10 , 2 × 10 −6 ] .In addition, the other parameters is set as following: First, the convergence of the proposed unloading strategy is evaluated.The total cost of all tasks can be obtained with the number of iterations, and the experimental results are shown in Fig. 1.It can be observed that our proposed algorithm converges quickly in the early iterations.After 30 iterations, the total cost remains relatively stable and the global optimal solution can be found.Our proposed algorithm has a strong ability of global optimization.It can constantly seek the global optimal solution in the early stage and also has good global search ability in the later stage.Compared with greedy algorithm, the total cost of our proposed algorithm is much less and reduces the total cost by 14.2%.
In addition, the utility of MEC provider under different monetary cost is analyzed as shown in Fig. 2. From the experimental results, we can see that when the monetary cost changes between [1, 2.6], the utilities of MEC provider show a linear monotonic increasing trend.However, when the monetary cost exceeds 2.6, the utility of MEC provider begins to decline sharply, and tends to be relatively stable at around 1.65.The reason is that the user's offload costs increase as well as the monetary cost.Compared with the benefits of task offloading, the user's spending exceeds the corresponding cost, which results in the user unwilling to make offloading decision.The greedy algorithm also shows a similar trend, but on the whole, the utility of MEC provider is lower than our proposed algorithm.
Next, we explore the performance in aspect of average resource cost, utility of MEC provider, computation overhead and user's offloading ratio and conduct the comparison with random scheme and round-robin scheme.Among them, random offload scheme refers to the random offloading of tasks to the MEC server for processing, while the round-robin scheme is to offload the tasks to the MEC server in sequence.Figure 3 shows the curve of the average resource cost with different amount of workload.It can be seen that the average resource cost is not conducive to the workload.In comparison, the average resource cost shows good stability in our proposed algorithm and fluctuates sharply in Round-Robin scheme and Random scheme.With the increase of the amount of workload, the monetary cost will gradually decline.It will   cause that the user's own processing capacity cannot meet the corresponding requirements.Moreover, with the increase of the amount of offloading, the MEC server can utilize the low cost to encourage users for more offloading tasks, which will bring more benefits to the system.When the user's workload reaches about 5 × 10 8 , the curve of average resource cost begins to flatten.The reason is that the users have to offload the task within the requirement as much as they will process.
Figure 4 shows the curve of the utility of MEC provider with different amount of workload.The simulation results show that with the increase of user data, the utility of MEC provider of our proposed algorithm, round-robin scheme and random scheme algorithms is on the rise.Also, it is obvious that the utility in random scheme algorithm is much lower than that of our proposed algorithm and round-robin scheme.At high level of workload, the utility of MEC provider in our proposed algorithm and Round-Robin scheme increases rapidly.Overall, the performance of our proposed algorithm is better than that of other schemes.It is clearly evident from Fig. 4 that the utility of the system gradually tends to be flat when the workload exceeds 8 × 10 8 .That is because with the increase of users the processing capacity has reached saturation, and the utility of MEC provider will not fluctuate at high level of workload.
Figure 5 shows the comparison of computation overhead.With the increase of workload, the computation overhead of all algorithms shows linear growth trend.In our proposed algorithm, the particle swarm optimization can obtain an optimal offloading decision and effectively reduce the computation overhead.The results also show that the increase of computation overhead in random scheme is obviously greater than that of our proposed algorithm and round-robin scheme.The low monetary cost will lead to large-scale offloading of users.However, the communication cost of users and the computation overhead increase dramatically, which directly leads to the sharp increase of overall cost.
Figure 6 shows the curve of the user's offloading ratio with the amount of workload.When the amount of workload is very low, the cost of local processing and offloading to MEC server is almost equivalent.Thus, the IoV users tend to offload tasks to the MEC server for execution.However, with the increase of user data, the difference of the cost between local computing and offloading decision becomes distinctly.Especially, when the amount of workload increases to a certain extent, the revenue of MEC server will no longer fluctuate and the user's offloading ratio begins to decline.From the experimental results, we can observe that when the amount of workload is 5 × 10 8 , the user's offload ratio of round-robin scheme shows a downward trend.In this case, the computation overhead starts to increase sharply, and it is more cost-effective for users to choose local processing, which leads to the decrease of offloading ratio.In our proposed algorithm, the user's offloading ratio begins to fluctuate as the workload exceed 5 × 10 8 , and dem- onstrates better than other schemes.

Conclusions
In this paper, we proposed a task-offloading decision mechanism with particle swarm optimization for IoV-based edge computing.First, a mathematical model to calculate the computation offloading cost for cloud-edge computing system is defined.Then, the particle swarm optimization is applied to convert the offloading of task into the process and obtain the optimal offloading strategy.Furthermore, to avoid falling into local optimization, the inertia weight factor is designed to change adaptively with the value of the objective function.The experimental results show that the proposed offloading strategy can effectively reduce the energy consumption of terminal devices while guarantee the service quality of users.In the follow-up research process, I will consider classifying tasks, such as QoS constraints, CPU requirements and priority.

Fig. 1
Fig. 1 Total cost versus number of iterations

Fig. 2
Fig. 2 Utility of MEC provider versus monetary cost

Fig. 3
Fig. 3 Average resource cost versus workload

Fig. 4
Fig. 4 Utility of MEC provider versus workload