A task bidirectional unloading method for a vehicle-mounted computing power network

CN122602235APending Publication Date: 2026-08-18GUANGDONG UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610609862.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-06
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0007]为了解决现有的任务双向卸载方法无法实现边缘服务器和车辆之间的双向任务卸载和车辆身份的动态转换,导致车载算力网络资源利用效率低的问题,本发明一种面向车载算力网络的任务双向卸载方法,降低车载算力网络能耗同时,提高了车载算力网络的资源利用率和稳定性

Benefits of technology

本发明提供一种面向车载算力网络的任务双向卸载方法,首先,构建包括用户节点和算力节点的车载算力网络。以最小化车载算力网络任务处理时间和总能耗为联合优化目标,构建联合优化模型,并转化为多智能体马尔可夫决策过程,利用基于自注意力机制的多智能体软演员-评论家算法求解,得到最优的任务卸载策略,为每个任务选择卸载的算力节点。基于车载服务器状态变化,执行身份转换机制。当边缘服务器负载超过阈值时,利用任务反向卸载模型,将边缘服务器中的任务反向卸载到处于算力节点状态的服务车辆。每个时隙重复上述过程直至达到最大时隙数。本发明通过双向卸载机制和身份动态转换,有效降低了车载算力网络能耗,提高了算力资源利用率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122602235A_ABST
    Figure CN122602235A_ABST
Patent Text Reader

Abstract

The application provides a task bidirectional unloading method for a vehicle-mounted computing power network, and relates to the technical field of the vehicle-mounted computing power network. A vehicle-mounted computing power network including user nodes and computing power nodes is constructed. A joint optimization model is constructed to minimize the vehicle-mounted computing power network task processing time and total energy consumption, and is converted into a multi-agent Markov decision process, and a multi-agent soft actor-critic algorithm based on a self-attention mechanism is used for solving to obtain an optimal task unloading strategy. In each time slot, the optimal task unloading strategy is used to select the computing power node to be unloaded for each task. Based on the state change of the vehicle-mounted server, an identity conversion mechanism is executed. When the edge server load exceeds a threshold value, a task reverse unloading model is used to unload the tasks in the edge server to the service vehicles in the computing power node state in a reverse direction. Through the bidirectional unloading mechanism and the dynamic identity conversion, the energy consumption of the vehicle-mounted computing power network is effectively reduced, and the computing power resource utilization rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of vehicle-mounted computing networks, and more specifically relates to a bidirectional task offloading method for vehicle-mounted computing networks. Background Technology

[0002] To handle large-scale tasks, Wireless Computing Power Networks (WCPNs) have been proposed to provide intensive and sufficient computing services. In WCPNs, all entities are both providers of computing power and request computing services according to their own needs. With technological advancements, vehicles can not only obtain computing resources from edge servers connected to roadside units or base stations, but also provide computing services to neighboring vehicles and users within their coverage area. Due to the high-speed mobility and flexibility of vehicles, vehicle-assisted wireless computing networks can alleviate the problem of computing resource allocation. However, in the context of the Internet of Things, there is still a huge gap in computing resources. Therefore, a Vehicular Computing Power Network (VCPN) has been proposed, which not only utilizes the computing resources of edge servers and vehicle servers, but also incorporates the idle computing resources of personal mobile devices. The resulting computing power pool, composed of personal mobile devices, vehicle servers, and edge servers, can meet the enormous computing power demands.

[0003] In vehicular computing networks, edge computing enhances the vehicle's real-time data processing capabilities, supporting rapid response and decision-making in autonomous driving functions, while reducing reliance on remote servers, thereby improving system reliability and efficiency. Edge computing is suitable for applications with high real-time requirements, such as intelligent driving, IoT devices, and industrial automation. Edge computing is a distributed computing model that pushes computing power and data storage to the network edge, aiming to reduce latency, optimize bandwidth usage, and enhance data privacy. Edge computing processes data closer to the data source or terminal device, rather than relying on remote data centers or the cloud. Multiple edge servers are deployed in the edge layer, typically located near micro base stations or cellular network base stations. Therefore, the communication quality at the edge layer is significantly better than in cloud computing, enabling rapid feedback of computation results to users. However, limited by device processing capabilities, relying solely on the computing resources of edge servers may lead to resource shortages, preventing the completion of tasks assigned to edge computing.

[0004] Reinforcement learning is an important branch of machine learning that learns optimal behavioral strategies through the interaction between an agent and its environment. The agent performs actions in the environment and adjusts its strategy based on reward signals from the environment to maximize cumulative rewards. This process involves balancing state evaluation, action selection, and reward mechanisms; the agent must continuously explore new actions and optimize its strategy using existing information. Reinforcement learning is dynamic and adaptive, capable of adjusting in real time according to environmental changes, and is widely used in fields such as games, robot control, and recommender systems to achieve intelligent decision-making and behavior optimization in complex environments.

[0005] Multi-agent reinforcement learning (MAL) is an important branch of reinforcement learning that studies how multiple agents learn optimal policies through interaction and collaboration in a shared environment. Each agent has an independent state, action, and reward function, and continuously optimizes its decisions through interaction with the environment and other agents. In MAL, the agents' behavior follows a stochastic game process, with the goal of maximizing cumulative rewards through the learned policy. Compared to single-agent reinforcement learning, MAL needs to handle more complex dynamic environments and cooperative or competitive relationships between agents. For example, agents (such as in-vehicle systems) learn how to dynamically allocate tasks to in-vehicle devices or edge nodes based on the current network state, computing resources, and task requirements to achieve goals such as minimizing latency and optimizing energy consumption. Through continuous interaction with the environment and policy adjustments based on reward signals, reinforcement learning can assist systems in making optimal decisions in complex and ever-changing in-vehicle and edge computing scenarios.

[0006] However, most existing reinforcement learning-based bidirectional task offloading methods only support unidirectional task offloading from users to computing nodes. Edge servers, always acting as fixed computing power providers, cannot offload tasks to dynamically emerging idle vehicles when overloaded. Furthermore, existing methods do not consider the dynamic dual-identity switching problem of vehicle servers due to dynamic state changes during operation, failing to effectively identify and utilize dynamically changing idle computing resources. This makes edge servers prone to becoming system bottlenecks, while a large amount of vehicle computing power remains idle, resulting in high overall energy consumption and low resource utilization of the vehicle computing network. Summary of the Invention

[0007] To address the problem that existing bidirectional task offloading methods cannot achieve bidirectional task offloading and dynamic vehicle identity conversion between edge servers and vehicles, resulting in low resource utilization efficiency of in-vehicle computing networks, this invention provides a bidirectional task offloading method for in-vehicle computing networks. This method reduces energy consumption of in-vehicle computing networks while improving resource utilization and stability.

[0008] To address the issue of insufficient segmentation accuracy of existing point cloud semantic segmentation methods in cross-domain application scenarios, this invention proposes a point cloud semantic segmentation method based on active domain adaptation, which effectively reduces the feature differences between the source and target domains and improves the point cloud semantic segmentation accuracy in cross-domain scenarios.

[0009] To achieve the above-mentioned technical effects, the technical solution of the present invention is as follows: S1: Construct an in-vehicle computing power network including user nodes and computing power nodes; the user nodes include personal mobile devices and in-vehicle servers, and the computing power nodes include personal mobile devices, in-vehicle servers and edge servers; S2: With minimizing the task processing time and total energy consumption of the vehicle computing network as the joint optimization objective, a joint optimization model is constructed by comprehensively considering the energy consumption constraints of task transmission and task computing of personal mobile devices, vehicle servers and edge servers. S3: Transform the joint optimization model into a multi-agent Markov decision process, and use a multi-agent soft actor-critic algorithm based on self-attention mechanism to solve it and obtain the optimal task offloading strategy. S4: In each time slot, after a user node’s personal mobile device or vehicle server generates a computing task, the optimal task offloading strategy is used to forward offload each computing task to the node with the best computing power for processing. During the computation task processing, an identity switching mechanism is executed based on the status changes of the vehicle server. When the vehicle server is idle, it acts as both a user node and a computing power node; when the vehicle server is busy, it acts only as a user node. During the processing of computing tasks, when the load on the edge server exceeds the threshold, the computing tasks that were offloaded to the edge server are offloaded back to the vehicle server currently in the computing power node for execution using the task reverse offloading model. S5: Repeat step S4 until the maximum number of time slots is reached, at which point the vehicle-mounted computing network stops operating.

[0010] Furthermore, a wireless communication model is established between user nodes and computing power nodes; this wireless communication model is used to calculate the task transmission rate and transmission time in the joint optimization model; user nodes and computing power nodes use orthogonal frequency division multiple access (OFDMA) technology to reuse the same channel for wireless communication; assuming... This represents the number of tasks transmitted from a personal mobile device to a computing node in time slot t; This represents the number of tasks transmitted from the vehicle-mounted server to the computing node in time slot t; The transmission rate between a personal mobile device and a computing node is calculated using the following expression:

[0011] In the formula, Indicates personal mobile device and computing nodes The transmission rate between them This represents the bandwidth allocated by the computing node to a personal mobile device in time slot t. This indicates the transmission power of the computing nodes and personal mobile devices during the transmission process. The channel gain represents the wireless propagation channel between computing nodes and personal mobile devices. Represents the distance attenuation factor. This indicates the distance between a personal mobile device and a computing node. This represents the power of white noise. This indicates that the personal mobile device in time slot t... The set of computing nodes covered. This represents the total interference power in the communication of the remaining computing nodes; The transmission time for a personal mobile device to transfer a task to a computing node is calculated using the following expression:

[0012] In the formula, Indicates personal mobile device Transmit the task to the computing node Transmission time, This represents the i-th personal mobile device. Indicates the data size of the task; The transmission rate between the vehicle-mounted server and the computing nodes is calculated using the following expression:

[0013] In the formula, Indicates vehicle-mounted server and computing nodes The transmission rate between them It is a computing power node Allocate time slot t to the vehicle server bandwidth, Represents computing nodes during transmission and vehicle-mounted server Transmission power, Indicates vehicle-mounted server and computing nodes Channel gain of the wireless propagation channel between them This represents the power of white noise. This indicates that the onboard server is in time slot t. Coverage of computing nodes The set, Represents the remaining computing power nodes Interference power, Indicates distance attenuation; The transmission time for the onboard server to transfer the task to the computing node is calculated using the following expression:

[0014] In the formula, Indicates vehicle-mounted server Transmit the task to the computing node Transmission time, Indicates the size of the task data; The transmission rate between the edge server and the service vehicle is calculated using the following expression:

[0015] In the formula, Represents edge server Service vehicles The transmission rate between them Represents edge server Allocated in time slot t bandwidth, Indicates the edge server during transmission Service vehicles Transmission power, Represents edge server Service vehicles Channel gain of the wireless propagation channel between them This represents the power of white noise. This indicates that the edge server is in time slot t. Coverage of computing nodes The set, Represents the remaining computing power nodes Interference power, Indicates distance attenuation; The transmission time from the edge server to the service vehicle is calculated using the following expression:

[0016] In the formula, Represents edge server Transfer the task to the service vehicle Transmission time, Indicates the size of the task data.

[0017] Furthermore, a computational model is constructed to calculate the task processing time of the joint optimization model; in the computational model, each task must and can only be assigned to one computing node; the computing node allocates computing resources to process tasks in parallel without exceeding its own maximum computing resource limit; let... This represents a task allocation vector from a personal mobile device to other computing nodes; This represents the task allocation vector from the onboard server to other computing nodes; the number of tasks being processed by a computing node is denoted as . ; The computing model includes a personal mobile device computing mode, an in-vehicle server computing mode, and an edge server computing mode. In personal mobile device computing mode, when a task is offloaded to a personal mobile device for execution, the expression for calculating the task execution time on the personal mobile device is:

[0018] In the formula, Indicates the time taken for a personal mobile device to perform a task. Indicates the size of the task data. Indicates the size of the task data. This represents the computing resources allocated to a personal mobile device. This represents the number of CPU cycles required for a personal mobile device to complete a task. In the vehicle-mounted server computing mode, when a task is offloaded to the vehicle-mounted server for execution, the expression for calculating the task execution time of the vehicle-mounted server is:

[0019] In the formula, This indicates the time it takes for the onboard server to execute a task. Indicates the size of the task data. Indicates the size of the task data. This indicates the computing resources allocated to the vehicle-mounted server. This indicates the number of CPU cycles required for the onboard server to complete the task. In edge server computing mode, when a task is offloaded to an edge server for execution, the expression for calculating the task execution time on the edge server is:

[0020] In the formula, This indicates the time it takes for the edge server to execute the task. Indicates the size of the task data. Indicates the size of the task data. This indicates the number of CPU cycles required for the edge server to complete the task. This indicates the computing resources allocated to the edge servers; The expression for calculating the processing time of all tasks in the vehicular computing network is as follows:

[0021] In the formula, This represents the time taken to process all tasks in the onboard computing network. This represents the task execution time of all personal mobile devices within time slot t. This represents the task execution time of all onboard servers within time slot t. This represents the task execution time of all edge servers within time slot t.

[0022] Furthermore, the total energy consumption in the joint optimization model is calculated based on an energy consumption model; the energy consumption model includes task transmission energy consumption and task computation energy consumption. The energy consumption for task transmission is generated when the user sends a task to the computing node, and is expressed as follows:

[0023] In the formula, Indicates the energy consumption of task transmission. Indicates the size of the task data. Indicates user The generated task Unload to compute nodes Communication rate, A set representing the transmit power of users; The energy consumption for task computation is generated by the computing nodes processing tasks, and is expressed as follows:

[0024] In the formula, Indicates the energy consumption of task calculation. This indicates the parameters of the CPU switching capacitors in the computing node. This represents the computing resources allocated to the computing nodes.

[0025] The energy consumption model is used to calculate the total energy consumption, and its expression is:

[0026] In the formula, This indicates total energy consumption.

[0027] Furthermore, with minimizing the task processing time and total energy consumption of the in-vehicle computing network as the joint optimization objective, and comprehensively considering the energy consumption constraints of task transmission and task computing of personal mobile devices, in-vehicle servers, and edge servers, a joint optimization model is constructed; the expression of the joint optimization model is:

[0028]

[0029]

[0030]

[0031]

[0032]

[0033]

[0034]

[0035] In the formula, Indicates total energy consumption. This represents the task allocation vector for a personal mobile device. This represents the task allocation vector for the vehicle-mounted server. This indicates the reverse unloading of the matching variable. Indicates the allocation of computing resources. This indicates the reverse unloading of decision variables. Indicates the maximum number of time slots. Indicates the number of user nodes. Indicates the number of computing nodes. This indicates the number of tasks transmitted by a personal mobile device. This represents a set of tasks generated by a personal mobile device. This indicates the number of tasks transmitted by the vehicle-mounted server. This represents the set of tasks generated by the in-vehicle server. This represents a variable indicating task assignment on a personal mobile device. This represents the variable for assigning tasks to the vehicle-mounted server. Represents a collection of personal mobile devices. This represents a collection of vehicle-mounted servers. This represents the computing resources allocated to the computing nodes. This indicates the maximum available computing power resources of a computing node. This indicates that the vehicle is uninstalled from a personal mobile device. Represents the vehicle state vector. This indicates that the onboard server is unloaded from the vehicle. This indicates the reverse unloading of the matching variable. This represents the m-th task. This represents the task queue of the edge server. Indicates the transmission power of the vehicle-mounted server. This indicates the maximum transmission power of the vehicle-mounted server. Indicates the transmit power of a personal mobile device. This indicates the maximum transmit power of a personal mobile device. Represents the normalization coefficient. Represents the normalization coefficient. This indicates the time taken to process all tasks in the onboard computing network.

[0036] Further, step S3 is as follows: Step 1: Transform the joint optimization model into a multi-agent Markov decision process. ,in, Indicates the number of user nodes. Indicates the number of computing nodes. Represents the set of state spaces. Represents the action space, Represents the reward function; Step 2: Construct a first soft-Q network, a second soft-Q network, and a policy network; the first and second soft-Q networks are used to estimate state value and action value; the policy network is used to output the action probability distribution; a multi-head self-attention module is introduced into the policy network; Step 3: Initialize the parameters of the first soft-Q network, the second soft-Q network, and the policy network; initialize the state space and the experience replay pool; Step 4: Input the current state space into the multi-head self-attention module to obtain the weighted state; the policy network obtains the action and the state at the next moment after the action is executed based on the weighted state; the reward function is used to calculate the reward value; based on the current state, action, state at the next moment after the action is executed, and reward value, a state-action-reward experience tuple is formed and stored in the experience replay pool. Step 5: Obtain the state-action-reward experience tuple from the experience replay pool as the input to the first soft-Q network and the second soft-Q network, and calculate the target value; based on the target value, update the first soft-Q network and the second soft-Q network by minimizing the temporal difference error loss function; construct the loss function, and update the policy network parameters by minimizing the loss function; Step 6: Update the first target soft-Q network and the second target soft-Q network using a soft update method; Step 7: Repeat steps 4 to 6 until the preset training rounds are reached to obtain the optimized strategy network parameters, which are used to output the optimal task offloading strategy in real time based on the current on-board computing power network status.

[0037] Furthermore, the multi-head self-attention module uses multiple parallel attention heads to extract features such as the service vehicle status, maximum computing power resources, and the number of current service tasks, and uses dot product attention to calculate feature association; In the multi-head self-attention module, the attention calculation expression for each attention head is as follows:

[0038] In the formula, The query vector represents the vehicle's state characteristics. The key vector obtained from the vehicle state features. This represents the value vector obtained from the vehicle state features, where o represents the scaling factor; The outputs of multiple attention heads are concatenated to obtain multi-head attention features; the multi-head attention features are then processed sequentially through a feedforward network and a residual connection to output a weighted state.

[0039] Furthermore, the expression for the timing difference error loss function is:

[0040] In the formula, This represents the time-series difference error loss function. Indicates the parameters of the first and second soft-Q networks. This represents the Q-values ​​output by the first and second soft-Q networks. Indicates the target value; The expression for the loss function is:

[0041] In the formula, Represents the loss function. Represents the expectation operator. Represents the entropy regularity coefficient. This represents the Q-values ​​output by the first and second soft-Q networks. This represents the experience replay pool.

[0042] Furthermore, in the identity conversion mechanism, the vehicle-mounted server is divided into a task vehicle and a service vehicle. The task vehicle acts solely as a user node's vehicle-mounted server, requesting computing power services. The service vehicle acts simultaneously as both a user node's vehicle-mounted server and a computing power node's vehicle-mounted server, requesting computing power services while also providing computing power services to other tasks. When the vehicle-mounted server is idle, its status is set to service vehicle, acting as both a user node and a computing power node. When the vehicle-mounted server is busy, its status is set to task vehicle, acting solely as a user node. Specifically: The expression for calculating the CPU utilization of the vehicle-mounted server is:

[0043] In the formula, This indicates the CPU utilization rate of the vehicle-mounted server. Indicates the allocated computing resources. Indicates the total available computing resources; Based on the state vector of the vehicle server The vehicle-mounted server is divided into mission vehicles and service vehicles, and the distinction expression is:

[0044] In the formula, This represents the state vector of the vehicle-mounted server. Indicates vehicle-mounted server, Indicates the mission vehicle. Indicates service vehicles; When the CPU utilization of the onboard server in the task vehicle state is lower than the first threshold after processing the current computing task, the state vector of the onboard server is set to 1 and it is converted into a service vehicle. When the CPU utilization of the onboard server in the service vehicle state exceeds the second threshold after processing the current computing task, the state vector of the onboard server is set to 0, and it is converted into a task vehicle. When an emergency task is generated, the service vehicle prioritizes handling its own emergency task, starts a timer to record the duration of the emergency state, and if the duration of the emergency state exceeds the emergency threshold, the state vector of the on-board server is set to 0, and the vehicle is forcibly converted to a task vehicle.

[0045] Furthermore, in the task reverse unloading model: The CPU utilization of the edge server is calculated using the following expression:

[0046] In the formula, This indicates the CPU utilization of the edge server. This indicates the computing resources allocated to the edge server. This indicates the total available computing resources on the edge servers; When the CPU utilization of the edge server exceeds the preset overload threshold, the edge server is deemed to be overloaded. The order of task reverse unloading is determined based on the reverse allocation priority coefficient; the expression for the reverse allocation priority coefficient is:

[0047] In the formula, Indicates the reverse allocation priority coefficient. Indicates the weighting coefficient. Indicates the weighting coefficient. This represents the data size of the m-th task. This represents the task queue of computing node n. This represents the m-th task. Indicates the maximum acceptable latency for the task. Indicates the remaining tolerance time for the task.

[0048] Compared with existing technologies, the beneficial effects of this method are: This invention provides a bidirectional task offloading method for vehicular computing networks. First, a vehicular computing network including user nodes and computing power nodes is constructed. A joint optimization model is built with the goal of minimizing task processing time and total energy consumption of the vehicular computing network. This model is then transformed into a multi-agent Markov decision process and solved using a self-attention-based multi-agent soft actor-critic algorithm to obtain the optimal task offloading strategy. For each task, a computing power node is selected for offloading. Based on changes in the vehicular server's state, an identity switching mechanism is implemented. When the edge server load exceeds a threshold, a task reverse offloading model is used to reverse offload tasks from the edge server to service vehicles in the computing power node state. This process is repeated for each time slot until the maximum number of time slots is reached. This invention effectively reduces the energy consumption of vehicular computing networks and improves the utilization rate of computing resources through the bidirectional offloading mechanism and dynamic identity switching. Attached Figure Description

[0049] Figure 1 A flowchart illustrating the bidirectional task offloading method for vehicle-mounted computing networks proposed in this embodiment of the invention; Figure 2 This diagram illustrates the structure of the vehicle-mounted computing network proposed in this embodiment of the invention. Figure 3 The flowchart illustrates the multi-agent soft actor-critic algorithm based on a self-attention mechanism proposed in this embodiment of the invention. Detailed Implementation

[0050] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent. To better illustrate this embodiment, some parts of the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual dimensions; It is understandable to those skilled in the art that some well-known details may be omitted from the accompanying drawings.

[0051] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0052] The positional relationships depicted in the accompanying drawings are for illustrative purposes only and should not be construed as limiting this patent. Example 1 This embodiment proposes a bidirectional task offloading method for vehicular computing networks, such as... Figure 1 The flowchart shown includes the following steps: S1: Construct an in-vehicle computing power network including user nodes and computing power nodes; the user nodes include personal mobile devices and in-vehicle servers, and the computing power nodes include personal mobile devices, in-vehicle servers and edge servers; S2: With minimizing the task processing time and total energy consumption of the vehicle computing network as the joint optimization objective, a joint optimization model is constructed by comprehensively considering the energy consumption constraints of task transmission and task computing of personal mobile devices, vehicle servers and edge servers. S3: Transform the joint optimization model into a multi-agent Markov decision process, and use a multi-agent soft actor-critic algorithm based on self-attention mechanism to solve it and obtain the optimal task offloading strategy. S4: In each time slot, after a user node’s personal mobile device or vehicle server generates a computing task, the optimal task offloading strategy is used to forward offload each computing task to the node with the best computing power for processing. During the computation task processing, an identity switching mechanism is executed based on the status changes of the vehicle server. When the vehicle server is idle, it acts as both a user node and a computing power node; when the vehicle server is busy, it acts only as a user node. During the processing of computing tasks, when the load on the edge server exceeds the threshold, the computing tasks that were offloaded to the edge server are offloaded back to the vehicle server currently in the computing power node for execution using the task reverse offloading model. S5: Repeat step S4 until the maximum number of time slots is reached, at which point the vehicle-mounted computing network stops operating.

[0053] To address the explosive growth in computing power demand in the era of the Internet of Things, the Vehicular Computing Power Network (VCPN) integrates edge servers, vehicle servers, and personal mobile devices into a unified computing power pool, forming a dense, flexible, and on-demand scalable distributed resource supply structure. Building upon the advantages of edge computing—low latency, high bandwidth, and strong privacy—VCPN alleviates the bottleneck of resource depletion in traditional edge nodes by parallel scheduling of idle CPUs from edge servers, vehicle servers, and user terminals. To ensure optimal scheduling of the computing power pool in complex environments with dynamic topologies, heterogeneous task types, and real-time switching of node roles, VCPN further introduces multi-agent reinforcement learning: each vehicle or edge node acts as an independent agent, learning optimal offloading and resource allocation strategies in real-time through reward signals in a shared environment, minimizing end-to-end task processing time and stabilizing queues. Thus, the aggregation of computing resources by VCPN, the near-end low-latency advantage of edge computing, and the adaptive decision-making capabilities of reinforcement learning are coupled to form an efficient and intelligent computing power support system for large-scale tasks.

[0054] The vehicle-mounted computing network mainly consists of three parts. First, it establishes a many-to-many matching relationship between users and computing nodes, including the vehicle-mounted server. Divided into mission vehicles With service vehicles There are two types, the difference being that when considering task unloading, service vehicles are also treated as computing power nodes, while task vehicles no longer accept new tasks. It's worth noting that both task vehicles and service vehicles are users of the vehicular computing network. A collaborative optimization model for task processing time and energy consumption is established based on the network structure. The second part involves the vehicular server in the vehicular computing network, where the vehicle also acts as a task requester (…). ) and computing power service providers ( Dual roles. Therefore, a dynamic identity switching mechanism is established under the condition of parallel task processing and no task queuing. This mechanism is based on the CPU utilization of the onboard server. Service vehicles The core driving factor is the emergency task response requirement, and role switching is realized through a state machine model. The third part addresses the overload situation in the fixed core computing power nodes of the edge server system when tasks arrive explosively or when a large number of vehicle servers cannot provide services to the network. Combining the characteristic that the identity transformation mechanism of the vehicle computing power network continuously generates idle computing nodes, the core contradiction of edge servers (ES) being prone to overload due to concentrated tasks and service vehicles (SeV) having idle computing power due to dynamic emergence of identity transformation is proposed. A two-way task offloading mechanism with ES as the hub is designed, and a Redistribution Priority Coefficient (RPC) is designed to prioritize the reverse offloading of tasks that can free up edge server computing power resources. The reinforcement learning algorithm learns whether reverse offloading should be performed and the objects to be reverse offloaded according to the system optimization goal. In this embodiment, as Figure 2 The diagram shows the structure of an in-vehicle computing network, which consists of user nodes and computing nodes. The network comprises M users and N computing nodes. Mobile User Equipments (MUEs) and Vehicle Servers (VSs) act as both user nodes and computing nodes. Edge Servers (ESs) serve only as computing nodes.

[0055] The structure of the vehicular computing network consists of two parts: forward offloading and reverse offloading. In the first part, all nodes with computing resources in the network are part of the computing network's computing nodes. When users in the network (vehicle servers and personal mobile devices) need to perform tasks, they can offload their tasks to other computing nodes in the network. The computing nodes process tasks by allocating their own computing resources to the offloaded tasks, processing them in parallel without queuing. Simultaneously, the vehicle server switches between the roles of service vehicle and task vehicle based on its own computing resource allocation, determining whether the current time slot is for computing network service. Regardless of the vehicle server's changing role, only its identity as a computing node is affected; the vehicle server retains all the rights of a user of the vehicular computing network throughout the process.

[0056] After a large number of tasks have been offloaded to edge servers, the computing resources of these servers are already scarce. Continuing to offload tasks to edge servers is inefficient for the system, and the time and energy consumed do not meet the system's objectives. At this point, if the edge servers meet the conditions for reverse task offloading, the system determines the order of reverse task offloading based on RPC(t). The policy learned through reinforcement learning determines whether the edge servers should perform reverse offloading at this time, and which idle service vehicle the tasks should be offloaded to. Each offloading action can only offload one task.

[0057] To handle large-scale computing tasks, vehicular computing networks (VCRs) considering the computing power of personal mobile devices have been proposed. These VCRs consist of personal mobile devices, in-vehicle servers, and edge servers as computing nodes. The former two not only provide computing power but also act as users requesting services from the VCR network. Unlike traditional wireless computing networks, which only require a one-to-one matching model between user devices and Roadside Units (RSUs), the matching relationship between computing nodes and users in VCRs is more complex. Therefore, a VCR model that clearly illustrates the matching relationship between users and computing devices is needed. Furthermore, in this model, the same device may simultaneously possess the dual identities of a computing node and a user, a factor that needs to be considered in the mathematical modeling. According to the definition of task transfer, users in the VCR network can choose to submit their tasks to the network for computation or leave them for local computation. During task offloading, edge servers can briefly act as users of the computing network, but the offloading target is limited to the set of service vehicles.

[0058] Unlike wireless computing networks, vehicular servers in vehicular computing networks simultaneously possess the identities of both users and computing power nodes. This dual identity introduces uncertainty into the vehicular computing network. Firstly, as a requester of computing power services, the server maximizes the use of external computing power to quickly complete its tasks. Secondly, as a provider of computing power services, the server minimizes the time spent processing tasks for other devices, leaving sufficient time for its own potential tasks. Furthermore, the mobility and safety considerations of vehicle operation further exacerbate the uncertainty of the vehicular server as a computing power node. Therefore, a reasonable identity transition mechanism for vehicular servers must be proposed, defining the server's state as a "task vehicle" and a "service vehicle." A service vehicle refers to a vehicle where the vehicular server can provide computing power services to the vehicular computing network, while a task vehicle is a vehicle that cannot temporarily provide computing power services due to identity transition. Moreover, the identity transition should not affect the vehicular server's right to request computing power services as a user of the vehicular computing network. Designing a suitable identity transition mechanism for vehicular servers can improve the efficiency and stability of the entire computing network.

[0059] In the vehicular computing network, the expression defined by the user node is: , In the formula, Represents a user node. Indicates personal mobile device, This refers to an onboard server.

[0060] The expression for a computing node is:

[0061] In the formula, Represents a computing power node. Indicates service vehicles. Indicates an edge server; The expression for personal mobile devices is: ,

[0062] In the formula, This indicates the published computational task. Represents computing resources. Indicates the maximum communication rate. Indicates the number of tasks currently being processed. This indicates the number of CPU cycles. Indicates location label; The expression for the vehicle-mounted server is: ,

[0063] In the formula, This indicates the published computational task. Represents computing resources. Indicates the maximum communication rate. Indicates the number of tasks currently being processed. This indicates the number of CPU cycles. Indicates location label, Represents the state vector; The expression for the edge server is:

[0064] In the formula, Represents computing resources. Indicates the maximum communication rate. Indicates the number of tasks currently being processed. This indicates the number of CPU cycles. Indicates location label; Based on the state vector, the vehicle-mounted server is divided into task vehicles and service vehicles, and then assigned to the user node set and computing power node set respectively.

[0065] The expression for the total available computing power resources of a computing node is:

[0066] In the formula, This represents the total available computing power of the computing nodes. This indicates the maximum computing power of a personal mobile device. This indicates the maximum computing power of the onboard server. This indicates the maximum computing power of the edge server.

[0067] The expression for the set of node spatial labels is:

[0068] In the formula, This represents the set of spatial labels for nodes.

[0069] The expression for the set of spatial labels of computing power nodes is:

[0070] In the formula, This represents the set of CPU cycle counts.

[0071] I, J, K, M, N represent MUEs, VSs, ESS, and users, respectively. computing nodes A set of.

[0072] In vehicular computing networks, it is necessary to consider the many-to-many matching relationship between users and computing nodes, as well as the queuing situation of tasks in the task queue. The tasks published by users also need to be defined separately, with the expression:

[0073] In the formula, Indicates MUE in time slot t With VS A collection of published tasks.

[0074] Each task A primitive property can be represented by a quintuple, expressed as:

[0075] in, It is a mission safety score, and the score varies according to the mission's impact on vehicle safety. It refers to the data size of the task. These are the computing resources required to complete the task. This is the maximum acceptable latency for the task. It is an emergency task vector.

[0076] In this embodiment, a wireless communication model is established between user nodes and computing power nodes; the wireless communication model is used to calculate the task transmission rate and transmission time in the joint optimization model; user nodes and computing power nodes use orthogonal frequency division multiple access (OFDMA) technology to reuse the same channel for wireless communication; assuming... This represents the number of tasks transmitted from a personal mobile device to a computing node in time slot t; This represents the number of tasks transmitted from the vehicle-mounted server to the computing node in time slot t; The transmission rate between a personal mobile device and a computing node is calculated using the following expression:

[0077] In the formula, Indicates personal mobile device and computing nodes The transmission rate between them This represents the bandwidth allocated by the computing node to a personal mobile device in time slot t. This indicates the transmission power of the computing nodes and personal mobile devices during the transmission process. The channel gain represents the wireless propagation channel between computing nodes and personal mobile devices. Represents the distance attenuation factor. This indicates the distance between a personal mobile device and a computing node. This represents the power of white noise. This indicates that the personal mobile device in time slot t... The set of computing nodes covered. This represents the total interference power in the communication of the remaining computing nodes; The expression for calculating the distance between personal mobile devices and computing nodes is as follows:

[0078] In the formula, Indicates the location of a personal mobile device. This indicates the location of the computing node.

[0079] The transmission time for a personal mobile device to transfer a task to a computing node is calculated using the following expression:

[0080] In the formula, Indicates personal mobile device Transmit the task to the computing node Transmission time, This represents the i-th personal mobile device. Indicates the data size of the task; The transmission rate between the vehicle-mounted server and the computing nodes is calculated using the following expression:

[0081] In the formula, Indicates vehicle-mounted server and computing nodes The transmission rate between them It is a computing power node Allocate time slot t to the vehicle server bandwidth, Represents computing nodes during transmission and vehicle-mounted server Transmission power, Indicates vehicle-mounted server and computing nodes Channel gain of the wireless propagation channel between them This represents the power of white noise. This indicates that the onboard server is in time slot t. Coverage of computing nodes The set, Represents the remaining computing power nodes Interference power, Indicates distance attenuation; The expression for calculating the distance between the vehicle-mounted server and the computing node is as follows:

[0082] In the formula, This indicates the location of the vehicle-mounted server.

[0083] The transmission time for the onboard server to transfer the task to the computing node is calculated using the following expression:

[0084] In the formula, Indicates vehicle-mounted server Transmit the task to the computing node Transmission time, Indicates the size of the task data; The transmission rate between the edge server and the service vehicle is calculated using the following expression:

[0085] In the formula, Represents edge server Service vehicles The transmission rate between them Represents edge server Allocated in time slot t bandwidth, Indicates the edge server during transmission Service vehicles Transmission power, Represents edge server Service vehicles Channel gain of the wireless propagation channel between them This represents the power of white noise. This indicates that the edge server is in time slot t. Coverage of computing nodes The set, Represents the remaining computing power nodes Interference power, Indicates distance attenuation; The expression for the distance between the edge server and the service vehicle is:

[0086] In the formula, Indicates the location of the edge server; The transmission time from the edge server to the service vehicle is calculated using the following expression:

[0087] In the formula, Represents edge server Transfer the task to the service vehicle Transmission time, Indicates the size of the task data.

[0088] In this embodiment, a computational model is constructed to calculate the task processing time of the joint optimization model. In this model, each task must and can only be assigned to one computing node. Each computing node allocates computing resources to process tasks in parallel, provided that the allocation does not exceed its maximum computing resource limit. Let... This represents a task allocation vector from a personal mobile device to other computing nodes; This represents the task allocation vector from the onboard server to other computing nodes; the number of tasks being processed by a computing node is denoted as . ; The computing model includes a personal mobile device computing mode, an in-vehicle server computing mode, and an edge server computing mode. In personal mobile device computing mode, when a task is offloaded to a personal mobile device for execution, the expression for calculating the task execution time on the personal mobile device is:

[0089] In the formula, Indicates the time taken for a personal mobile device to perform a task. Indicates the size of the task data. Indicates the size of the task data. This represents the computing resources allocated to a personal mobile device. This represents the number of CPU cycles required for a personal mobile device to complete a task. In the vehicle-mounted server computing mode, when a task is offloaded to the vehicle-mounted server for execution, the expression for calculating the task execution time of the vehicle-mounted server is:

[0090] In the formula, This indicates the time it takes for the onboard server to execute a task. Indicates the size of the task data. Indicates the size of the task data. This indicates the computing resources allocated to the vehicle-mounted server. This indicates the number of CPU cycles required for the onboard server to complete the task. In edge server computing mode, when a task is offloaded to an edge server for execution, the expression for calculating the task execution time on the edge server is:

[0091] In the formula, This indicates the time it takes for the edge server to execute the task. Indicates the size of the task data. Indicates the size of the task data. This indicates the number of CPU cycles required for the edge server to complete the task. This indicates the computing resources allocated to the edge servers; In this embodiment, the computing nodes in the vehicle computing network consist of personal mobile devices (MUE), vehicle servers (VS), and edge servers (ES), and have many-to-many matching characteristics.

[0092] Therefore, the expression for the sum of task completion times for all personal mobile devices is:

[0093] In the formula, This represents the sum of task completion times across all personal mobile devices. Indicates the task transmission time of a personal mobile device. This indicates the task computation time for a personal mobile device.

[0094] The expression for the sum of the task completion times of all in-vehicle servers is:

[0095] In the formula, This represents the sum of the task completion times for all in-vehicle servers. This indicates the task transmission time of the vehicle-mounted server. This indicates the task computation time of the vehicle-mounted server; The expression for the sum of task completion times of all edge servers is:

[0096] In the formula, This represents the sum of task completion times for all edge servers. This indicates the task transmission time of the edge server. This indicates the task computation time on the edge server.

[0097] The expression for calculating the processing time of all tasks in the vehicular computing network is as follows:

[0098] In the formula, This represents the time taken to process all tasks in the onboard computing network. This represents the task execution time of all personal mobile devices within time slot t. This represents the task execution time of all onboard servers within time slot t. This represents the task execution time of all edge servers within time slot t.

[0099] In this embodiment, the total energy consumption in the joint optimization model is calculated based on an energy consumption model; the energy consumption model includes task transmission energy consumption and task computation energy consumption. The energy consumption for task transmission is generated when the user sends a task to the computing node, and is expressed as follows:

[0100] In the formula, Indicates the energy consumption of task transmission. Indicates the size of the task data. Indicates user The generated task Unload to compute nodes Communication rate, A set representing the transmit power of users; The energy consumption for task computation is generated by the computing nodes processing tasks, and is expressed as follows:

[0101] In the formula, Indicates the energy consumption of task calculation. This indicates the parameters of the CPU switching capacitors in the computing node. This represents the computing resources allocated to the computing nodes.

[0102] The energy consumption model is used to calculate the total energy consumption, and its expression is:

[0103] In the formula, This indicates total energy consumption.

[0104] Vehicle-mounted computing networks have strict time requirements when providing services, and they are only effective if they are completed within the user's tolerance time. At the same time, the communication and computing of tasks consume a lot of energy. This application incorporates system energy consumption into the optimization objective and constructs a joint optimization model oriented towards energy consumption.

[0105] In this embodiment, the joint optimization objective is to minimize the task processing time and total energy consumption of the vehicular computing network. Considering constraints on the number of task transfers from personal mobile devices, the number of task transfers from vehicular servers, task indivisibility, upper limits of computing resources, offloading targets, reverse offloading counts, and upper limits of transmit power, a joint optimization model is constructed. The expression of the joint optimization model is:

[0106]

[0107]

[0108]

[0109]

[0110]

[0111]

[0112]

[0113] In the formula, Indicates total energy consumption. This represents the task allocation vector for a personal mobile device. This represents the task allocation vector for the vehicle-mounted server. This indicates the reverse unloading of the matching variable. Indicates the allocation of computing resources. This indicates the reverse unloading of decision variables. Indicates the maximum number of time slots. Indicates the number of user nodes. Indicates the number of computing nodes. This indicates the number of tasks transmitted by a personal mobile device. This represents a set of tasks generated by a personal mobile device. This indicates the number of tasks transmitted by the vehicle-mounted server. This represents the set of tasks generated by the in-vehicle server. This represents a variable indicating task assignment on a personal mobile device. This represents the variable for assigning tasks to the vehicle-mounted server. Represents a collection of personal mobile devices. This represents a collection of vehicle-mounted servers. This represents the computing resources allocated to the computing nodes. This indicates the maximum available computing power resources of a computing node. This indicates that the vehicle is uninstalled from a personal mobile device. Represents the vehicle state vector. This indicates that the onboard server is unloaded from the vehicle. This indicates the reverse unloading of the matching variable. This represents the m-th task. This represents the task queue of the edge server. Indicates the transmission power of the vehicle-mounted server. This indicates the maximum transmission power of the vehicle-mounted server. Indicates the transmit power of a personal mobile device. This indicates the maximum transmit power of a personal mobile device. Represents the normalization coefficient. Represents the normalization coefficient. This indicates the time taken to process all tasks in the onboard computing network. and These are two coefficients of different orders of magnitude, used to normalize time and energy consumption.

[0114] Specifically, constraints C1 and C2 ensure that the number of tasks transferred from personal mobile devices and vehicle servers in time slot t is non-negative and cannot exceed the number of tasks they generated. Constraint C3 states that each task can only be offloaded to one computing node and cannot be divided or repeatedly offloaded. Constraint C4 states that the computing resources that a computing node can allocate cannot exceed the total available computing resources of that computing node, ensuring that each computing node has sufficient computing resources to complete its assigned tasks. Constraint C5 states that the vehicle server can only be used as an offloading target node when it is serving a vehicle. Constraint C6 states that in the edge server, a single task can only be offloaded once. Constraint C7 states that the transmit power does not exceed the maximum limit of the device hardware.

[0115] Example 2 In this embodiment, the process of step S3 in the bidirectional task offloading method for vehicle-mounted computing networks proposed in Embodiment 1 will be described in detail.

[0116] In this embodiment, step S3 is: Step 1: Transform the joint optimization model into a multi-agent Markov decision process. ,in, Indicates the number of user nodes. Indicates the number of computing nodes. Represents the set of state spaces. Represents the action space, Represents the reward function; Step 2: Construct a first soft-Q network, a second soft-Q network, and a policy network; the first and second soft-Q networks are used to estimate state value and action value; the policy network is used to output the action probability distribution; a multi-head self-attention module is introduced into the policy network; Step 3: Initialize the parameters of the first soft-Q network, the second soft-Q network, and the policy network; initialize the state space and the experience replay pool; Step 4: Input the current state space into the multi-head self-attention module to obtain the weighted state; the policy network obtains the action and the state at the next moment after the action is executed based on the weighted state; the reward function is used to calculate the reward value; based on the current state, action, state at the next moment after the action is executed, and reward value, a state-action-reward experience tuple is formed and stored in the experience replay pool. Step 5: Obtain the state-action-reward experience tuple from the experience replay pool as the input to the first soft-Q network and the second soft-Q network, and calculate the target value; based on the target value, update the first soft-Q network and the second soft-Q network by minimizing the temporal difference error loss function; construct the loss function, and update the policy network parameters by minimizing the loss function; Step 6: Update the first target soft-Q network and the second target soft-Q network using a soft update method; Step 7: Repeat steps 4 to 6 until the preset training rounds are reached to obtain the optimized policy network parameters, which are used to output the optimal bidirectional task unloading decision in real time based on the current on-board computing power network status.

[0117] In this embodiment, the agents in the Multi-Agent Problem (MDP) consider the union of all user nodes in the vehicular computing network (VCPN) and edge servers, i.e., all nodes in the VCPN can be considered as agents in the MDP. The user agents make task transfer decisions and allocate computing power to these tasks through interaction with the local environment. The edge server agents determine whether to perform task offloading and select idle service vehicles. The agent set is represented as... .

[0118] The state space of VCPN is based on the proposed optimization problem of minimizing task processing time. The state of all devices that can become intelligent agents Composition, in which

[0119] in, This is a time-varying state unique to vehicle-mounted servers, and other intelligent agents in the state space... Both are 1. =1 indicates that the node provides computing power services to VCPN. This indicates the number of tasks currently being processed by the computing node. express arrive Channel gain and distance attenuation between them This is a state unique to edge servers, representing the highest reallocation priority coefficient in the edge server queue, and other agents in the state space. All are 0.

[0120] In order to minimize the optimal objective and reduce the burden on edge servers, the action space needs to be adjusted according to the dynamic space. Action variables can be divided into two layers: continuous actions and discrete actions. Discrete actions include task unloading vectors for selecting different computing nodes for task unloading, variables for determining whether to perform task reverse unloading during the reverse unloading process, and reverse unloading selection variables. Therefore, the discrete action space can be represented as follows:

[0121] Once the preconditions for task reverse unloading are met, the edge server determines whether task reverse unloading should be performed based on the system's optimization goals. Edge servers do not perform task reverse unloading. Then, the task will be unloaded in reverse, and then further actions will be taken. Select suitable available service vehicles according to the reallocation priority coefficient. Sequential task redistribution: The continuous action space mainly includes the allocation of computing resources by computing nodes:

[0122] Therefore, the action space can be represented as

[0123] To optimize energy consumption, the agents should cooperate. To minimize task processing time and system energy consumption in the optimization problem, the reward function for agent reinforcement learning is set as the reward function for the optimization problem. negative value

[0124] In the constructed MDP model, the given state space and action space are high-dimensional, and the state space suffers from dimensionality transformation due to the vehicle's identity switching mechanism. To address these issues, this application combines a fixed state space dimension with an actor neural network to solve the constructed MDP problem. To address the instability of the state space dimension caused by dynamic emergence of computing power and excessive load on static edge servers, an improved attention mechanism, SA-MASAC (Self-Attention Multi-Agent Soft Actor-Critic), is proposed. MASAC (Multi-Agent Soft Actor-Critic) is a multi-agent deep reinforcement learning algorithm adapted to hybrid action spaces, particularly adept at solving discrete and continuous cooperative control problems in dynamic scenes. Compared to the classic DDPG, MASAC abandons deterministic strategies and adopts a stochastic strategy based on the maximum entropy principle. This characteristic shows significant advantages in the dynamic environment of vehicular computing networks—the identity transformation of SeVs and the explosive arrival of task loads in vehicular scenarios are highly stochastic. The stochastic strategy can encourage agents to explore more effective decision paths by maximizing entropy, ensuring that potentially useful information such as dynamically emerging computing resources and task differentiation of SeVs is not ignored. In the bidirectional task offloading scenario with ES as the hub, the three types of agents, ES, MUE, and VS, need to learn stable decision rules from bidirectional offloading to target node selection and final allocation of computing power. This requires avoiding resource competition conflicts among multiple agents (such as edge servers competing with users for the same service vehicle's computing power during reverse offloading) and achieving load balancing through reverse offloading when ES is overloaded. The maximum entropy objective of SAC perfectly meets this requirement: it can not only drive agents to learn strategies for completing basic task unloading, but also improve the generalization and robustness of the strategy through entropy regularization terms, so that it can still quickly adapt and output the optimal decision under complex situations such as dynamic transformation of SeV identity and fluctuations in task arrival rate, providing reliable strategy support for energy consumption optimization of vehicle computing networks.

[0125] In this embodiment, the multi-head self-attention module uses multiple parallel attention heads to extract features such as the service vehicle status, maximum computing power resources, and the number of current service tasks, and uses dot product attention to calculate feature association. In the multi-head self-attention module, the attention calculation expression for each attention head is as follows:

[0126] In the formula, The query vector represents the vehicle's state characteristics. The key vector obtained from the vehicle state features. This represents the value vector obtained from the vehicle state features, where o represents the scaling factor to prevent gradient vanishing due to excessively large dot product results. The outputs of multiple attention heads are concatenated to obtain multi-head attention features. These features are then processed sequentially through a feedforward network and a residual connection, outputting a weighted state. That is, after concatenating the multi-head attention features, the output is a fixed-dimensional encoded feature vector after passing through a feedforward network and a residual connection. ,Will Using the state directly as input to subsequent MASACs allows the agent to focus on idle service vehicles.

[0127] In this embodiment, the expression for the timing difference error loss function is:

[0128] In the formula, This represents the time-series difference error loss function. Indicates the parameters of the first and second soft-Q networks. This represents the Q-values ​​output by the first and second soft-Q networks. Indicates the target value; The expression for the loss function is:

[0129] In the formula, Represents the loss function. Represents the expectation operator. Represents the entropy regularity coefficient. This represents the Q-values ​​output by the first and second soft-Q networks. This represents the experience replay pool.

[0130] The MASAC algorithm, during optimization, maximizes the cumulative reward by adding an entropy term. This incorporates a weight of policy randomness into the reward, maximizing the long-term expected reward with entropy regularization, thus encouraging policy exploration to adapt to scenarios with dynamic emergence of computing power.

[0131] in The entropy regularity coefficient is... The entropy represents the policy and encourages the exploration of dynamically emerging computational resources within the system. The two parameters in the MASAC algorithm are... The soft-Q network and two parameters are The target soft-Q network is used to form the critique network.

[0132] The target value is obtained through the target soft-Q network, expressed as:

[0133] in Indicates a reward. Indicates the discount factor. This indicates that using a two-objective soft-Q network to calculate future Q-values ​​prevents overestimation and ensures stable updates. This represents the entropy regularization term.

[0134] The parameters are The actor network strategy state The soft value is defined as the soft value function, which is numerically equal to the expected value of the Q function on the action distribution minus the entropy regularization term. The expression is:

[0135]

[0136] in, This indicates the smaller of the two soft-Q network values.

[0137] Entropy regularization parameters are used to make the policy's entropy approach a predefined target entropy using gradient descent. renew The expression for soft-updating two target soft-Q networks is:

[0138] in, It is a soft update coefficient that ensures the stability of the target network.

[0139] In this embodiment, the pseudocode for the multi-agent soft actor-critic algorithm based on the self-attention mechanism is as follows: Inputs: Maximum number of time slots T, MAPPO network parameters, algorithm network parameters Output: Optimized actor network strategy

[0140] Initialize actor network parameters and soft-Q network parameters and the target soft-Q network parameters

[0141] Initialization state And the experience replay pool D and the multi-head self-attention encoder For each episode do: For 1 to T do: renew , will state The input to the multi-head self-attention encoder yields the weighted state.

[0142] For to do: Observe the latest status of the system Policy network generates actions

[0143] End for Receive reward r and

[0144] Stored samples Save to experience replay area D If the number of samples in the experience replay area equals the batch size Randomly sample a batch of data from D. Use the current strategy Sampling action Calculate the target value y By minimizing Update two Q network parameters

[0145] By minimizing Update strategy network parameters

[0146] Update entropy regularization parameters

[0147] Soft update of the Q network parameters of the two targets

[0148] End if End for End for In this embodiment, as Figure 3The flowchart shown illustrates a multi-agent soft actor-critic algorithm based on a self-attention mechanism. In the constructed MDP model, the given state and action spaces are high-dimensional, and the state space undergoes dimensional transformation due to the vehicle's identity switching mechanism. To address this issue, a fixed state space dimension is combined with an actor neural network to solve the constructed MDP problem. To address the instability of the state space dimension caused by dynamic emergence of computing power and excessive load on static edge servers, an improved attention mechanism, SA-MASAC (Self-Attention Multi-Agent Soft Actor-Critic), is proposed. MASAC (Multi-Agent Soft Actor-Critic) is a multi-agent deep reinforcement learning algorithm adapted to hybrid action spaces, particularly adept at solving discrete and continuous collaborative control problems in dynamic scenes. Compared to the classic DDPG, MASAC abandons deterministic strategies and adopts a stochastic strategy based on the maximum entropy principle. This characteristic shows significant advantages in the dynamic environment of vehicular computing networks—the identity transformation of SeVs and the explosive arrival of task loads in vehicular scenarios are highly stochastic. The stochastic strategy can encourage agents to explore more effective decision paths by maximizing entropy, ensuring that potentially useful information such as dynamically emerging computing resources and task differentiation of SeVs is not ignored. In the bidirectional task offloading scenario with ES as the hub, the three types of agents, ES, MUE, and VS, need to learn stable decision rules from bidirectional offloading to target node selection and final allocation of computing power. This requires avoiding resource competition conflicts among multiple agents (such as edge servers competing with users for the same service vehicle's computing power during reverse offloading) and achieving load balancing through reverse offloading when ES is overloaded. The maximum entropy objective of SAC perfectly meets this requirement: it can not only drive agents to learn strategies for completing basic task unloading, but also improve the generalization and robustness of the strategy through entropy regularization terms, so that it can still quickly adapt and output the optimal decision under complex situations such as dynamic transformation of SeV identity and fluctuations in task arrival rate, providing reliable strategy support for energy consumption optimization of vehicle computing networks.

[0149] The Self-Attention Multi-Agent Soft Actor-Critic (SA-MASAC) algorithm is optimized using a self-attention mechanism. In vehicular computing networks, the task transfer between users and computing nodes, as well as the allocation of computing resources, are crucial. Effective task offloading decisions can optimize task processing time and reduce energy consumption. To efficiently address this issue, the SAMASAC algorithm is introduced. This algorithm aims to minimize the energy consumption optimization model by solving for the bidirectional task offloading strategy between users and computing nodes, as well as the allocation of computing resources. Specifically, users select the optimal bidirectional task offloading strategy based on the current state of the vehicular computing network, ensuring that critical tasks are processed promptly even with limited resources. This not only effectively reduces task processing time and system energy consumption but also improves the stability of the vehicular computing network, thereby significantly enhancing the overall system's operating efficiency and service quality.

[0150] Example 3 In this embodiment, the identity conversion mechanism and the reverse task offloading model in the bidirectional task offloading method for vehicle-mounted computing networks proposed in Embodiment 1 are described in detail.

[0151] In this embodiment, the computing power network is a pool of computing resources composed of any available computing resources. In the vehicle-mounted computing power network, the vehicle also functions as a task requester ( ) and computing power service providers ( Dual role. However, existing methods often overlook the uncertainty caused by the vehicle's driving behavior on the road when providing computing power services to the computing network, making it difficult to adapt to the dynamic changes in the network structure of the vehicle computing network.

[0152] An identity transition model is established to determine whether a vehicle can provide services to the computing network while driving on the road. The model is designed as follows: During network operation, the onboard server estimates its CPU utilization in real time and determines whether the vehicle is in an emergency, dynamically deciding whether its computing node identity remains valid. Once the identity changes, the server immediately exits or rejoins the computing pool. This avoids queue surges caused by vehicles in emergency situations migrating unfinished tasks back to the computing network, while also allowing the vehicle to continue requesting services as a regular user and reintegrating idle onboard servers into the computing network to increase computing resources.

[0153] In this embodiment, the identity conversion mechanism divides the vehicle-mounted server into task vehicles and service vehicles. Task vehicles act solely as user node vehicle-mounted servers, requesting computing power services. Service vehicles act as both user node vehicle-mounted servers and computing power node vehicle-mounted servers, requesting computing power services while simultaneously providing computing power services to other tasks. When the vehicle-mounted server is idle, its status is set to service vehicle, acting as both a user node and a computing power node. When the vehicle-mounted server is busy, its status is set to task vehicle, acting solely as a user node. Specifically: The expression for calculating the CPU utilization of the vehicle-mounted server is:

[0154] In the formula, This indicates the CPU utilization rate of the vehicle-mounted server. Indicates the allocated computing resources. Indicates the total available computing resources; Based on the state vector of the vehicle server The vehicle-mounted server is divided into mission vehicles and service vehicles, and the distinction expression is:

[0155] In the formula, This represents the state vector of the vehicle-mounted server. Indicates vehicle-mounted server, Indicates the mission vehicle. Indicates service vehicles; When the CPU utilization of the onboard server in the task vehicle state falls below the first threshold after processing the current computing task ( , (It is a constant), the state vector of the vehicle server is set to 1, and it enters the computing power node set and is converted into a service vehicle; When the CPU utilization of the onboard server in the service vehicle state exceeds the second threshold after processing the current computing task ( , (It is a constant), the state vector of the vehicle server is set to 0, it exits the computing node set, and is converted into a task vehicle; When an emergency task is generated, the service vehicle prioritizes handling its own emergency task, starts a timer to record the duration of the emergency state, and if the duration of the emergency state exceeds the emergency threshold, the state vector of the on-board server is set to 0, and the vehicle is forcibly converted to a task vehicle.

[0156] Time slot t suddenly generated an urgent task and decided to unload it locally. Service vehicles from 0 to 1 Prioritize handling your own urgent tasks to ensure real-time response. Also, start a timer to record the time you enter an emergency state. If the emergency task processing time exceeds the threshold Service vehicles State vector Setting the value to 0 forcibly downgrades the vehicle's identity to that of a service vehicle and stops providing computing power services. After the identity change, the vehicle clears all non-self tasks from its task queue and provides priority compensation for interrupted external tasks. Considering the vehicle's high-speed mobility, interrupted external tasks are returned to the onboard computing network for task offloading. If Then continue to complete the unfinished tasks, and then sort the tasks in the queue by priority factor.

[0157] To avoid impacting system stability and efficiency due to frequent vehicle identity changes, vehicles should retain their current identity after any non-emergency identity change. Only after this can the next identity change be carried out, among which It is the minimum role duration.

[0158] In this embodiment, in the task reverse unloading model: The CPU utilization of the edge server is calculated using the following expression:

[0159] In the formula, This indicates the CPU utilization of the edge server. This indicates the computing resources allocated to the edge server. This indicates the total available computing resources on the edge servers; When the CPU utilization of the edge server exceeds the preset overload threshold, the edge server is deemed to be overloaded. When the edge server CPU utilization exceeds the edge server CPU overload threshold When an edge server is deemed overloaded, if an idle computing vehicle exists, the edge server can be analogous to users in a vehicle-mounted computing network redistributing tasks in the queue. Let... This indicates the task's reverse unloading matching variable, representing the edge server. The task is reverse-unloaded to the vehicle server. In this process, when an edge server decides to perform task reverse offloading, it needs to select tasks from its own task queue for reallocation. Task reverse offloading needs to consider both the load reduction effect on the edge server and the tasks in the task queue that are closer to their completion tolerance time. Therefore, a Redistribution Priority Coefficient (RPC) is used to determine the order of task reverse offloading.

[0160] The order of task reverse unloading is determined based on the reverse allocation priority coefficient; the expression for the reverse allocation priority coefficient is:

[0161] In the formula, Indicates the reverse allocation priority coefficient. Indicates the weighting coefficient. Indicates the weighting coefficient. This represents the data size of the m-th task. This represents the task queue of computing node n. This represents the m-th task. Indicates the maximum acceptable latency for the task. Indicates the remaining tolerance time for the task.

[0162] in, Prioritizing tasks with larger sizes can effectively reduce queuing time and reduce the load on edge servers. The urgency of tasks is assessed by considering how much time they have left in the current queue before completion. When the system makes an offloading decision in time slot t, it doesn't know if there are any idle service vehicles available as computing nodes in the next time slot, thus preventing it from making the optimal offloading decision. Task reverse offloading helps the system better consider tasks that have timed out due to queuing in time slot t+1. Furthermore, the higher the reallocation priority coefficient, the more likely the task should be reallocated to an idle service vehicle.

[0163] Addressing the challenges of numerous but relatively weak computing power among mobile devices (MUEs) in vehicular computing networks, and the unstable provision of computing services by onboard servers while driving, edge servers, as fixed core computing nodes, can become overloaded when tasks surge or when many onboard servers are unable to provide services. Considering the characteristic of the vehicular computing network's identity switching mechanism continuously generating idle computing nodes, and the core contradiction of edge servers (ES) being prone to overload due to concentrated tasks, and service vehicles (SeVs) dynamically generating idle computing power due to identity switching, a bidirectional task offloading mechanism with ES as the hub is proposed. Existing research shows that edge servers only serve as computing nodes to provide services to the computing network because they do not have their own task requirements and cannot act as users of the computing network. However, in the bidirectional task offloading mechanism, edge servers can proactively utilize the dynamically emerging idle computing power of onboard servers to reduce their own load when overloaded, thus maximizing the utilization of idle computing power.

[0164] In vehicular computing networks, different nodes have different characteristics. Personal mobile devices are numerous but have weak computing power, and vehicular servers are unstable. With an identity-switching mechanism in the vehicular computing network, in each time slot, a task vehicle with a low workload may be converted into a service vehicle to provide services to the computing network. Edge servers, as simple computing nodes, bear a large number of computing tasks in the computing network. When the system task arrival rate is high, edge servers often experience overload, meaning the assigned tasks are close to the edge server's service limit, affecting system stability. However, in vehicular computing networks with an identity-switching mechanism, due to the identity-switching characteristics of vehicular servers, idle vehicular servers may re-enter the computing node set in each time slot. Therefore, this patent proposes an edge server task reverse offloading model. That is, while the system makes a forward task offloading decision in time slot t, if the edge server is under high load and there are idle service vehicles that have become computing nodes again, then the edge server can act as a user to reverse offload the tasks that have already been offloaded to the edge server, assigning these tasks to idle service vehicles to improve the utilization rate of computing power.

[0165] This embodiment addresses the uncertainty arising from the dual role of the vehicle-mounted server as a computing node within the vehicle-mounted computing network. A role-switching mechanism is proposed to clarify the conditions under which the vehicle-mounted server can provide services to the network, assuming parallel task processing without queuing. Tasks within the network are tiered, taking into account safety during vehicle operation. An approach is proposed where edge servers act as users, offloading tasks assigned to them to idle service vehicles to better achieve Nash balance. This offloading redistributes computing power; when edge servers lack sufficient computing power, the system can only allocate a limited amount to tasks. Assigning these tasks to idle service vehicles allows for more computing resources to be used, improving system efficiency. An attention mechanism combined with reinforcement learning helps reinforcement learning focus on the dynamically emerging computing power of vehicle-mounted servers, improving computing power utilization.

[0166] The embodiments described are merely examples to clearly illustrate the present invention and are not intended to limit the implementation of the invention. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively describe all possible implementations. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for bidirectional task offloading for vehicular computing networks, characterized in that, Includes the following steps: S1: Construct an in-vehicle computing power network including user nodes and computing power nodes; the user nodes include personal mobile devices and in-vehicle servers, and the computing power nodes include personal mobile devices, in-vehicle servers and edge servers; S2: With minimizing the task processing time and total energy consumption of the vehicle computing network as the joint optimization objective, a joint optimization model is constructed by comprehensively considering the energy consumption constraints of task transmission and task computing of personal mobile devices, vehicle servers and edge servers. S3: Transform the joint optimization model into a multi-agent Markov decision process, and use a multi-agent soft actor-critic algorithm based on self-attention mechanism to solve it and obtain the optimal task offloading strategy. S4: In each time slot, after a user node’s personal mobile device or vehicle server generates a computing task, the optimal task offloading strategy is used to forward offload each computing task to the node with the best computing power for processing. During the computation task processing, an identity switching mechanism is executed based on the status changes of the vehicle server. When the vehicle server is idle, it acts as both a user node and a computing power node; when the vehicle server is busy, it acts only as a user node. During the processing of computing tasks, when the load on the edge server exceeds the threshold, the computing tasks that were offloaded to the edge server are offloaded back to the vehicle server currently in the computing power node for execution using the task reverse offloading model. S5: Repeat step S4 until the maximum number of time slots is reached, at which point the vehicle-mounted computing network stops operating.

2. The method for bidirectional task offloading for vehicle-mounted computing networks according to claim 1, characterized in that, A wireless communication model is established between user nodes and computing power nodes; this wireless communication model is used to calculate the task transmission rate and transmission time in the joint optimization model; user nodes and computing power nodes use orthogonal frequency division multiple access (OFDMA) technology to reuse the same channel for wireless communication; assuming... This represents the number of tasks transmitted from a personal mobile device to a computing node in time slot t; This represents the number of tasks transmitted from the vehicle-mounted server to the computing node in time slot t; The transmission rate between a personal mobile device and a computing node is calculated using the following expression: In the formula, Indicates personal mobile device and computing nodes The transmission rate between them This represents the bandwidth allocated by the computing node to a personal mobile device in time slot t. This indicates the transmission power of the computing nodes and personal mobile devices during the transmission process. The channel gain represents the wireless propagation channel between computing nodes and personal mobile devices. Represents the distance attenuation factor. This indicates the distance between a personal mobile device and a computing node. This represents the power of white noise. This indicates that the personal mobile device in time slot t... The set of computing nodes covered. This represents the total interference power in the communication of the remaining computing nodes; The transmission time for a personal mobile device to transfer a task to a computing node is calculated using the following expression: In the formula, Indicates personal mobile device Transmit the task to the computing node Transmission time, This represents the i-th personal mobile device. Indicates the data size of the task; The transmission rate between the vehicle-mounted server and the computing nodes is calculated using the following expression: In the formula, Indicates vehicle-mounted server and computing nodes The transmission rate between them It is a computing power node Allocate time slot t to the vehicle server bandwidth, Represents computing nodes during transmission and vehicle-mounted server Transmission power, Indicates vehicle-mounted server and computing nodes Channel gain of the wireless propagation channel between them This represents the power of white noise. This indicates that the onboard server is in time slot t. Coverage of computing nodes The set, Represents the remaining computing power nodes Interference power, Indicates distance attenuation; The transmission time for the onboard server to transfer the task to the computing node is calculated using the following expression: In the formula, Indicates vehicle-mounted server Transmit the task to the computing node Transmission time, Indicates the size of the task data; The transmission rate between the edge server and the service vehicle is calculated using the following expression: In the formula, Represents edge server Service vehicles The transmission rate between them Represents edge server Allocated in time slot t bandwidth, Indicates the edge server during transmission Service vehicles Transmission power, Represents edge server Service vehicles Channel gain of the wireless propagation channel between them This represents the power of white noise. This indicates that the edge server is in time slot t. Coverage of computing nodes The set, Represents the remaining computing power nodes Interference power, Indicates distance attenuation; The transmission time from the edge server to the service vehicle is calculated using the following expression: In the formula, Represents edge server Transfer the task to the service vehicle Transmission time, Indicates the size of the task data.

3. The method for bidirectional task offloading for vehicle-mounted computing networks according to claim 1, characterized in that, Construct a computational model, which is used to calculate the task processing time of the joint optimization model; In the computational model, each task must and can only be assigned to one computing node; the computing node allocates computing resources to process tasks in parallel, without exceeding its own maximum computing resource limit; let... This represents a task allocation vector from a personal mobile device to other computing nodes; This represents the task allocation vector from the onboard server to other computing nodes; the number of tasks being processed by a computing node is denoted as . ; The computing model includes a personal mobile device computing mode, an in-vehicle server computing mode, and an edge server computing mode. In personal mobile device computing mode, when a task is offloaded to a personal mobile device for execution, the expression for calculating the task execution time on the personal mobile device is: In the formula, Indicates the time taken for a personal mobile device to perform a task. Indicates the size of the task data. Indicates the size of the task data. This represents the computing resources allocated to a personal mobile device. This represents the number of CPU cycles required for a personal mobile device to complete a task. In the vehicle-mounted server computing mode, when a task is offloaded to the vehicle-mounted server for execution, the expression for calculating the task execution time of the vehicle-mounted server is: In the formula, This indicates the time it takes for the onboard server to execute a task. Indicates the size of the task data. Indicates the size of the task data. This indicates the computing resources allocated to the vehicle-mounted server. This indicates the number of CPU cycles required for the onboard server to complete the task. In edge server computing mode, when a task is offloaded to an edge server for execution, the expression for calculating the task execution time on the edge server is: In the formula, This indicates the time it takes for the edge server to execute the task. Indicates the size of the task data. Indicates the size of the task data. This indicates the number of CPU cycles required for the edge server to complete the task. This indicates the computing resources allocated to the edge servers; The expression for calculating the processing time of all tasks in the vehicular computing network is as follows: In the formula, This represents the time taken to process all tasks in the onboard computing network. This represents the task execution time of all personal mobile devices within time slot t. This represents the task execution time of all onboard servers within time slot t. This represents the task execution time of all edge servers within time slot t.

4. The method for bidirectional task offloading for vehicle-mounted computing networks according to claim 1, characterized in that, The total energy consumption in the joint optimization model is calculated based on the energy consumption model; the energy consumption model includes task transmission energy consumption and task computing energy consumption. The energy consumption for task transmission is generated when the user sends a task to the computing node, and is expressed as follows: In the formula, Indicates the energy consumption of task transmission. Indicates the size of the task data. Indicates user The generated task Unload to compute nodes Communication rate, A set representing the transmit power of users; The energy consumption for task computation is generated by the computing nodes processing tasks, and is expressed as follows: In the formula, Indicates the energy consumption of task calculation. This indicates the parameters of the CPU switching capacitors in the computing node. This represents the computing resources allocated to the computing nodes; The energy consumption model is used to calculate the total energy consumption, and its expression is: In the formula, This indicates total energy consumption.

5. A method for bidirectional task offloading for vehicle-mounted computing networks according to claim 1, characterized in that, With minimizing the task processing time and total energy consumption of the in-vehicle computing network as the joint optimization objective, and comprehensively considering the energy consumption constraints of task transmission and task computing of personal mobile devices, in-vehicle servers, and edge servers, a joint optimization model is constructed; the expression of the joint optimization model is: In the formula, Indicates total energy consumption. This represents the task allocation vector for a personal mobile device. This represents the task allocation vector for the vehicle-mounted server. This indicates the reverse unloading of the matching variable. Indicates the allocation of computing resources. This indicates the reverse unloading of decision variables. Indicates the maximum number of time slots. Indicates the number of user nodes. Indicates the number of computing nodes. This indicates the number of tasks transmitted by a personal mobile device. This represents a set of tasks generated by a personal mobile device. This indicates the number of tasks transmitted by the vehicle-mounted server. This represents the set of tasks generated by the in-vehicle server. This represents a variable indicating task assignment on a personal mobile device. This represents the variable for assigning tasks to the vehicle-mounted server. Represents a collection of personal mobile devices. This represents a collection of vehicle-mounted servers. This represents the computing resources allocated to the computing nodes. This indicates the maximum available computing power resources of a computing node. This indicates that the vehicle is uninstalled from a personal mobile device. Represents the vehicle state vector. This indicates that the onboard server is unloaded from the vehicle. This indicates the reverse unloading of the matching variable. This represents the m-th task. This represents the task queue of the edge server. Indicates the transmission power of the vehicle-mounted server. This indicates the maximum transmission power of the vehicle-mounted server. Indicates the transmit power of a personal mobile device. This indicates the maximum transmit power of a personal mobile device. Represents the normalization coefficient. Represents the normalization coefficient. This indicates the time taken to process all tasks in the onboard computing network.

6. A method for bidirectional task offloading for vehicle-mounted computing networks according to claim 1, characterized in that, Step S3 is as follows: Step 1: Transform the joint optimization model into a multi-agent Markov decision process. ,in, Indicates the number of user nodes. Indicates the number of computing nodes. Represents the set of state spaces. Represents the action space. Represents the reward function; Step 2: Construct a first soft-Q network, a second soft-Q network, and a policy network; the first and second soft-Q networks are used to estimate state value and action value; the policy network is used to output the action probability distribution; a multi-head self-attention module is introduced into the policy network; Step 3: Initialize the parameters of the first soft-Q network, the second soft-Q network, and the policy network; initialize the state space and the experience replay pool; Step 4: Input the current state space into the multi-head self-attention module to obtain the weighted state; the policy network obtains the action and the state at the next moment after the action is executed based on the weighted state; the reward function is used to calculate the reward value; based on the current state, action, state at the next moment after the action is executed, and reward value, a state-action-reward experience tuple is formed and stored in the experience replay pool. Step 5: Obtain the state-action-reward experience tuple from the experience replay pool as the input to the first soft-Q network and the second soft-Q network, and calculate the target value; based on the target value, update the first soft-Q network and the second soft-Q network by minimizing the temporal difference error loss function; construct the loss function, and update the policy network parameters by minimizing the loss function; Step 6: Update the first target soft-Q network and the second target soft-Q network using a soft update method; Step 7: Repeat steps 4 to 6 until the preset training rounds are reached to obtain the optimized strategy network parameters, which are used to output the optimal task offloading strategy in real time based on the current on-board computing power network status.

7. A method for bidirectional task offloading for vehicle-mounted computing networks according to claim 6, characterized in that, The multi-head self-attention module uses multiple parallel attention heads to extract features such as the status of the service vehicle, the maximum computing power resources, and the number of current service tasks, and uses dot product attention to calculate feature association. In the multi-head self-attention module, the attention calculation expression for each attention head is as follows: In the formula, The query vector represents the vehicle's state characteristics. The key vector obtained from the vehicle state features. This represents the value vector obtained from the vehicle state features, where o represents the scaling factor; The outputs of multiple attention heads are concatenated to obtain multi-head attention features; the multi-head attention features are then processed sequentially through a feedforward network and a residual connection to output a weighted state.

8. A method for bidirectional task offloading for vehicular computing networks according to claim 6, characterized in that, The expression for the timing difference error loss function is: In the formula, This represents the time-series difference error loss function. Indicates the parameters of the first and second soft-Q networks. This represents the Q-values ​​output by the first and second soft-Q networks. Indicates the target value; The expression for the loss function is: In the formula, Represents the loss function. Represents the expectation operator. Represents the entropy regularity coefficient. This represents the Q-values ​​output by the first and second soft-Q networks. This represents the experience replay pool.

9. A method for bidirectional task offloading for vehicle-mounted computing networks according to claim 1, characterized in that, In the identity conversion mechanism, the vehicle-mounted server is divided into task vehicles and service vehicles. Task vehicles act solely as user node vehicle-mounted servers, requesting computing power services. Service vehicles act as both user node vehicle-mounted servers and computing power node vehicle-mounted servers, requesting computing power services while simultaneously providing computing power services to other tasks. When the vehicle-mounted server is idle, its status is set to service vehicle, acting as both a user node and a computing power node. When the vehicle-mounted server is busy, its status is set to task vehicle, acting solely as a user node. Specifically: The expression for calculating the CPU utilization of the vehicle-mounted server is: In the formula, This indicates the CPU utilization rate of the vehicle-mounted server. Indicates the allocated computing resources. Indicates the total available computing resources; Based on the state vector of the vehicle server The vehicle-mounted server is divided into mission vehicles and service vehicles, and the distinction expression is: In the formula, This represents the state vector of the vehicle-mounted server. Indicates vehicle-mounted server, Indicates the mission vehicle. Indicates service vehicles; When the CPU utilization of the onboard server in the task vehicle state is lower than the first threshold after processing the current computing task, the state vector of the onboard server is set to 1 and it is converted into a service vehicle. When the CPU utilization of the onboard server in the service vehicle state exceeds the second threshold after processing the current computing task, the state vector of the onboard server is set to 0, and it is converted into a task vehicle. When an emergency task is generated, the service vehicle prioritizes handling its own emergency task, starts a timer to record the duration of the emergency state, and if the duration of the emergency state exceeds the emergency threshold, the state vector of the on-board server is set to 0, and the vehicle is forcibly converted to a task vehicle.

10. A method for bidirectional task offloading for vehicular computing networks according to claim 1, characterized in that, In the task reverse unloading model: The CPU utilization of the edge server is calculated using the following expression: In the formula, This indicates the CPU utilization of the edge server. This indicates the computing resources allocated to the edge server. This indicates the total available computing resources on the edge servers; When the CPU utilization of the edge server exceeds the preset overload threshold, the edge server is deemed to be overloaded. The order of task reverse unloading is determined based on the reverse allocation priority coefficient; the expression for the reverse allocation priority coefficient is: In the formula, Indicates the reverse allocation priority coefficient. Indicates the weighting coefficient. Indicates the weighting coefficient. This represents the data size of the m-th task. This represents the task queue of computing node n. This represents the m-th task. Indicates the maximum acceptable latency for the task. Indicates the remaining tolerance time for the task.