Heuristic algorithm-based Internet of Vehicles federal learning cooperative allocation method
By using heuristic algorithms to divide vehicle functions and generate transceiver paths in the Internet of Vehicles, the problem of inefficient federated learning is solved, and efficient federated learning is achieved under dynamic topology.
Patent Information
- Application Number
- CN202510289618.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-06-13
AI Technical Summary
In the prior art, the inability to effectively plan the functions and resources of vehicles within a limited time has resulted in inefficient federal learning.
The Internet of Vehicles federated learning collaborative allocation method is adopted based on heuristic algorithms, and the vehicle functions are divided through heuristic functions, an adjacency matrix is generated, and the model's sending and receiving path is generated using the Dijkstra algorithm, and finally federated learning is carried out according to the specified strategy.
This method can adapt to the dynamically changing topological structure in the Internet of Vehicles, improve the training efficiency of federated learning, reduce overall time-consuming, and improve operational efficiency.
Smart Images

Figure CN120151364A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent vehicle networking, and particularly to a vehicle networking federated learning collaborative allocation method based on a heuristic algorithm. Background Art
[0002] With the rapid development of intelligent vehicle networking technology, electric vehicles have become more intelligent and are capable of collecting and processing a large amount of data locally. Intelligent vehicle networking integrates technologies such as artificial intelligence, the Internet of Things, edge computing, and automation, significantly enhancing the intelligent functions of vehicle systems. On the basis of traditional vehicle networking, intelligent vehicle networking introduces key technologies such as machine learning and time series prediction, enabling vehicles to have the capabilities of self-perception, prediction, and intelligent decision-making.
[0003] The Internet of Things is the basic framework of intelligent vehicle networking. Through sensors, wireless communication networks, and edge computing technologies, it realizes real-time information exchange and collaborative work among devices. In a vehicle networking system, vehicles, road infrastructure, traffic lights, and pedestrian devices, etc., can all be components of the Internet of Things network. These devices are connected through wireless networks, such as vehicle-to-vehicle (V2V) communication, to transmit data in real time and support intelligent collaboration. With the help of the Internet of Things, various devices in vehicle networking can share information, thereby achieving global optimization.
[0004] Artificial intelligence provides powerful data processing and decision-making support capabilities for intelligent vehicle networking. Especially the breakthroughs in the fields of machine learning and deep learning have laid a technical foundation for realizing autonomous driving, intelligent navigation, and intelligent decision-making. By performing real-time analysis on the large-scale heterogeneous data generated by vehicles, artificial intelligence can optimize driving behaviors, predict road traffic conditions, and even analyze drivers' behavior habits and preferences, providing personalized driving services for users.
[0005] However, with the growth of data volume, user privacy protection has gradually become an important challenge in the field of intelligent vehicle networking. A large amount of data collected locally by vehicles, such as geographical locations, driving behaviors, and driving videos, often contains sensitive information. How to make full use of this data while protecting user privacy has become a key research direction in recent years.
[0006] Federated learning is a distributed machine learning framework that allows each node (such as a vehicle or an edge device) to train a machine learning model locally without uploading local data to a central server. This method can achieve collaborative training in vehicle networking scenarios while protecting user privacy. Through federated learning, each vehicle in vehicle networking can share knowledge without directly exchanging raw data, thereby effectively reducing the risk of privacy leakage.
[0007] Edge computing effectively reduces system latency, improves computing speed, and ensures the real-time and accuracy of vehicle decisions by delegating computing tasks to vehicles or road edge nodes. In the intelligent Internet of Vehicles environment, the combination of federated learning and edge computing can make full use of local computing resources and network distribution characteristics to solve the limitations of centralized training in computing, storage, and privacy protection.
[0008] Federated learning involves the training and transmission of model parameters, and the entire process consumes a lot of time. During this process, the communication topology between vehicles may change significantly, which will have a significant impact on the stability and effectiveness of federated learning. In addition, each vehicle has different computing power, communication capabilities, and the number of samples. These factors will significantly affect the efficiency of federated learning and the performance of the model. Therefore, how to effectively plan the functions and resources of vehicles within a limited time has become a key issue in improving the efficiency of federated learning. Summary of the invention
[0009] The purpose of the present invention is to overcome the above-mentioned problems of the prior art and provide a vehicle network federated learning collaborative allocation method based on a heuristic algorithm to solve the technical problem of low efficiency of federated learning caused by the inability to effectively plan the functions and resources of vehicles within a limited time in the prior art.
[0010] The above objectives are achieved through the following technical solutions:
[0011] A cooperative allocation method for federated learning in Internet of Vehicles based on a heuristic algorithm, comprising:
[0012] Step (1) divide the functions of the vehicle using a heuristic function according to the vehicle attributes and the vehicle-to-vehicle distance, and obtain discarded nodes, aggregation nodes, training nodes, and transfer nodes;
[0013] Step (2) generates an adjacency matrix according to the abandoned node, the aggregation node, the training node and the transfer node in step (1), and uses the Dijkstra algorithm to generate a sending and receiving path of the federated learning model from the aggregation node to the training node and the transfer node;
[0014] Step (3) carries out federated learning according to the specified strategy, including model distribution, local training, model recycling, and model aggregation.
[0015] Furthermore, the step (1) of dividing the functions of the vehicles using a heuristic function according to the vehicle attributes and the vehicle-to-vehicle distance includes:
[0016] Step (101) uses the heuristic function H off (m) determining whether the vehicle can participate in federated learning, and if not, determining the vehicle as the abandoned node;
[0017] Step (102) uses the heuristic function H agg (m) Select a suitable vehicle as the aggregation node;
[0018] Step (103) uses the heuristic function H train (m) Divide the nodes participating in federated learning into the training nodes and the transit nodes.
[0019] Further, the step (101) is specifically: comprehensively considering factors such as workshop distance, computing power, and sample quantity, construct the heuristic function H off (m), as follows:
[0020] H off (m) = ω 11 d m,min +ω 12 d m,mean +ω 13 d m,c -ω 14 S m -ω 15 C m
[0021] In the formula, d m,min represents the distance from vehicle m to the nearest vehicle; d m,mean is the average distance from vehicle m to the remaining vehicles; d m,c represents the distance from vehicle m to the central position; S m is the sample quantity of the m-th vehicle; C m is the computing power of the m-th vehicle; ω 1· represents the weighting coefficient of the heuristic function H off (m), satisfying ω 1· > 0 and ∑ω 1· = 1;
[0022] Meanwhile, set a determination threshold γ off , for determining the vehicle; when the condition H off (m)> γ off is satisfied, then vehicle m is determined as a discarded node.
[0023] Further, the step (102) is specifically: comprehensively considering the workshop distance and the number of broadcast channels, construct the heuristic function H agg (m), as follows:
[0024] H agg (m) = -ω 21 d m,mean -ω 22 d m,c +ω 23 Z m
[0025] In the formula, Z m is the number of broadcast channels of the m-th vehicle; ω 2· represents the weighting coefficient of the heuristic function H agg (m), satisfying ω 2· > 0 and ∑ω 2· = 1; through this heuristic function H agg (m), the aggregation node m agg is selected, as shown in the following formula:
[0026]
[0027] In the formula, M represents the total number of vehicles participating in federated learning, that is, the vehicle with the largest value of the heuristic function H agg (m) is selected as the aggregation node.
[0028] Furthermore, the step (103) is specifically: comprehensively considering the computing power and sample quantity of the vehicle, constructing the heuristic function H train (m), as shown in the following formula:
[0029] H train (m) = ω 31 C m + ω 32 S m
[0030] In the formula, ω 3· represents the weighting coefficient of the heuristic function H agg (m), satisfying ω 3· > 0 and ∑ω 3· = 1;
[0031] At the same time, a classification threshold γ train is set. If the vehicle satisfies the condition H train (m)> γ train , then the vehicle m is classified as a training node; otherwise, it is classified as a transfer node.
[0032] Furthermore, in step (2), generating the adjacency matrix according to the discarded nodes, the aggregation nodes, the training nodes and the transfer nodes described in step (1) is specifically: generating an M×M distance matrix according to the inter-vehicle distance d m , where the distance is the weight between two points, and adjusting the matrix according to the number of broadcast channels Z m .
[0033] Furthermore, in step (3), performing federated learning according to the specified strategy specifically includes:
[0034] Model distribution: distributing the global model from the aggregation node to the transfer node and the training node;
[0035] Local training, locally training the training node on the vehicle-mounted computing device;
[0036] Model recycling, the training node returns the trained model to the aggregation node;
[0037] Model aggregation, the aggregation node aggregates all local models to obtain a new round of global model.
[0038] Further, in model recycling, the training node returns the trained model to the aggregation node specifically as follows: the training node returns the model according to the specified transceiver path, and uses hierarchical aggregation in federated learning when returning.
[0039] A vehicle-to-internet-of-things federated learning collaborative allocation method based on a heuristic algorithm provided by the present invention first divides vehicles in the vehicle-to-internet-of-things into discard nodes, aggregation nodes, forwarding nodes, and training nodes through three heuristic functions, which can effectively reduce the impact of quality nodes on the entire federated learning process. Then, an adjacency matrix is generated based on the above division, and the transceiver path of the model is generated through the Dijkstra algorithm. Finally, federated learning (model distribution, local training, model recycling, model aggregation) is carried out according to the specified strategy. This method can adapt to the changing network topologies during vehicle driving and improve the training efficiency of federated learning while ensuring the effectiveness of federated learning. Description of the Drawings
[0040] Figure 1 It is a flowchart of a vehicle-to-internet-of-things federated learning collaborative allocation method based on a heuristic algorithm according to the present invention;
[0041] Figure 2 It is a pseudocode diagram of a vehicle-to-internet-of-things federated learning collaborative allocation method based on a heuristic algorithm according to the present invention;
[0042] Figure 3 It is a schematic diagram of the federated learning efficiency result of a vehicle-to-internet-of-things federated learning collaborative allocation method based on a heuristic algorithm according to the present invention;
[0043] Figure 4 It is a schematic diagram of the overall time-consuming result of federated learning of a vehicle-to-internet-of-things federated learning collaborative allocation method based on a heuristic algorithm according to the present invention. Detailed Embodiment
[0044] The present invention will be further described in detail below with reference to the drawings and embodiments. The described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments of the present invention belong to the scope of protection of the present invention.
[0045] As Figure 1 shown, based on federated learning and edge computing, this solution provides a collaborative allocation method for vehicle network federated learning based on a heuristic algorithm. This method can adapt to the dynamically changing topological structure in the vehicle network and effectively improve the training efficiency of federated learning in driving scenarios. It mainly includes the following steps:
[0046] Step (1): Divide the functions of vehicles using a heuristic function according to vehicle attributes (including the number of samples owned, computing power, and broadcast channel number) and the distance between vehicles, obtaining discard nodes, aggregation nodes, training nodes, and relay nodes;
[0047] Step (2): Generate an adjacency matrix based on the discard nodes, aggregation nodes, training nodes, and relay nodes described in step (1), and use the Dijkstra algorithm to generate the transceiver paths of the federated learning model from the aggregation node to the training node and the relay nodes;
[0048] Step (3): Carry out federated learning according to the specified policy, including model distribution, local training, model recovery, and model aggregation.
[0049] In step (1) of this embodiment, the division of the functions of vehicles using a heuristic function according to vehicle attributes (including the number of samples owned, computing power, and broadcast channel number) and the distance between vehicles includes:
[0050] Step (101): Use the heuristic function H off (m) to determine whether a vehicle can participate in federated learning. If it cannot participate, it is determined as the discard node;
[0051] Step (102): Use the heuristic function H agg (m) to select a suitable vehicle as the aggregation node;
[0052] Step (103): Use the heuristic function H train (m) to divide the nodes participating in federated learning into the training nodes and the relay nodes.
[0053] In this embodiment, step (101) is specifically: comprehensively considering factors such as the distance between vehicles, computing power, and the number of samples, construct the heuristic function H off (m) as follows:
[0054] H off (m) = ω 11 d m,min + ω 12 d m,mean + ω 13 d m,c - ω 14 Sm -ω 15 C m
[0055] where d m,min represents the distance from vehicle m to the nearest vehicle; d m,mean is the average distance from vehicle m to the other vehicles; d m,c represents the distance from vehicle m to the central position; S m is the sample quantity of the m-th vehicle; C m is the computing power of the m-th vehicle; ω 1· represents the weighting coefficient of the heuristic function H off (m), satisfying ω 1· > 0 and ∑ω 1· = 1;
[0056] Meanwhile, a decision threshold γ off is set for judging the vehicles; when the condition H off (m)> γ off is satisfied, then vehicle m is judged as a discarded node.
[0057] In this embodiment, the step (102) is specifically as follows: comprehensively considering the inter-vehicle distance and the number of broadcast channels, a heuristic function H agg (m) is constructed as follows:
[0058] H agg (m)= -ω 21 d m,mean -ω 22 d m,c +ω 23 Z m
[0059] where Z m is the number of broadcast channels of the m-th vehicle; ω 2· represents the weighting coefficient of the heuristic function H agg (m), satisfying ω 2· > 0 and ∑ω 2· = 1; through this heuristic function H agg (m), the aggregation node m agg is selected as follows:
[0060]
[0061] where M represents the total number of vehicles participating in federated learning, that is, the vehicle with the largest value of the heuristic function H agg (m) is selected as the aggregation node.
[0062] In this embodiment, the step (103) is specifically as follows: comprehensively considering the computing power and sample quantity of the vehicles, a heuristic function H train(m) is as follows:
[0063] H train (m) = ω 31 C m + ω 32 S m
[0064] Wherein, ω 3· represents the weighting coefficient of the heuristic function H agg (m), satisfying ω 3· > 0 and ∑ω 3· = 1;
[0065] Meanwhile, a classification threshold γ train is set. If the vehicle satisfies the condition H train (m)> γ train , then the vehicle m is classified as a training node; otherwise, it is classified as a transfer node.
[0066] In step (2) of this embodiment, generating the adjacency matrix according to the discarded nodes, the aggregation nodes, the training nodes, and the transfer nodes described in step (1) is specifically as follows: generating an M×M distance matrix according to the inter-vehicle distance d m , where the distance is the weight between two points, and adjusting the matrix according to the number of broadcast channels Z m .
[0067] In step (3) of this embodiment, carrying out federated learning according to the specified strategy specifically includes:
[0068] Model distribution: distributing the global model from the aggregation node to the transfer node and the training node;
[0069] Local training: locally training the training node on the vehicle-mounted computing device;
[0070] Model collection: the training node returns the trained model to the aggregation node;
[0071] Model aggregation: the aggregation node aggregates all the local models to obtain a new round of global model.
[0072] In model collection, the training node returns the trained model to the aggregation node specifically as follows: the training node returns the model according to the specified transceiver path and uses hierarchical aggregation in federated learning when returning.
[0073] It should be noted that there are three types of nodes in the hierarchical aggregation in this embodiment: edge nodes, intermediate nodes, and aggregation nodes. The intermediate nodes collect the models from the edge nodes or other intermediate nodes and complete the aggregation tasks of these models, thereby reducing the number of model transmissions and communication overhead.
[0074] As a specific embodiment of this solution, this embodiment is based on the scenario of one-way multi-lane driving, which is relatively common in reality, such as vehicle driving on highways or viaducts. Specifically, it involves the design of a vehicle motion model and a federated learning time model.
[0075] In the design of the vehicle motion model, a set of vehicles is set on a one-way multi-lane, and its index is represented as m ∈ {1, 2, 3, … M}, where M represents the total number of vehicles, and communication between vehicles is realized through vehicle networking (vehicle-to-vehicle communication) technology. The modeling work of the vehicle model mainly includes three parts: vehicle movement modeling, vehicle communication modeling, and vehicle attribute modeling.
[0076] First is the vehicle movement modeling, and the selected driving model is the random walk model. Random walk is a simple distance change model, assuming that the movement of the vehicle is a random process, which is widely used in the simulation research of vehicle motion. Let μ v represent the mean value of the vehicle driving speed, and σ v represent the standard deviation of the vehicle driving speed. The driving speed of the vehicle follows a Gaussian distribution, and its probability density function f(v m,t ) is:
[0077]
[0078] In the formula, v m,t represents the speed of vehicle m at time t. Let the position of vehicle m at time t be where represents the ordinate of the vehicle, that is, the lane where it is located, and the change is relatively small; represents the abscissa of the vehicle, that is, the driving mileage, and its change mode is described by the following formula:
[0079]
[0080] In the formula, dt is the simulation time interval of the vehicle motion model. This formula shows that the current position of the vehicle is determined by the position at the previous moment plus the driving distance, and the driving distance is the product of the speed and the time interval.
[0081] Then is the vehicle communication modeling. The reflection power of the vehicle is p, and all vehicles transmit at the maximum transmission power. The communication rate of vehicle m in the k-th round can be expressed as:
[0082]
[0083] In the formula, B is the communication bandwidth, N 0 is the power spectral density of additive white Gaussian noise, Denote the channel gain. In the driving scenario of one-way multi-lane form, the main loss of the channel comes from the path attenuation caused by the communication distance.
[0084] For the channel gain This example adopts the classical path loss empirical model, and its calculation formula is as follows:
[0085]
[0086] In the formula, c represents the fixed loss factor propagating in space, α represents the path loss exponent, where d m represents the distance between vehicle m and the target communication vehicle.
[0087] Finally, vehicle attribute modeling is considered, mainly including three attributes: the number of samples, computing power, and the number of broadcast channels. Among them:
[0088] The number of samples S represents the amount of data that each vehicle can provide. Let S m be the number of samples of the m-th vehicle.
[0089] The computing power C represents the computing and processing ability of each vehicle per unit time. Let C m be the computing power of the m-th vehicle, with the unit of samples / s, indicating the number of samples that the vehicle can process per second.
[0090] The number of broadcast channels Z reflects the communication ability of the vehicle. Let Z m represent the number of broadcast channels of the m-th vehicle.
[0091] In the design of the vehicle motion model, the type of federated learning used in this example is synchronous federated learning, which is the most common way in federated learning. Its main feature is that all vehicles participating in the training complete the same tasks at the same time node. For the time modeling of synchronous federated learning, this section divides its process into the following four parts: model training, model distribution, model recovery, and model aggregation. The specific modeling method is as follows:
[0092] Model training: In synchronous federated learning, the time of each round of training is determined by the node with the longest training time among the participating nodes, and its calculation formula is:
[0093]
[0094] In the formula, represents the training time of vehicle m in the k-th round of federated learning, and the calculation method is as follows:
[0095]
[0096] In the formula, epochs represents the number of rounds of local training.
[0097] Model distribution and recovery: For vehicle m, the receiving time of its model in the k-th round and the uploading time are respectively:
[0098]
[0099] In the formula, a represents the size of the model, and respectively represent the model receiving rate and the uploading rate, τ m,pull and τ m,push are respectively the delays for converting the model into an available form. The model transmission time of the entire federated learning is mainly affected by the selection of the aggregation node and the transceiver path.
[0100] Specifically, the model distribution time and the model recovery time are calculated as follows respectively:
[0101]
[0102] In the formula, m agg represents the selected aggregation node, Γ represents the specified transceiver path, G pull and G push are respectively the time mapping functions of the aggregation node and the transceiver path.
[0103] Model aggregation: The time of model aggregation is mainly related to the number of vehicles participating in the training and the computing examples of the aggregation node, and can be calculated by the following formula:
[0104]
[0105] In the formula, represents the aggregation computing power (unit: samples / s).
[0106]
[0107]
[0108] As shown in the above table, as a further illustration of this solution, a vehicle-to-everything (V2X) federated learning collaborative allocation method based on a heuristic algorithm includes:
[0109] Step (1) First, divide the functions of vehicles using a heuristic function according to vehicle attributes (including the number of samples, computing power, and broadcast channels) and the distance between vehicles.
[0110] Specifically, as Figure 2 shown, each vehicle obtains its own attributes: the number of samples Sm 、Computing power C m 、Number of broadcast channels Z m Meanwhile, calculate the workshop distance, including the distance d from vehicle m to the nearest vehicle m,min and the average distance d from vehicle m to the remaining vehicles m,mean representing the distance d from vehicle m to the central position m,c .
[0111] Step (101) inputs the above parameters (d m,min , d m,mean , d m,c , S m , C m ) into the heuristic function H off (m), and determines whether H off (m) > γ off ; if satisfied, it indicates that the quality of its node is low, which will affect the overall efficiency of federated learning, and it is determined as a discarded node; otherwise, it participates in federated learning.
[0112] Step (102) inputs the above parameters (d m,mean , d m,c , Z m ) into the heuristic function H agg (m), and takes the node with the maximum function value H agg (m) as the aggregation node and marks it as m agg . A suitable aggregation node can effectively improve the efficiency of federated learning and reduce the communication bottleneck.
[0113] Step (103) inputs the above parameters (S m , C m ) into the heuristic function H train (m), and determines whether H train (m) > γ train ; if satisfied, vehicle m is classified as a training node; otherwise, it is classified as a transfer node. Through this classification, the efficiency of federated learning can be effectively improved, and the impact brought by nodes with long training time and small number of samples can be reduced.
[0114] Through the above steps, all vehicle functions have been collaboratively allocated: discarded nodes, aggregation nodes, training nodes, and transfer nodes.
[0115] Step (2) generates an adjacency matrix according to the above functional division results and uses the Dijkstra algorithm to generate the transceiver paths from the aggregation node to the remaining nodes of the federated learning model.
[0116] Step (201) generates an adjacency matrix according to the classified discarded nodes, aggregation nodes, training nodes, and transfer nodes.
[0117] In step (202), the Dijkstra algorithm is used to generate the transmission and reception paths from the aggregation node to the aggregation training node and the relay node for the adjacency matrix.
[0118] Step (3) performs federated learning according to the previously formulated strategy, including four steps: model distribution, local training, model aggregation, and model recovery.
[0119] Step (301) is to distribute the global model from the aggregation node to the relay node and the training nodes;
[0120] Step (302) is for the training nodes to perform local training on the vehicle-mounted computing devices;
[0121] Step (303) is for model recovery, and the training nodes return the trained models to the aggregation node;
[0122] Step (304) is for the aggregation node to aggregate all the local models to obtain a new round of global model.
[0123] Through the above method, this embodiment can not only adapt to the real-time changing topological structure, but also effectively improve the federated learning efficiency in the vehicle network.
[0124] As Figure 3 shown, it is the implementation effect of this method when the number of vehicles is 10. The ordinate in the figure is the training efficiency of federated learning Its calculation method is as follows:
[0125]
[0126] In the formula, represents the overall time of federated learning in the k-th round of the vehicle network (unit: s / round), which is the total time required to complete this round of federated learning. Specifically, it is composed of the local training time of the model, the upload and download time of the model, and the aggregation time of the aggregation node. Its calculation formula is as follows:
[0127]
[0128] At the same time, this embodiment also implements other methods for comparison, including:
[0129] Method 1: Select a fixed aggregation node and generate transmission and reception paths in combination with the Dijkstra algorithm. This method is a classic federated learning framework and is the benchmark method of this embodiment. As the benchmark method in this article, it is used for performance comparison with other methods.
[0130] Method 2: Randomly select aggregation nodes and generate the transceiver path in combination with the Dijkstra algorithm. This method is a strategy-free method used for comparative analysis with strategy-based methods. As a strategy-free random method, its main purpose is to serve as a comparison baseline, in sharp contrast to strategy-based methods.
[0131] Method 3: Use the heuristic function H agg (m) Select appropriate aggregation nodes and generate the transceiver path in combination with the Dijkstra algorithm. This method is used to verify the optimization effect of H agg (m) in the selection of aggregation nodes.
[0132] Method 4: Randomly select aggregation nodes and generate the transceiver path in combination with the Dijkstra algorithm; meanwhile, use the heuristic function H off (m) for selection and discard some nodes. This method is used to verify the optimization effect of H off (m) on the overall federated learning efficiency.
[0133] Method 5: Randomly select appropriate aggregation nodes and generate the transceiver path in cooperation with the Dijkstra algorithm; meanwhile, use the heuristic function H train (m) to divide the training nodes and relay nodes. This method is used to verify the role of H train (m) in improving the federated learning efficiency and sample utilization rate.
[0134] The above Method 3, Method 4, and Method 5 separately introduce a heuristic function proposed in this paper, aiming to verify the effectiveness and contribution of each heuristic function in specific tasks.
[0135] Method 6: That is, the method proposed in the present invention. Use the heuristic function H agg (m) Select appropriate aggregation nodes and generate the transceiver path in cooperation with the Dijkstra algorithm; meanwhile, use the heuristic function H off (m) to discard some nodes and use the heuristic function H train (m) to divide the training nodes and relay nodes. This method is the complete optimization framework proposed in this paper, used to demonstrate the final performance after overall optimization. This method comprehensively applies all the designed heuristic functions, showing the final optimized effect. As Figure 3 shown, the method proposed in the present invention can effectively improve the federated learning efficiency, and its variance is small, showing good stability for different topological structures.
[0136] As Figure 4As shown, the overall time consumption of federated learning for different methods when the number of vehicles is 8, 10, and 12. It can be observed from the figure that the overall time consumption of the classical federated learning framework (the above-mentioned method 1) and the completely random method without policies (the above-mentioned method 2) is relatively long, and the standard deviation is significantly larger. This indicates that in a dynamic topology environment, the federated learning time of the above-mentioned method 1 and the above-mentioned method 2 is not only high, but also vulnerable to topology changes, resulting in instability in time performance. In contrast, the above-mentioned method 3 and the above-mentioned method 4 show significant advantages in the overall time consumption of federated learning. Both of these methods significantly shorten the overall time consumption, and the standard deviation is small, and the time consumption per round of federated learning is more stable.
[0137] Finally, the present invention combines three heuristic functions, integrating the advantages of the above-mentioned method 3 and the above-mentioned method 4. It can not only significantly reduce the communication time by selecting efficient aggregation nodes and discarding inefficient nodes, but also make full use of node function partitioning to improve the operation efficiency. In this embodiment, the present invention simultaneously achieves a relatively low overall time consumption of federated learning and a relatively high operation efficiency, fully meeting the requirements of federated learning under the dynamic topology of the vehicle network.
[0138] The above is only to illustrate the embodiments of the present invention and is not intended to limit the present invention. For those skilled in the art, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for cooperative allocation of federated learning in Internet of Vehicles based on heuristic algorithm, characterized in that: include: Step (1) divide the functions of the vehicle using a heuristic function according to the vehicle attributes and the vehicle-to-vehicle distance, and obtain discarded nodes, aggregation nodes, training nodes, and transfer nodes; Step (2) generates an adjacency matrix according to the abandoned node, the aggregation node, the training node and the transfer node in step (1), and uses the Dijkstra algorithm to generate a sending and receiving path of the federated learning model from the aggregation node to the training node and the transfer node; Step (3) carries out federated learning according to the specified strategy, including model distribution, local training, model recycling, and model aggregation.
2. The method for cooperative allocation of federated learning in Internet of Vehicles based on heuristic algorithm according to claim 1, characterized in that: The step (1) uses a heuristic function to divide the functions of the vehicle according to the vehicle attributes and the vehicle-to-vehicle distance, including: Step (101) uses the heuristic function H off (m) determining whether the vehicle can participate in federated learning, and if not, determining the vehicle as the abandoned node; Step (102) uses the heuristic function H agg (m) selecting a suitable vehicle as the aggregation node; Step (103) uses the heuristic function H train (m) Dividing the nodes participating in federated learning into the training nodes and the transfer nodes.
3. The method for cooperative allocation of federated learning in Internet of Vehicles based on heuristic algorithm according to claim 2 is characterized in that: The step (101) is specifically as follows: comprehensively considering factors such as workshop distance, computing power, and sample quantity, constructing a heuristic function H off (m), as follows: H off (m)=ω 11 d m,min +oh 12 d m,mean +oh 13 d m,c -oh 14 S m -oh 15 C m Where, d m,min represents the distance from vehicle m to the nearest vehicle; d m,mean is the average distance from vehicle m to the rest of the vehicles; d m,c Represents the distance from vehicle m to the center position; S m is the number of samples of the mth vehicle; C m is the computing power of the mth vehicle; ω 1· Denotes the heuristic function H off The weighting coefficient of (m) satisfies ω 1· >0 and ∑ω 1· =1; At the same time, a judgment threshold γ is set off , used to judge the vehicle; when the condition H is met off (m)>γ off , then vehicle m is judged as an abandoned node.
4. The method for cooperative allocation of federated learning in Internet of Vehicles based on a heuristic algorithm according to claim 2 is characterized in that: The step (102) is specifically as follows: comprehensively considering the workshop distance and the number of broadcast channels, constructing a heuristic function H agg (m), as follows: H agg (m)=-ω 21 d m,mean -ω 22 d m,c +ω 23 Z m In the formula, Z m is the number of broadcast channels for the mth vehicle; ω 2· Denotes the heuristic function H agg The weighting coefficient of (m) satisfies ω 2· >0 and ∑ω 2· =1; through the heuristic function number H agg (m) Select aggregation node m agg , as follows: Where M represents the total number of vehicles participating in federated learning, that is, the heuristic function H is selected agg The vehicle with the largest (m) value is taken as the aggregation node.
5. The method for cooperative allocation of federated learning in Internet of Vehicles based on heuristic algorithm according to claim 2 is characterized in that: The step (103) is specifically as follows: comprehensively considering the computing power of the vehicle and the number of samples, constructing the heuristic function H train (m), as follows: H train (m)=ω 31 C m +oh 32 S m In the formula, ω 3· Denotes the heuristic function H agg The weighting coefficient of (m) satisfies ω 3· >0 and ∑ω 3· =1; At the same time, a classification threshold γ is set train , if the vehicle meets the condition H train (m)>γ train , then vehicle m is divided into a training node; otherwise, it is divided into a transfer node.
6. The method for cooperative allocation of federated learning in Internet of Vehicles based on heuristic algorithm according to claim 1, characterized in that: In step (2), the adjacency matrix is generated according to the abandoned node, the aggregation node, the training node and the transfer node in step (1), specifically: according to the workshop distance d m Generate an M×M distance matrix, where the distance is the weight between two points, and according to the number of broadcast channels Z m Adjust the matrix.
7. The method for cooperative allocation of federated learning in Internet of Vehicles based on heuristic algorithm according to claim 1, characterized in that: Step (3) carries out federated learning according to the specified strategy, including: Model distribution: distributing the global model from the aggregation node to the transfer node and the training node; Local training, training the training node locally on a vehicle-mounted computing device; Model recycling: the training node returns the trained model to the aggregation node; Model aggregation: the aggregation node aggregates all local models to obtain a new round of global model.
8. The method for cooperative allocation of federated learning in Internet of Vehicles based on heuristic algorithm according to claim 7 is characterized in that: In the model recycling, the training node returns the trained model to the aggregation node. Specifically, the training node returns the model according to the established sending and receiving path, and uses the hierarchical aggregation in federated learning when returning.