Task offloading and resource allocation method and system combining data security in internet of vehicles

By constructing a vehicle-to-everything (V2X) environment system model and using a reinforcement learning framework to optimize task offloading and resource allocation, the problem of balancing computing performance and data protection in vehicle edge computing is solved, thereby improving data security and system latency reliability.

CN121397490BActive Publication Date: 2026-05-19GUIZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUIZHOU UNIV
Filing Date
2025-10-31
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing vehicle edge computing task offloading solutions fail to effectively balance computing performance and data protection, and do not fully consider factors such as user vehicle mobility and location, task data size, security level, and randomness of task priority, resulting in insufficient data security and efficiency.

Method used

A vehicle-to-everything (V2X) environment system model is constructed. Combining the joint optimization objectives of task offloading, resource allocation, and data protection, a reinforcement learning framework is used to design a policy network and a value network. By quantifying the success rate of data encryption protection and the system latency throughout the task process, task offloading and resource allocation are optimized.

Benefits of technology

This invention implements a task offloading scheme that balances security and computing performance in the Internet of Vehicles, improving data protection success rate and system latency reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121397490B_ABST
    Figure CN121397490B_ABST
Patent Text Reader

Abstract

The application discloses a task offloading and resource allocation method and system combined with data security in Internet of Vehicles, which comprises the following steps: obtaining data information of edge servers, vehicles and base stations in a three-layer architecture scene of a center control layer, an edge computing layer and a user vehicle layer, and establishing a system model; establishing a problem model according to the system model, an optimization target and a constraint condition; training the problem model according to a task offloading, data security and resource allocation strategy based on a proximal policy optimization algorithm until the algorithm converges; inputting current vehicle states, edge server states and communication states, and outputting base station selection of task offloading of each vehicle, allocated computing resources and encryption protection strategies by using the trained algorithm model; and further calculating and quantifying global indexes according to the output scheme. The application evaluates the safety and reliability of task offloading by taking into account the randomness of user vehicles, and quantifying the data encryption protection success rate and the task whole-process system time delay.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer model task offloading and resource allocation technology, specifically to a task offloading and resource allocation method in conjunction with data security in the Internet of Vehicles (IoV), and also to a task offloading and resource allocation system in conjunction with data security in the IoV. Background Technology

[0002] Vehicle edge computing (VEC) reduces system latency and power consumption by offloading tasks generated by vehicles to nearby edge servers. However, the communication process between vehicles and edge servers often involves the transmission and processing of sensitive vehicle data, increasing the risks of data leakage, tampering, malicious attacks, and unauthorized access. To ensure user privacy and system security, data security has become one of the core issues in VEC research. Data protection is related to the protection of user privacy and the trustworthiness of edge computing systems. By introducing data protection mechanisms into multi-objective task offloading and resource allocation optimization, the resilience of edge computing systems can be enhanced, promoting their adoption and application in key areas such as healthcare, fintech, and smart cities. This research direction will provide technical support for the long-term development of edge computing and lay a solid foundation for building a secure and reliable distributed intelligent computing architecture.

[0003] Among numerous security technologies, symmetric encryption algorithms have garnered significant attention due to their high computational efficiency and fast encryption / decryption speeds, making them particularly suitable for edge computing scenarios with high real-time requirements. Symmetric encryption reduces computational overhead and latency while ensuring data confidentiality by using the same key for both sending and receiving data. For example, AES (Advanced Encryption Standard) is a widely used symmetric encryption algorithm that provides efficient encryption services for edge computing systems. However, during task offloading and resource allocation, data protection requires a comprehensive consideration of the balance between computational performance and data security. Different encryption algorithms have varying encryption and decryption time costs; for instance, algorithms with better encryption performance often require more resources and longer processing times, while algorithms with lower encryption performance require fewer resources and less processing time. Tasks generated by different user vehicles often possess different attributes (size, expected security level, required computational resources, etc.), therefore, it is necessary to rationally select data protection and resource allocation strategies based on the task's attributes.

[0004] Existing VEC offloading solutions rarely consider the balance between computing performance and data protection, and rarely take into account factors such as user vehicle mobility and location, task data size, security level, and the randomness of task priority. Therefore, there is an urgent need for a task offloading and resource allocation method that is based on user needs and takes into account both safety and efficiency. Summary of the Invention

[0005] The technical problem to be solved by this invention is: a method and system for task offloading and resource allocation that combines data security in the Internet of Vehicles. By incorporating factors such as user vehicle mobility and location, task data size, security level, and randomness of task priority, and quantifying the success rate of data encryption protection and the system latency of the entire task process, the security and reliability of task offloading are evaluated, thereby achieving both security and improved computing performance.

[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a method for task offloading and resource allocation in the Internet of Vehicles that combines data security, the method comprising the following steps:

[0007] S1. Obtain relevant data on the location, mobility, computing power, and communication parameters of edge servers, vehicles, and base stations in the three-layer architecture consisting of the central control layer, edge computing layer, and user vehicle layer. Based on this relevant data, construct a system model in the vehicle network environment. The system model includes: a vehicle mobility behavior model, a wireless communication channel model between the vehicle and the base station, an end-to-end latency model involved in the coverage task from encryption and transmission to local or edge execution, and a security performance model characterizing the potential leakage risks and protection mechanisms faced by data during transmission.

[0008] S2. Based on the system model in S1, and combining the joint optimization objectives of task offloading, resource allocation, and data protection, and introducing system resource constraints (such as computing resources, encryption overhead, etc.) and service quality constraints (such as task completion latency and security requirements), an optimization problem model for joint task offloading, data security, and resource allocation is established.

[0009] S3. Based on the optimization problem model, a reinforcement learning framework based on the proximal policy optimization method is introduced. A reinforcement learning model including a policy network and a value network is designed and trained. During the training process, the policy network is used to output specific unloading and encryption actions, and the value network is used to evaluate the expected benefits of actions in the current state, until the reinforcement learning model converges.

[0010] S4. Using the reinforcement learning model (i.e. the solution model for the optimization problem) trained and converged in S3, input the system parameters of the current vehicle status, edge server status, and communication status, and output the optimal unloading location (base station selection), allocated edge computing resources, and encryption protection strategy for each task.

[0011] S5. Based on the output results in S4, calculate and quantify global indicators, including the average data protection failure rate and average system latency of all vehicles, and save the model.

[0012] Furthermore, the implementation method in step S1 above includes the following specific steps:

[0013] S1-1. Set the data information for the user vehicle layer;

[0014] S1-2, Set the data information for the edge computing layer;

[0015] S1-3, the road length is represented by L, the number of lanes is LN, the width of each lane is LW, and the roadside basic units are evenly distributed on one side of the road; the initial lanes are selected randomly, and the vehicle speed... Randomly selected within the range of (5 m / s, 20 m / s);

[0016] Calculate vehicles At the next moment The location of the vehicle Position is determined by the following formula:

[0017]

[0018]

[0019] In the formula, Indicates vehicle At the next moment X-axis coordinates Indicates vehicle At the present moment X-axis coordinates For vehicles At the present moment speed, The time interval represents the duration of each time slot, where T represents the continuous driving time of the vehicle, and S represents the number of time slots. Indicates vehicle At the next moment Y-axis coordinate, For the first One vehicle Lane index at any time, Indicates the width of the lane;

[0020] S1-4, Calculate vehicles and the A roadside basic unit The large-scale path loss and large-scale fading components between nodes are calculated using the following formulas:

[0021]

[0022]

[0023] In the formula, This represents large-scale path loss. Indicates vehicle and roadside basic units exist Physical distance at any given moment Represents the large-scale fading component. Indicates the shadow effect. This indicates random fading of the signal;

[0024] S1-5, Calculate small-scale path fading Small-scale path fading Calculated using the following formula:

[0025]

[0026] In the formula, Represents the smoothing factor. This represents the path loss index. Indicates vehicle and roadside basic units In the previous moment Physical distance at time This indicates the small-scale path fading at the previous moment;

[0027] S1-6, Calculate vehicles and roadside basic units Channel gain between Channel gain The calculation is performed using the following formula:

[0028]

[0029] In the formula, This indicates small-scale path fading. Represents large-scale fading components;

[0030] S1-7, Calculate the vehicle Task data uplink transmission rate Task data uplink transmission rate The calculation is performed using the following formula:

[0031]

[0032] In the formula, Indicates data transmission to the vehicle power, This represents the power of Gaussian white noise. This represents the orthogonal bandwidth between all vehicles and the edge server. Indicates vehicle and roadside basic units Channel gain between;

[0033] S1-8 Calculate the system latency of task unloading. The unloading latency is calculated based on the upload rate and task size, priority, and security requirements in S1-7. The unloading latency includes local encryption latency, transmission latency, and decryption and calculation latency on the server.

[0034] S1-9 Calculate the probability of task failure Task failure probability The calculation is performed using the following formula:

[0035]

[0036] In the formula, This indicates the encryption level of the encryption algorithm ek. For the first One vehicle Minimum security level coefficient for the task at any given time. For the first One vehicle Maximum security level coefficient for the task at any given time. Indicates the safety factor of the task;

[0037] S1-10. Calculate the average latency of all vehicle tasks. Average delay The calculation is performed using the following formula:

[0038]

[0039] In the formula, Let it be a binary variable, representing the task. Was it unloaded to the roadside base unit? ; The value is 1 or 0. = 1 indicates a task Unloaded to roadside base unit , = 0 indicates a task It was unloaded to another node. For vehicles exist The task at all times Indicates task From vehicles Upload to the target roadside basic unit Total delay, For the first One vehicle Maximum tolerable delay at any given moment; This indicates the number of vehicles traveling in the lane. Indicates the number of roadside basic units;

[0040] S1-11. Calculate the average protection failure probability for all vehicle tasks. Average protection failure probability The calculation is performed using the following formula:

[0041]

[0042] In the formula, Let it be a binary variable, representing the task. Whether to use the EK encryption algorithm for encryption. = 1 indicates a task Using the EK encryption algorithm, = 0 indicates that no encryption algorithm ek was used; For the first One vehicle The maximum tolerable probability of secure offloading failure for the task generated at any given time, where D is the set of optional encryption algorithms. For the task The probability of secure uninstallation failure using the EK encryption algorithm;

[0043] S1-12. Calculate the average penalty value for all vehicle tasks. Average penalty value The calculation is performed using the following formula:

[0044]

[0045] In the formula, For the task Penalty value for completing within the time limit, penalty value The calculation is performed using the following formula:

[0046]

[0047] In the formula, For the first One vehicle Task priority at any given moment Indicates task From vehicles Upload to the target roadside basic unit Total delay, For the first One vehicle Maximum tolerable delay at any given moment.

[0048] Furthermore, the method for setting the user vehicle layer data information in step S1-1 above includes the following steps:

[0049] S1-1-1, Assume the user vehicle layer includes A vehicle traveling in the lane is denoted as ,in, For the first vehicle, denoted as [task name missing]. In the model, a given time period T is divided into equal time slots, denoted as... ;

[0050] S1-1-2, Setting up vehicles exist The information at the start time is represented as ;

[0051] in, Representing vehicles Location information, For the first One vehicle The speed of time For the first One vehicle Lane index at any time, For the first One vehicle The ability to calculate time. For the first One vehicle Real-time data upload power;

[0052] S1-1-3, Setting the Task In time The information is ;

[0053] in, For the first One vehicle The data size of the task at any given time. For the first One vehicle The number of CPU cycles required to compute a unit bit of data at any given time. For the first One vehicle Minimum security level coefficient for the task at any given time. For the first One vehicle Maximum security level coefficient for the task at any given time. For the first One vehicle Task priority at any given moment For the first One vehicle The maximum tolerable delay at any given moment. For the first One vehicle The maximum tolerable probability of safe uninstallation failure at any given time.

[0054] Furthermore, the task unloading delay calculation steps in steps S1-8 above are as follows:

[0055] S1-8-1, Encryption delay of computational tasks in vehicles Encryption delay The calculation is performed using the following formula:

[0056]

[0057] In the formula, For the first One vehicle The data size of the task at any given time. This represents the number of CPU clock cycles required to perform encrypted unit bit data calculation using the encryption algorithm ek. The computing power of the vehicle used for encryption operations;

[0058] S1-8-2, Calculation task from vehicle Transmitted to the target roadside base unit transmission delay Transmission delay The calculation is as follows:

[0059]

[0060] In the formula, For the task exist Transmission delay in For distance vehicles The nearest roadside unit, ξ, represents the amount of data that the roadside basic unit can transmit per second. Indicates distance from vehicle Recent roadside unit The amount of task data in the waiting queue Indicates task The amount of data after encryption;

[0061] The amount of encrypted data is equal to the amount of original data, that is... Therefore, the task The transmission delay is expressed as:

[0062] ;

[0063] In the formula, For the mission from the vehicle Transmitted to the target roadside base unit Transmission delay, Indicates the task used during transmission. A collection of basic units along the transit roadside;

[0064] S1-8-3, Decryption and computation latency of computation tasks on edge servers ,Delay The calculation is performed using the following formula:

[0065]

[0066] In the formula, This represents the number of CPU clock cycles required to decrypt a unit of bit data using the encryption algorithm ek. Represents roadside basic unit Provided with tasks computing power For the first One vehicle The number of CPU cycles required to compute a unit bit of data at any given time;

[0067] S1-8-4, Calculation Task Uploaded from the vehicle to the target roadside infrastructure unit upload latency Upload latency The calculation is performed using the following formula:

[0068]

[0069] In the formula, Indicates distance from vehicle The nearest roadside foundation unit Task data uplink transmission rate Indicates vehicle With the target roadside basic unit Physical distance between Indicates task Reach the target roadside unit Number of hops required for transfer Indicates task The amount of encrypted data, Indicates vehicle Data uplink transmission rate Represents the distance between adjacent roadside units. This indicates the transmission rate of the wired link. Indicates the coverage radius of the roadside basic unit;

[0070] S1-8-5, Calculate the total delay Total delay The calculation is performed using the following formula:

[0071]

[0072] In the formula, in the formula, Indicates task From vehicles Upload to the target roadside basic unit Total delay, Indicates encryption delay. Indicates upload latency. This indicates the decryption and computation delay;

[0073] Furthermore, the data information calculation steps for the edge computing layer in steps S1-2 above are as follows:

[0074] S1-2-1, Assume the edge computing layer is composed of... It consists of a Roadside Infrastructure Unit (RSU) equipped with an edge server, denoted as ;

[0075] S1-2-2, Let the first A roadside basic unit The attribute set is ;

[0076] in, They represent the first Position information of each roadside basic unit on the X, Y, and Z coordinate axes. Indicates deployment at A roadside basic unit The maximum computing resources of the edge servers in the system.

[0077] Furthermore, the steps for establishing the objective function in step S2 above are as follows:

[0078] S2-1. Establish the objective function as follows:

[0079]

[0080] In the formula, the objective function To minimize the completion delay, data protection failure probability, and penalty value of all vehicles generating tasks at time t, , and These are the average system latency, average protection failure probability, and average penalty value for all tasks;

[0081] S2-2. Establish the objective function The constraints are as follows:

[0082]

[0083] In the formula, This means that the server cannot allocate more resources to all vehicles than it can provide. This means that each vehicle can only select one server for unloading calculations. This means that all vehicles can only choose one encryption algorithm for transmission. The value representing the task priority. This means that the latency of all tasks cannot exceed their maximum tolerable latency. This means that the data protection failure rate during all task transmission processes must not exceed its maximum tolerable probability of safe offloading failure. Represents roadside basic unit Provided with tasks The computing power, where M and N represent the number of task vehicles and the number of roadside basic units, respectively.

[0084] Furthermore, the implementation method in step S3 above includes the following steps:

[0085] S3-1. Computing the state space of an agent's decision-making process in a Markov system. state space The calculation is performed using the following formula:

[0086]

[0087] In the formula, where For vehicle v i Increase the communication channels between all roadside infrastructure units. A collection of edge server resources;

[0088] S3-2, Computing the action space of an agent in a Markov decision-making process Action space The calculation is performed using the following formula:

[0089]

[0090] In the formula, Indicates task The selected roadside foundation unit, Represents the target roadside basic unit Assigned to Computing resources express The encryption algorithm selected during data transmission;

[0091] S3-3 Calculate the actions performed during a Markov decision-making process. Post-reward function reward function The calculation is performed using the following formula:

[0092]

[0093] In the formula, and Let represent the latency and security weight coefficients, respectively, and satisfy the following: ∈[0,1]、 ∈[0,1], + =1; This represents the average latency of all vehicle tasks. This represents the average protection failure probability for all vehicle missions. This represents the average penalty value for all vehicle missions;

[0094] S3-4: Calculate the total loss function.

[0095] Furthermore, the steps for calculating the total loss function in steps S3-4 above are as follows:

[0096] S3-4-1 Calculate the network loss of the new strategy New strategy network loss The calculation is performed using the following formula:

[0097]

[0098] In the formula, The advantage function in the current state. For shearing function, To represent the action chosen under the old and new strategies The probability ratio; take the value network V ϕ1 Value Network V ϕ2 The minimum value is used to evaluate the quality of the action. Represents the shearing function The parameter value is used to control the update magnitude of the strategy;

[0099] S3-4-2: Calculate the shear parameter ε, which is calculated using the following formula:

[0100]

[0101] In the formula, and Shear parameters The maximum and minimum values ​​are... This is the current training round number. This represents the maximum number of training rounds.

[0102] S3-4-3 Calculating Entropy Loss Entropy loss The calculation is performed using the following formula:

[0103]

[0104] In the formula, Indicates the agent's state Select action The strategy distribution;

[0105] S3-4-4 Calculate the total loss function Total loss function The calculation is performed using the following formula:

[0106]

[0107]

[0108]

[0109] In the formula, For the new entropy loss, For the network loss of the new strategy, This is for state s under the old strategy. t Estimate the value of the function. Represents the value network in state s t The valuation, R t It is state s in the experience pool t The actual return Loss due to new value networks; and The weights for the value network loss and entropy loss are used to continuously update the network parameters during training using gradient descent until the algorithm converges.

[0110] A task offloading and resource allocation system that integrates data security in the Internet of Vehicles includes:

[0111] The system model building module in the vehicle-to-everything (V2X) environment is used to collect key system information such as the location, motion status, computing power and communication parameters of edge servers, vehicles and base stations in a three-layer collaborative architecture of central control layer, edge computing layer and user vehicle layer, and build a system model in the V2X environment based on this information. The system model includes a vehicle movement behavior model, a wireless communication channel model, an end-to-end task latency model and a security performance model in the data transmission process.

[0112] The optimization problem modeling module is used to establish an optimization problem model for joint task unloading, resource allocation and data security protection based on the system model, joint optimization objectives (such as task unloading efficiency, resource utilization and data security) and resource and service quality constraints (such as computing resource limits, encryption overhead, task latency and security level requirements).

[0113] The reinforcement learning training module is used to build and train a reinforcement learning model based on the proximal policy optimization (PPO) algorithm. The model includes a policy network and a value network, which are used to output unloading and encryption decisions and evaluate the expected benefits of actions in the current state, respectively. The training process is based on the system model and the optimization objective, and iterates through interactive sampling and policy updates until the model converges, ultimately forming an approximate optimal solver for the optimization problem.

[0114] The joint task offloading and resource allocation module is used to allocate the optimal offloading location (base station selection), corresponding computing resources and data encryption strategies for each task based on the output results of the completed reinforcement learning model, so as to realize the joint execution of task offloading, data protection and resource allocation strategies.

[0115] The system performance evaluation module is used to calculate and quantify key performance indicators of task execution under given system states (such as vehicle state, communication state, and server resources) using a training-converged reinforcement learning model, including the average data protection failure rate and average system task completion latency for all vehicles, and save the optimized model.

[0116] The beneficial effects of this invention are as follows: Compared with the prior art, the task offloading and data protection proposed in this invention are designed based on user vehicle needs. It incorporates random factors such as user vehicle mobility and location, task data size, security level, and task priority. The security and reliability of task offloading are evaluated by quantifying the data protection success rate and task system latency. Finally, a task offloading scheme that balances security and computational efficiency is designed. Attached Figure Description

[0117] Figure 1 This is a schematic diagram of the task offloading and resource allocation method in the Internet of Vehicles that combines data security, as proposed in Example 1;

[0118] Figure 2 This is a schematic diagram of the system model in the vehicle networking environment proposed in Example 1;

[0119] Figure 3 This is a schematic diagram of the training architecture of the network model for the near-end policy optimization algorithm proposed in Example 1. Detailed Implementation

[0120] Example 1: As Figures 1-3 As shown, a method for task offloading and resource allocation in a vehicle-to-everything (V2X) network that combines data security includes the following steps:

[0121] S1. Obtain relevant data on the location, mobility, computing power, and communication parameters of edge servers, vehicles, and base stations in the three-layer architecture consisting of the central control layer, edge computing layer, and user vehicle layer. Based on this relevant data, construct a system model in the vehicle-to-everything (V2X) environment. The system model includes: a vehicle mobility behavior model, a wireless communication channel model between the vehicle and the base station, an end-to-end latency model involving the encryption and transmission of coverage tasks to local or edge execution, and a security performance model characterizing the potential leakage risks and protection mechanisms faced by data during transmission. The specific steps are as follows:

[0122] S1-1. Set the data information for the user vehicle layer. The specific steps are as follows:

[0123] S1-1-1, Assume the user vehicle layer includes A vehicle traveling in the lane is denoted as ,in, For the first vehicle, denoted as [task name missing]. In the model, a given time period T is divided into equal time slots, denoted as... ;

[0124] S1-1-2, Setting up vehicles exist The information at the start time is represented as ;

[0125] in, Representing vehicles Location information, For the first One vehicle The speed of time For the first One vehicle Lane index at any time, For the first One vehicle The ability to calculate time. For the first One vehicle Real-time data upload power;

[0126] S1-1-3, Setting the Task In time The information is ;

[0127] in, For the first One vehicle The data size of the task at any given time. For the first One vehicle The number of CPU cycles required to compute a unit bit of data at any given time. For the first One vehicle Minimum security level coefficient for the task at any given time. For the first One vehicle Maximum security level coefficient for the task at any given time. For the first One vehicle Task priority at any given moment For the first One vehicle The maximum tolerable delay at any given moment. For the first One vehicle The maximum tolerable probability of safe uninstallation failure at any given time;

[0128] S1-2. Configure the data information for the edge computing layer. The specific configuration steps are as follows:

[0129] S1-2-1, Assume the edge computing layer is composed of... It consists of a Roadside Infrastructure Unit (RSU) equipped with an edge server, denoted as ;

[0130] S1-2-2, Let the first A roadside basic unit The attribute set is ;

[0131] in They represent the first Location information of each roadside basic unit Indicates deployment at A roadside basic unit The maximum computing resources of edge servers in the system;

[0132] S1-3. In this embodiment, a one-way multi-lane straight highway model is used to describe the vehicles in the system. The road length is represented by L, the number of lanes is LN, the width of each lane is LW, and the roadside basic units are equidistantly distributed on one side of the road. The initial spatial position of the vehicles on the road follows a density of... The vehicle has a uniform Poisson distribution; the initial lane is selected randomly, and the vehicle speed... Randomly select within the range of (5 m / s, 20 m / s); calculate the vehicle speed. At the next moment The position is calculated using the following formula:

[0133]

[0134]

[0135] In the formula, Indicates vehicle At the next moment X-axis coordinates Indicates vehicle At the present moment X-axis coordinates For vehicles At the present moment The speed is given by T, the continuous travel time of the vehicle, and the number of time slots by S. This indicates the duration of each time interval; Indicates vehicle At the next moment Y-axis coordinate, For the first One vehicle Lane index at any time, Indicates the width of the lane;

[0136] S1-4, Calculate vehicles and the A roadside basic unit Large-scale path loss and large-scale fading components between nodes; large-scale path loss and large-scale fading components are calculated using the following formula:

[0137] ;

[0138] ;

[0139] In the formula, This represents large-scale path loss. Indicates vehicle and exist Physical distance at any given moment Represents the large-scale fading component. Indicates the shadow effect. This indicates random fading of the signal;

[0140] S1-5, Calculate small-scale path fading It is calculated using the following formula:

[0141]

[0142] In the formula, This represents the smoothing factor, which is set to 0.25 in this embodiment. This represents the path loss index. Indicates vehicle and exist Physical distance at time t. This indicates the small-scale path fading at the previous moment;

[0143] S1-6, Calculate vehicles and Channel gain between It is calculated using the following formula:

[0144]

[0145] In the formula, This indicates small-scale path fading. Represents large-scale fading components;

[0146] S1-7, Calculate the vehicle Task data uplink transmission rate It is calculated using the following formula:

[0147]

[0148] In the formula, Indicates data transmission to the vehicle power, This represents the power of Gaussian white noise. This represents the orthogonal bandwidth between all vehicles and the edge server. Indicates vehicle and Channel gain between;

[0149] S1-8. Calculate the task unloading delay. The specific calculation steps are as follows:

[0150] S1-8-1, Encryption delay of computational tasks in vehicles It is calculated using the following formula:

[0151]

[0152] In the formula, For the first One vehicle The data size of the task at any given time. This represents the number of CPU clock cycles required to perform encrypted unit bit data calculation using the encryption algorithm ek. The computing power of the vehicle used for encryption operations;

[0153] S1-8-2, Calculation task from vehicle Transmitted to the target roadside base unit transmission delay It is calculated using the following formula:

[0154]

[0155] In the formula, For the task exist In the context of transmission delay, ξ represents the amount of data that a roadside infrastructure unit can transmit per second. Indicates distance from vehicle Recent roadside unit The amount of task data in the waiting queue Indicates task The amount of data after encryption;

[0156] The amount of encrypted data is approximately equal to the amount of original data, that is... Therefore, the task The transmission delay is expressed as:

[0157] ;

[0158] In the formula, For the mission from the vehicle Transmitted to the target roadside base unit Transmission delay, Indicates the task used during transmission. A collection of basic units along the transit roadside;

[0159] S1-8-3, Decryption and computation latency of computation tasks on edge servers It is calculated using the following formula:

[0160]

[0161] In the formula, This represents the number of CPU clock cycles required to decrypt a unit of bit data using the encryption algorithm ek. This indicates the computing power of the local vehicle used for encryption operations. Represents roadside basic unit Provided with tasks computing power For the first One vehicle The number of CPU cycles required to compute a unit bit of data at any given time;

[0162] vehicle With the target roadside basic unit The distance between them is used The coverage area of ​​the roadside basic unit is represented by a radius C. Greater than radius C, task It will first be unloaded to the nearest roadside infrastructure unit. Then, through wired transmission between each roadside infrastructure unit, it is finally forwarded to the target roadside infrastructure unit. Tasks are transmitted in parallel between base stations. When tasks are forwarded between roadside units, the queuing delay of tasks in the relay roadside unit needs to be considered. The amount of task data in the waiting queue is denoted as . ;

[0163] S1-8-4, Calculation Task Uploaded from the vehicle to the target roadside infrastructure unit upload latency It is calculated using the following formula:

[0164]

[0165] In the formula, Indicates distance from vehicle The nearest roadside unit Task data uplink transmission rate Indicates vehicle With the target roadside basic unit The physical distance between them Indicates task Reach the target roadside unit Number of hops required for transfer Indicates task The amount of encrypted data, Indicates vehicle Data uplink transmission rate Represents the distance between adjacent roadside units. Indicates the transmission rate of a wired link;

[0166] S1-8-5, Calculate the total delay It is calculated using the following formula:

[0167]

[0168] In the formula, Indicates task From vehicles Upload to the target roadside basic unit Total delay; Indicates upload latency. This indicates the decryption and computation delay. Indicates transmission delay;

[0169] S1-9 Calculate the probability of task failure It is calculated using the following formula:

[0170]

[0171] In the formula, This indicates the encryption level of the encryption algorithm ek. For the first One vehicle Minimum security level coefficient for the task at any given time. For the first One vehicle Maximum security level coefficient for the task at any given time.

[0172] S1-10. Calculate the average latency of all vehicle tasks. It is calculated using the following formula:

[0173]

[0174] In the formula, Let it be a binary variable, representing the task. Was it unloaded to the roadside base unit? Its value is 1 or 0. = 1 indicates a task Uninstalled to , = 0 indicates a task It was unloaded to another node. Indicates task From vehicles Upload to the target roadside basic unit Total delay, For the first One vehicle Maximum tolerable delay at any given moment; This indicates the number of vehicles traveling in the lane. Indicates the number of roadside basic units;

[0175] S1-11. Calculate the average protection failure probability for all vehicle tasks. It is calculated using the following formula:

[0176]

[0177] In the formula, Let it be a binary variable, representing the task. Whether to use the EK encryption algorithm for encryption. = 1 indicates a task Using the EK encryption algorithm, = 0 indicates that no encryption algorithm ek was used; For the first One vehicle The maximum tolerable probability of safe offloading failure for tasks generated at any given time;

[0178] S1-12. Calculate the average penalty value for all vehicle tasks. It is calculated using the following formula:

[0179]

[0180] In the formula, For the task The penalty for completing the task late is calculated using the following formula:

[0181]

[0182] In the formula, For the first One vehicle Task priority at any given moment Indicates task From vehicles Upload to the target roadside basic unit Total delay, For the first One vehicle Maximum tolerable delay at any given moment;

[0183] S2. Based on the system model in S1, and combining the joint optimization objectives of task offloading, resource allocation, and data protection, and introducing system resource constraints (such as computing resources, encryption overhead, etc.) and service quality constraints (such as task completion latency and security requirements), an optimization problem model for joint task offloading, data security, and resource allocation is established. The specific steps are as follows:

[0184] S2-1. Establish the objective function as follows: :

[0185]

[0186] In the formula, the objective function To minimize the completion delay of tasks generated by all vehicles at time t, the probability of data protection failure, and the penalty value;

[0187] S2-2. Establish the following constraints:

[0188]

[0189] In the formula, This means that the resources the server allocates to all vehicles cannot exceed the maximum resources it can provide. This means that each vehicle can only select one server for unloading calculations. This means that all vehicles can only choose one encryption algorithm for transmission. The value representing the task priority. This means that the latency of all tasks cannot exceed their maximum tolerable latency. This means that the data protection failure rate during all task transmission processes must not exceed its maximum tolerable probability of safe offloading failure. Represents roadside basic unit Provided with tasks Computational power;

[0190] S3. Based on the optimization problem model, a reinforcement learning framework based on the proximal policy optimization method is introduced. A reinforcement learning model including a policy network and a value network is designed and trained. During the training process, the policy network is used to output specific unloading and encryption actions, and the value network is used to evaluate the expected benefits of actions in the current state, until the reinforcement learning model converges.

[0191] Combination Figure 3 As shown, this embodiment provides a method for task offloading and resource allocation that combines data security in vehicle networking. The network architecture consists of four neural networks, namely the new policy network π. θnew Old policy network π θold Value Network V ϕ1 Value Network V ϕ2 The agent interacts with the current environment state `st` using the new policy network to obtain the action `at`, then enters the next state `st+1` and receives the reward `rt`. After each interaction, samples of <st, at, rt, st+1> are continuously stored in the experience buffer. When training reaches a certain number of iterations, the parameters of the current policy network are copied to the parameters of the old policy network. The quality of the action `at` is evaluated using a value network. When training reaches a certain number of rounds, the algorithm converges, quantifies the task offloading and resource allocation, the average data protection failure rate of all vehicles, and the average system latency, and saves the model. The specific steps are as follows:

[0192] S3-1. Computing the state space of an agent's decision-making process in a Markov system. It is calculated using the following formula:

[0193]

[0194] In the formula, where For vehicle v i Increase the communication channels between all roadside units. A collection of edge server resources;

[0195] S3-2, Computing the action space of an agent in a Markov decision-making process It is calculated using the following formula:

[0196]

[0197] In the formula, Indicates task The selected roadside foundation unit, The target roadside basic unit rsj is assigned to Computing resources express The encryption algorithm selected during data transmission;

[0198] S3-3 Calculate the actions performed during a Markov decision-making process. Post-reward function It is calculated using the following formula:

[0199]

[0200] In the formula, and Let represent the latency and security weight coefficients, respectively, and satisfy the following: ∈[0,1]、 ∈[0,1], + =1; This represents the average latency of all vehicle tasks. This represents the average protection failure probability for all vehicle missions. This represents the average penalty value for all vehicle missions;

[0201] S3-4. Calculate the total loss function. The specific calculation steps are as follows:

[0202] S3-4-1 Calculate the network loss of the new strategy It is calculated using the following formula:

[0203]

[0204] In the formula, The advantage function in the current state. For shearing function, To represent the action chosen under the old and new strategies The probability ratio; take the value network V ϕ1 Value Network V ϕ2 The minimum value is used to evaluate the quality of the action;

[0205] S3-4-2. Calculate the shear parameter ε, which is calculated using the following formula:

[0206]

[0207] In the formula, and yes The maximum and minimum values ​​are... This is the current training round number. This represents the maximum number of training rounds.

[0208] S3-4-3 Calculating Entropy Loss It is calculated using the following formula:

[0209]

[0210] In the formula, Indicates the agent's state Select action The strategy distribution;

[0211] S3-4-4 Calculate the total loss function It is calculated using the following formula:

[0212]

[0213] In the formula, For the new entropy loss, For the network loss of the new strategy, Loss due to new value networks; and The weights for the value network loss and entropy loss are used to continuously update the network parameters during training using the gradient descent method until the algorithm converges.

[0214] S4. Using the reinforcement learning model (i.e. the solution model for the optimization problem) trained and converged in S3, input the system parameters of the current vehicle status, edge server status, and communication status, and output the optimal unloading location (base station selection), allocated edge computing resources, and encryption protection strategy for each task.

[0215] S5. Based on the output results in S4, calculate and quantify global indicators, including the average data protection failure rate and average system latency of all vehicles, and save the model.

[0216] Example 2: A task offloading and resource allocation system combining data security in the Internet of Vehicles, characterized in that it includes:

[0217] The system model building module in the vehicle-to-everything (V2X) environment is used to collect key system information such as the location, motion status, computing power and communication parameters of edge servers, vehicles and base stations in a three-layer collaborative architecture of central control layer, edge computing layer and user vehicle layer, and build a system model in the V2X environment based on this information. The system model includes a vehicle movement behavior model, a wireless communication channel model, an end-to-end task latency model and a security performance model in the data transmission process.

[0218] The optimization problem modeling module is used to establish an optimization problem model for joint task unloading, resource allocation and data security protection based on the system model, joint optimization objectives (such as task unloading efficiency, resource utilization and data security) and resource and service quality constraints (such as computing resource limits, encryption overhead, task latency and security level requirements).

[0219] The reinforcement learning training module is used to build and train a reinforcement learning model based on the proximal policy optimization (PPO) algorithm. The model includes a policy network and a value network, which are used to output unloading and encryption decisions and evaluate the expected benefits of actions in the current state, respectively. The training process is based on the system model and the optimization objective, and iterates through interactive sampling and policy updates until the model converges, ultimately forming an approximate optimal solver for the optimization problem.

[0220] The joint task offloading and resource allocation module is used to allocate the optimal offloading location (base station selection), corresponding computing resources and data encryption strategies for each task based on the output results of the completed reinforcement learning model, so as to realize the joint execution of task offloading, data protection and resource allocation strategies.

[0221] The system performance evaluation module is used to calculate and quantify key performance indicators of task execution under given system states (such as vehicle state, communication state, and server resources) using a training-converged reinforcement learning model, including the average data protection failure rate and average system task completion latency for all vehicles, and save the optimized model.

Claims

1. A method for task offloading and resource allocation in the Internet of Vehicles (IoV) that combines data security, characterized in that: The method includes the following steps: S1. Obtain relevant data on the location, mobility, computing power, and communication parameters of edge servers, vehicles, and base stations in the three-layer architecture consisting of the central control layer, edge computing layer, and user vehicle layer. Based on this relevant data, construct a system model in the vehicle network environment. The system model includes: a vehicle mobility behavior model, a wireless communication channel model between the vehicle and the base station, an end-to-end latency model involved in the coverage task from encryption and transmission to local or edge execution, and a security performance model characterizing the potential leakage risks and protection mechanisms faced by data during transmission. S2. Based on the system model in S1, and combining the joint optimization objectives of task offloading, resource allocation, and data protection, and introducing system resource constraints and service quality constraints, an optimization problem model for joint task offloading, data security, and resource allocation is established. The steps for establishing the objective function are as follows: S2-1. Establish the objective function as follows: , In the formula, the objective function To minimize the average latency of all vehicles generating tasks at time t, the probability of data protection failure, and the penalty value, , and These are the average system latency, average protection failure probability, and average penalty value for all tasks; Average protection failure probability The calculation is performed using the following formula: , In the formula, Let it be a binary variable, representing the task. Whether to use the EK encryption algorithm for encryption. = 1 indicates a task Using the EK encryption algorithm, = 0 indicates that no encryption algorithm ek was used; For the first One vehicle The maximum tolerable probability of secure offloading failure for the task generated at any given time, where D is the set of optional encryption algorithms. For the task The probability of secure uninstallation failure using the EK encryption algorithm; S2-2. Establish the objective function The constraints are as follows: , In the formula, This means that the server cannot allocate more resources to all vehicles than it can provide. This means that each vehicle can only select one server for unloading calculations. This means that all vehicles can only choose one encryption algorithm for transmission. The value representing the task priority. This means that the latency of all tasks cannot exceed their maximum tolerable latency. This means that the data protection failure rate during all task transmission processes must not exceed its maximum tolerable probability of safe offloading failure. Represents roadside basic unit Provided with tasks The computing power, where M and N represent the number of task vehicles and the number of roadside basic units, respectively; S3. Based on the optimization problem model in S2, a reinforcement learning framework based on the proximal policy optimization method is introduced. A reinforcement learning model including a policy network and a value network is designed and trained. During the training process, the policy network is used to output specific unloading and encryption actions, and the value network is used to evaluate the expected benefits of actions in the current state, until the reinforcement learning model converges. S4. Using the reinforcement learning model trained and converged in S3, input the system parameters of the current vehicle status, edge server status, and communication status, and output the optimal unloading location, allocated edge computing resources, and encryption protection strategy for each task. Based on the output results of S4, S5 calculates and quantifies global metrics, including the average data protection failure rate and average system latency for all vehicles, and saves the model.

2. The method for task offloading and resource allocation in the Internet of Vehicles (IoV) combining data security as described in claim 1, characterized in that, The implementation method in step S1 includes the following specific steps: S1-1. Set the data information for the user vehicle layer; S1-2, Set the data information for the edge computing layer; S1-3, the road length is represented by L, the number of lanes is LN, the width of each lane is LW, and the roadside basic units are evenly distributed on one side of the road; the initial lanes are selected randomly, and the vehicle speed... Randomly selected within the range of (5 m / s, 20 m / s); Calculate vehicles At the next moment The location of the vehicle Position is determined by the following formula: , , In the formula, Indicates vehicle At the next moment X-axis coordinates Indicates vehicle At the present moment X-axis coordinates For vehicles At the present moment speed, The time interval represents the duration of each time slot, where T represents the continuous driving time of the vehicle, and S represents the number of time slots. Indicates vehicle At the next moment Y-axis coordinate, For the first One vehicle Lane index at any time, Indicates the width of the lane; S1-4, Calculate vehicles and the A roadside basic unit The large-scale path loss and large-scale fading components between nodes are calculated using the following formulas: , , In the formula, This represents large-scale path loss. Indicates vehicle and roadside basic units exist Physical distance at any given moment Represents the large-scale fading component. Indicates the shadow effect. This indicates random fading of the signal; S1-5, Calculate small-scale path fading Small-scale path fading Calculated using the following formula: , In the formula, Represents the smoothing factor. This represents the path loss index. Indicates vehicle and roadside basic units In the previous moment Physical distance at any given moment This indicates the small-scale path fading at the previous moment; S1-6, Calculate vehicles and roadside basic units Channel gain between Channel gain The calculation is performed using the following formula: , In the formula, This indicates small-scale path fading. Represents large-scale fading components; S1-7, Calculate the vehicle Task data uplink transmission rate Task data uplink transmission rate The calculation is performed using the following formula: , In the formula, Indicates data transmission to the vehicle power, This represents the power of Gaussian white noise. This represents the orthogonal bandwidth between all vehicles and the edge server. Indicates vehicle and roadside basic units Channel gain between; S1-8 Calculate the system latency of task unloading. The unloading latency is calculated based on the upload rate and task size, priority, and security requirements in S1-7. The unloading latency includes local encryption latency, transmission latency, and decryption and calculation latency on the server. S1-9 Calculate the probability of task failure Task failure probability The calculation is performed using the following formula: , In the formula, This indicates the encryption level of the encryption algorithm ek. For the first One vehicle Minimum security level coefficient for the task at any given time. For the first One vehicle Maximum security level coefficient for the task at any given time. Indicates the safety factor of the task; S1-10. Calculate the average latency of all vehicle tasks. Average delay The calculation is performed using the following formula: , In the formula, Let it be a binary variable, representing the task. Was it unloaded to the roadside base unit? ; The value is 1 or 0. = 1 indicates a task Unloaded to roadside base unit , = 0 indicates a task It was unloaded to another node. For vehicles exist The task at all times Indicates task From vehicles Upload to the target roadside basic unit Total delay, For the first One vehicle Maximum tolerable delay at any given moment; This indicates the number of vehicles traveling in the lane. Indicates the number of roadside basic units; S1-11. Calculate the average protection failure probability for all vehicle tasks. ; S1-12. Calculate the average penalty value for all vehicle tasks. Average penalty value The calculation is performed using the following formula: , In the formula, For the task Penalty value for completing within the time limit, penalty value The calculation is performed using the following formula: , In the formula, For the first One vehicle Task priority at any given moment Indicates task From vehicles Upload to roadside basic unit Total delay, For the first One vehicle Maximum tolerable delay at any given moment.

3. The method for task offloading and resource allocation in the Internet of Vehicles (IoV) combining data security according to claim 2, characterized in that, The method for setting the user vehicle layer data information in step S1-1 includes the following steps: S1-1-1, Assume the user vehicle layer includes A vehicle traveling in the lane is denoted as ,in, For the first vehicle, denoted as [task name missing]. In the model, a given time period T is divided into equal time slots, denoted as... ; S1-1-2, Setting up vehicles exist The information at the start time is represented as ; in, Representing vehicles Location information, For the first One vehicle The speed of time For the first One vehicle Lane index at any time, For the first One vehicle The ability to calculate time. For the first One vehicle Real-time data upload power; S1-1-3, Setting the Task In time The information is ; in, For the first One vehicle The data size of the task at any given time. For the first One vehicle The number of CPU cycles required to compute a unit bit of data at any given time. For the first One vehicle Minimum security level coefficient for the task at any given time. For the first One vehicle Maximum security level coefficient for the task at any given time. For the first One vehicle Task priority at any given moment For the first One vehicle The maximum tolerable delay at any given moment. For the first One vehicle The maximum tolerable probability of safe uninstallation failure at any given time.

4. The method for task offloading and resource allocation in the Internet of Vehicles (IoV) combining data security according to claim 3, characterized in that, The steps for calculating the task unloading delay in steps S1-8 are as follows: S1-8-1, Encryption delay of computational tasks in vehicles Encryption delay The calculation is performed using the following formula: , In the formula, For the first One vehicle The data size of the task at any given time. This represents the number of CPU clock cycles required to perform encrypted unit bit data calculation using the encryption algorithm ek. The computing power of the vehicle used for encryption operations; S1-8-2, Calculation task from vehicle Transmitted to the target roadside base unit transmission delay Transmission delay The calculation is as follows: , In the formula, For the task exist Transmission delay in For distance from vehicle The nearest roadside unit, ξ, represents the amount of data that the roadside basic unit can transmit per second. Indicates distance from vehicle Recent roadside unit The amount of task data in the waiting queue Indicates task The amount of data after encryption; The amount of encrypted data is equal to the amount of original data, that is... Therefore, the task The transmission delay is expressed as: ; In the formula, For the mission from the vehicle Transmitted to roadside base unit Transmission delay, Indicates the task used during transmission. A collection of basic units along the transit roadside; S1-8-3, Decryption and computation latency of computation tasks on edge servers ,Delay The calculation is performed using the following formula: , In the formula, This represents the number of CPU clock cycles required to decrypt a unit of bit data using the encryption algorithm ek. Represents roadside basic unit Provided with tasks computing power For the first One vehicle The number of CPU cycles required to compute a unit bit of data at any given time; S1-8-4, Calculation Task Uploaded from the vehicle to the target roadside infrastructure unit upload latency Upload latency The calculation is performed using the following formula: , In the formula, Indicates distance from vehicle The nearest roadside foundation unit Task data uplink transmission rate Indicates vehicle With the target roadside basic unit Physical distance between Indicates task Reach the target roadside unit Number of hops required for transfer Indicates task The amount of encrypted data, Indicates vehicle Data uplink transmission rate Represents the distance between adjacent roadside units. This indicates the transmission rate of the wired link. Indicates the coverage radius of the roadside basic unit; S1-8-5, Calculate the total delay Total delay The calculation is performed using the following formula: , In the formula, Indicates task From vehicles Upload to the target roadside basic unit Total delay, Indicates encryption delay. Indicates upload latency. This indicates the decryption and computation delay.

5. The method for task offloading and resource allocation in the Internet of Vehicles (IoV) combining data security according to claim 3, characterized in that, The data information calculation steps for the edge computing layer in step S1-2 are as follows: S1-2-1, Assume the edge computing layer is composed of... It consists of a roadside infrastructure unit equipped with an edge server, denoted as ; S1-2-2, Let the first A roadside basic unit The attribute set is ; in, They represent the first Position information of each roadside basic unit on the X, Y, and Z coordinate axes. Indicates deployment at A roadside basic unit The maximum computing resources of the edge servers in the system.

6. The method for task offloading and resource allocation in the Internet of Vehicles (IoV) combining data security according to claim 1, characterized in that, The implementation method in step S3 includes the following steps: S3-1. Computing the state space of an agent's decision-making process in a Markov system. state space The calculation is performed using the following formula: , In the formula, where For vehicle v i Increase the communication channels between all roadside infrastructure units. A collection of edge server resources; S3-2, Computing the action space of an agent in a Markov decision-making process Action space The calculation is performed using the following formula: , In the formula, Indicates task The selected roadside foundation unit, Represents the target roadside basic unit Assigned to Computing resources express The encryption algorithm selected during data transmission; S3-3 Calculate the actions performed during a Markov decision-making process. Post-reward function reward function The calculation is performed using the following formula: , In the formula, and Let represent the latency and security weight coefficients, respectively, and satisfy the following: ∈[0,1]、 ∈[0,1], + =1; This represents the average latency of all vehicle tasks. This represents the average protection failure probability for all vehicle missions. This represents the average penalty value for all vehicle missions; S3-4: Calculate the total loss function.

7. The method for task offloading and resource allocation in the Internet of Vehicles (IoV) combining data security according to claim 6, characterized in that: The steps for calculating the total loss function in step S3-4 are as follows: S3-4-1 Calculate the network loss of the new strategy New strategy network loss The calculation is performed using the following formula: , In the formula, The advantage function in the current state. For shearing function, To represent the action chosen under the old and new strategies The probability ratio; take the value network V ϕ1 Value Network V ϕ2 The minimum value is used to evaluate the quality of the action. Represents the shearing function The parameter value is used to control the update magnitude of the strategy; S3-4-2: Calculate the shear parameter ε, which is calculated using the following formula: , In the formula, and Shear parameters The maximum and minimum values ​​are... This is the current training round number. This represents the maximum number of training rounds. S3-4-3 Calculating Entropy Loss Entropy loss The calculation is performed using the following formula: , In the formula, Indicates the agent's state Select action The strategy distribution; S3-4-4 Calculate the total loss function Total loss function The calculation is performed using the following formula: , , , In the formula, For the new entropy loss, For the network loss of the new strategy, This is for state s under the old strategy. t Estimate the value of the function. Represents the value network in state s t The valuation, R t It is state s in the experience pool t The actual return Loss due to new value networks; and The weights for the value network loss and entropy loss are used to continuously update the network parameters during training using gradient descent until the algorithm converges.

8. A task offloading and resource allocation system that integrates data security in the Internet of Vehicles, characterized in that, include: The system model building module in the vehicle-to-everything (V2X) environment is used to collect key system information such as the location, motion status, computing power and communication parameters of edge servers, vehicles and base stations in a three-layer collaborative architecture of central control layer, edge computing layer and user vehicle layer, and build a system model in the V2X environment based on this information. The system model includes a vehicle movement behavior model, a wireless communication channel model, an end-to-end task latency model and a security performance model in the data transmission process. The optimization problem modeling module is used to establish optimization problem models for joint task offloading, resource allocation, and data security protection based on the system model, joint optimization objectives, and resource and service quality constraints. The steps for establishing the objective function are as follows: S2-1. Establish the objective function as follows: , In the formula, the objective function To minimize the average latency of all vehicles generating tasks at time t, the probability of data protection failure, and the penalty value, , and These are the average system latency, average protection failure probability, and average penalty value for all tasks; Average protection failure probability The calculation is performed using the following formula: , In the formula, Let it be a binary variable, representing the task. Whether to use the EK encryption algorithm for encryption. = 1 indicates a task Using the EK encryption algorithm, = 0 indicates that no encryption algorithm ek was used; For the first One vehicle The maximum tolerable probability of secure offloading failure for the task generated at any given time, where D is the set of optional encryption algorithms. For the task The probability of secure uninstallation failure using the EK encryption algorithm; S2-2. Establish the objective function The constraints are as follows: , In the formula, This means that the server cannot allocate more resources to all vehicles than it can provide. This means that each vehicle can only select one server for unloading calculations. This means that all vehicles can only choose one encryption algorithm for transmission. The value representing the task priority. This means that the latency of all tasks cannot exceed their maximum tolerable latency. This means that the data protection failure rate during all task transmission processes must not exceed its maximum tolerable probability of safe offloading failure. Represents roadside basic unit Provided with tasks The computing power, where M and N represent the number of task vehicles and the number of roadside basic units, respectively; The reinforcement learning training module is used to build and train a reinforcement learning model based on the proximal policy optimization algorithm. The model includes a policy network and a value network, which are used to output unloading and encryption decisions and evaluate the expected benefits of actions in the current state, respectively. The training process is based on the system model and the optimization objective, and iterates through interactive sampling and policy updates until the model converges, ultimately forming an approximate optimal solver for the optimization problem. The joint task offloading and resource allocation module is used to allocate the optimal offloading position, corresponding computing resources and data encryption strategy to each task based on the output results of the completed reinforcement learning model, so as to realize the joint execution of task offloading, data protection and resource allocation strategies. The system performance evaluation module is used to calculate and quantify key performance indicators of task execution under a given system state using a training-converged reinforcement learning model, including the average data protection failure rate and average system task completion latency for all vehicles, and save the optimized model.