Mobile Edge Computing(MEC)is an important technology that can improve the computational speed and security of mobile devices.Users offload mobile tasks to nearby edge devices,reducing the load on the mobile devic-es and decreasing computational energy consumption.The task migration algorithm in edge devices is a key issue for enhancing task processing efficiency.This paper proposes two commonly used task migration algorithms in edge com-puting:Integer Linear Programming(ILP)and Greedy Heuristic algorithm.Both migration solutions consider location loss,bandwidth loss,user loss,and migration loss.Additionally,the solutions for task migration need to consider not only parameters related to energy consumption but also vehicle mobility.This paper utilizes a Markov chain to pre-dict vehicle locations and integrates location prediction with task migration.The experimental results show that ILP and Greedy Heuristic algorithm have nearly the same energy consumption.However,under the same energy consump-tion,the Greedy Heuristic algorithm exhibits significantly lower time delay compared to the ILP algorithm,establish-ing the advantage of the Greedy algorithm in the migration scheme.Furthermore,by selecting the task refresh fre-quency,the energy consumption of the Greedy Heuristic algorithm can be further reduced.The optimized algorithm reduces energy consumption by approximately 20%compared to the initial algorithm.