A traffic flow prediction method based on GAT and improved PKO-ELM algorithm

By combining the Graph Attention Network (GAT) and the improved Kingfisher Optimization Algorithm (PKO-ELM), graph-structured data is constructed and the ELM model is optimized. This solves the problem of insufficient accuracy and efficiency of existing traffic flow prediction models under complex traffic flow dynamics, and achieves efficient and accurate traffic flow prediction.

CN119694119BActive Publication Date: 2025-12-16HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411813974.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-12-16
Estimated Expiration
2044-12-11

AI Technical Summary

Technical Problem

Existing traffic flow prediction models struggle to fully capture multivariate and multidimensional data when dealing with complex traffic flow dynamics, and they also require high computational resources, resulting in insufficient prediction accuracy and efficiency.

Method used

By combining the Graph Attention Network (GAT) and the improved Kingfisher Optimization Algorithm (PKO-ELM), we construct graph-structured data, extract node features using the attention mechanism, and optimize the weights and biases of the ELM model using the PKO algorithm, achieving fast training and efficient prediction.

Benefits of technology

It improves the accuracy and computational efficiency of traffic flow prediction, can better handle real-time and historical traffic flow data, adapts to complex traffic environments, reduces overfitting problems, and enhances the robustness and generalization ability of the prediction model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119694119B_ABST
    Figure CN119694119B_ABST
Patent Text Reader

Abstract

The application discloses a traffic flow prediction method based on GAT and improved PKO-ELM algorithm. Firstly, real-time collection and historical traffic flow data sets are preprocessed; secondly, a traffic road map is modeled as a graph structure, a node feature matrix and an adjacency matrix are constructed; thirdly, the matrix is updated and aggregated by GAT to extract the spatial features of nodes; then, a PKO-ELM model is constructed, the population is initialized by a reverse learning strategy to improve the PKO algorithm, the ELM parameters are optimized by the improved PKO algorithm, and the optimal solution of the model parameters is searched; finally, the traffic flow data is predicted by using the PKO-ELM model optimized by training, and visualized display is realized through an interactive map. The application provides a more accurate traffic flow prediction result based on the spatial feature extraction of deep learning and the evolutionary algorithm after parameter optimization, so as to relieve traffic congestion and improve traffic management.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of intelligent transportation systems (ITS), and particularly relates to a traffic flow prediction method based on GAT and improved PKO-ELM algorithm. BACKGROUND

[0002] With the rapid advancement of urbanization, traffic problems have become a key factor hindering urban development. Urban traffic congestion not only leads to decreased travel efficiency and increased energy consumption, but also causes significant pollution to the environment. Traffic flow prediction is an important part of intelligent transportation systems (ITS), aiming to predict vehicle flow, speed and traffic conditions in road networks, which can more effectively conduct traffic scheduling, optimize path planning and prevent traffic accidents, thereby improving road usage efficiency, alleviating traffic congestion, improving road safety and travel experience.

[0003] Currently, traffic flow prediction models include prediction models based on statistical theory, machine learning models, deep learning models, physics-based models and hybrid prediction models. Prediction models based on statistical theory use mathematical and statistical principles to analyze and model the time series characteristics of traffic flow data, are suitable for processing linear relationships, and are relatively simple to calculate, but have weak prediction performance for processing multi-variable and multi-dimensional data. Machine learning models learn patterns from large amounts of data to make predictions, can automatically learn and adapt to complex patterns in the data, have higher prediction accuracy than statistical theory-based methods, but are limited by the structure of the model, have limited ability to extract non-linear features, making it difficult to accurately capture the spatio-temporal characteristics of traffic flow data, and have high requirements for computing resources. Deep learning models often use deep network architectures containing multiple hidden layers to automatically capture complex spatio-temporal characteristics, which enables them to handle the inherent high dimensionality and rapid changes in traffic data, thereby greatly improving the accuracy of the prediction. However, the complexity of such models also brings challenges such as long training periods and difficulty in tuning. Physics-based models predict traffic conditions by describing the physical characteristics of traffic flow, are suitable for a variety of traffic scenarios, can capture macroscopic phenomena, but have high requirements for input data and are not flexible enough for real-time prediction of large-scale road networks. Due to their own limitations, single models are usually difficult to fully capture complex traffic flow dynamics, while hybrid prediction models can better handle non-linear features and diverse patterns in the data by integrating the strengths of multiple single models, which helps to improve the accuracy and stability of the prediction, especially in the face of highly dynamic and uncertain traffic environments, the adaptability and overall performance of hybrid models are often superior to any single model.

[0004] The application can effectively cope with the large-scale processing demand of real-time and historical traffic flow data, maintain high computing efficiency, and make traffic flow prediction more accurate through parameter optimization of the ELM by combining the excellent ability of the graph attention network GAT in processing graph structure data and the advantage of fast training of the extreme learning machine ELM. SUMMARY

[0005] The application aims to provide a high-performance traffic flow prediction model to cope with increasingly complex traffic flow prediction tasks by combining the spatial feature extraction capability of deep learning and the parameter optimization capability of evolutionary algorithms.

[0006] Technical scheme: The application provides a traffic flow prediction method based on the GAT and the improved PKO-ELM algorithm, including the following steps:

[0007] Step 1: Collect real-time and historical traffic flow data sets, including the traffic volume F, average speed and density D of the road segment, and calculate the congestion index C, and preprocess the data;

[0008] Step 2: Construct the traffic road graph as a graph structure, where the nodes represent road segments and the edges represent the connection relationship between road segments, build the node feature matrix X and the adjacency matrix A;

[0009] Step 3: Take the node feature matrix X and the adjacency matrix A as the input of the graph attention network GAT, update and aggregate the features, dynamically assign different weights to the neighbor nodes through the attention mechanism, extract the spatial features of the nodes, and finally obtain the updated node feature matrix H;

[0010] Step 4: Take the obtained feature matrix H as the input, build a model combining the improved pike-and-feather optimization algorithm PKO and the extreme learning machine ELM, i.e. the PKO-ELM model for traffic flow prediction, and the improved pike-and-feather optimization algorithm PKO uses a reverse learning strategy for population initialization.

[0011] Further, the specific method of preprocessing in step 1 is as follows:

[0012] Step 1.1: Collect real-time and historical traffic flow data sets, use traffic sensors and electronic maps to obtain traffic data sets of road segments in the traffic network, including the traffic volume F, average speed and density D of the road segment;

[0013] Step 1.2: Calculate the congestion index C of the road segment, the congestion index C can be calculated according to the traffic volume F and the average speed The calculation is as follows:

[0014]

[0015] Where F is the traffic volume of the road section, C road is the road capacity, i.e. the maximum traffic volume that the road can carry under ideal conditions, is the average speed of vehicles on the road section, V f is the free flow speed, i.e. the average speed at which vehicles travel without congestion;

[0016] Step 1.3: Data preprocessing includes filling in missing values, exponential smoothing data, and normalizing data;

[0017] Step 1.4: Filling in missing values uses interpolation method to handle missing values in data, estimates missing values by using the relationship between known data points, ensures the integrity and continuity of data; uses exponential smoothing technique to smooth the data and reduce noise; uses max-min normalization method to scale the feature values to a fixed range of 0 to 1 for data normalization.

[0018] Further, the specific method of step 2 is:

[0019] Step 2.1: Create a graph structure, take each road section as a node in the graph, if there is a road connection relationship between two nodes, create an edge between the two nodes, the graph structure is represented as G(V, E), V represents the set of road sections (l1, l2,... l N ), where l N represents the Nth road section, N is the total number of road sections, E represents the connection relationship of road sections;

[0020] Step 2.2: Define node features x, including the features of each road section, including traffic volume F, average speed density D and congestion index C;

[0021] Step 2.3: The node feature vector x i of road section i is represented as: Where F i is the actual traffic volume of road section i, is the average speed of vehicles on road section i, the density D i of road section i, the congestion index C i of road section i, i takes 1 ~ N, and τ is the vector transpose;

[0022] Step 2.4: Get the node feature matrix X of all road sections as:

[0023] Step 2.5: Adjacency matrix A describes the adjacency relationship between link i and link j, which is calculated using a Gaussian function of distance, as follows:

[0024]

[0025] where d ij represents the Euclidean distance between link i and link j, σ represents the standard deviation parameter, d max represents the maximum distance between links;

[0026] Step 2.6: Obtain the adjacency matrix A:

[0027] Further, the specific method of step 3 is:

[0028] Step 3.1: Initialization: Set the initial node feature matrix H (0) = X and adjacency matrix A, where X ∈ R N×Z , N is the total number of links, Z is the feature dimension of each link node, representing the 4 features of each link node: traffic flow F i , average speed , density D i , and congestion index C i ; Adjacency matrix A ∈ R N×N represents the connection relationship between link nodes;

[0029] Step 3.2: Feature dimension transformation: For each link node i, generate a high-dimensional representation for each node through a linear transformation, and the feature vector of the node of link i x i is transformed as W·x i , where W is a weight matrix used to obtain a stronger feature representation;

[0030] Step 3.3: Calculate attention coefficient: For each link node i and its neighbor link node j, calculate the attention coefficient e ij , as follows:

[0031] e ij = LeakyReLU(a Τ [W·x i ||W·x j ])

[0032] where a T is a learnable parameter of the attention mechanism, || represents the vector concatenation operation, and LeakyReLU is an improved rectified linear unit used to solve the problem of zero output of standard ReLU at negative input values;

[0033] Step 3.4: Normalization of attention coefficients: normalization is performed using the softmax function, and the calculation formula is as follows:

[0034]

[0035] where N (i) is the set of neighbor nodes of the road segment node i;

[0036] Step 3.5: Aggregation of features: according to the normalized attention coefficients in step 3.4, the multi-head attention mechanism is used to aggregate the features of each target node neighbor node, and the final node feature vector h i is obtained, and the calculation formula is as follows:

[0037]

[0038] where σ(·) is the ReLU activation function, k represents the number of layers of the attention network, represents the normalized attention coefficient calculated by the vth attention mechanism, and W v is the corresponding weight matrix;

[0039] Step 3.6: Generation of a new node feature matrix: repeat steps 3.2-3.5, and combine the new features of all road segment nodes N into a new node feature matrix H through k-layer attention network, H = (h1 h2…h i …h N ) τ , which is the node feature representation after GAT processing.

[0040] Further, the specific method of step 4 is:

[0041] Step 4.1: Initialize the basic parameters of the PKO algorithm, set the population size M, the number of iterations B, and the dimension of the problem Dim;

[0042] Step 4.2: Population initialization, PKO randomly generates a population containing N individuals through the search space, and each individual X represents a set of weights w and bias b, and the equation for generating the initial population is as follows:

[0043] w i = (UB w -LB w ) x rand + LB w

[0044] b i = (UB b -LB b ) x rand + LB b

[0045] where i denotes the ith individual, w i i and b represent the weight and bias of the ith individual, rand is a random number uniformly distributed in the interval [0, 1], UB w and LB w are the upper bound and lower bound of the weight w, UB b and LB b are the upper bound and lower bound of the bias b;

[0046] Step 4.3: Calculate the output of the ELM hidden layer, configure the ELM using the weight w i and bias b i of the ith individual X i , calculate the output matrix O of the hidden layer by the activation function, the calculation formula is as follows:

[0047] O = σ(Hw i +b i )

[0048] where σ(·) is the Sigmoid activation function, H is the node feature representation processed by GAT in step 3.6, w i and b i represent the weight and bias of the ith individual;

[0049] Step 4.4: Calculate the weight matrix W o of the ELM output layer, according to the mathematical knowledge of Moore-Penrose generalized inverse matrix, solve the generalized matrix W o , the calculation formula is as follows:

[0050] W o = (O τ O) -1 O τ t

[0051] where (O Τ O) -1 O τ is the Moore-Penrose generalized inverse matrix of matrix O, O τ is the transpose of matrix O, (O τ O) -1 is the inverse matrix of O τ O, t is the sample label;

[0052] Step 4.5: Calculate the predicted output , the calculation formula is as follows:

[0053] Step 4.6: Calculate the fitness value, use mean square error MSE as the objective function, calculate the prediction error as the fitness value; ​

[0054] Step 4.7: For individual X in the population i , calculate its corresponding inverse solution X i ', the calculation formula is as follows:

[0055] w i ' = (UB w + LB w ) * rand-w i

[0056] b i ' = (UB b + LB b ) * rand-b i

[0057] where w i ', b i ' represents the weight and bias of the inverse solution of the i-th individual, rand is a random number uniformly distributed in the interval [0, 1], UB w and LB w are the upper and lower bounds of the weight w, UB b and LB b are the upper and lower bounds of the bias b;

[0058] Step 4.8: Calculate the fitness value of the original individual and its inverse solution, repeat steps 4.2-4.6, update the Q solution with lower fitness value as the final initial population;

[0059] Step 4.9: Perform the three stages of the PKO algorithm for each individual of the initial population Q, including the exploration stage, the development stage and the local escape stage;

[0060] Step 4.10: The exploration stage is used to simulate the behavior of the flowerbird searching for potential prey, and the optimal solution is found by changing the position of the current solution, the update formula of the current position is:

[0061] X i (t+1) = X i (t) + a * T * (X j (t) - X i (t)), i, j = 1, 2, … N and j≠i

[0062] a = 2 * randn(1, Dim) - 1

[0063] where X i (t) is the position of the current individual at iteration t, X i(t+1) is the position of the next iteration, a is the step parameter, which is calculated as 2*randn(1, Dim)-1, randn(1, Dim) represents a random number drawn from a normal distribution, T is a dynamically determined parameter, the value of which is determined according to the current strategy, and the current strategy is the habitat strategy or the hovering strategy:

[0064] The parameter calculation formula of the habitat strategy T is as follows:

[0065]

[0066] Crest_angles=2*pi*rand

[0067] Where Max_Iter is the maximum number of iterations, pi represents the constant value of pi, and the constant value BF is set to 8.

[0068] The parameter calculation formula of the hovering strategy T is as follows:

[0069]

[0070] Where PKO_Fitness(j) and PKO_Fitness(i) represent the fitness values of the i-th and j-th parakeet, respectively, and the constant value BF is set to 8.

[0071] Step 4.11: Development stage, further improve the feasible solution found by local search, the position update calculation formula is as follows:

[0072] X i (t+1)=X i (t)+HA*U*α*(b-X best (t)),i=1,2,…N

[0073]

[0074] b=X i (t)+U 2 *randn*X best (t)

[0075] Where X i (t) is the position of the current individual at iteration t, X i (t+1) is the position of the next iteration, a is the step parameter, b represents the fitness influence parameter, Max_Iter is the maximum number of iterations, Best_Fitness represents the best fitness value obtained in all iterations, and X best (t) represents the best position of all individuals in the current iteration.

[0076] Step 4.12: Local escape phase, promote the sharing of information in the population, avoid premature convergence. The position update formula is as follows:

[0077]

[0078] Where, 2 individuals are randomly selected from the population, and their positions are represented by X m (t) and X n (t) represent, abs() is the absolute value function, PE represents the predation efficiency of the kingfisher, PE MAX represents the maximum allowed value of the perception error in the iteration process, PE max and PE min represent the maximum and minimum values of the predation efficiency, which are 0.5 and 0, respectively.

[0079] Step 4.13: Perform iterative updates, repeat step 4.9 to update the position of each individual, repeat step 4.6 to calculate the fitness value, update the individual with low fitness value until the iteration is completed.

[0080] Step 4.14: Complete the iteration, select the individual with the lowest fitness value as the optimal w and b;

[0081] Step 4.15: Configure the optimal w and b into the ELM model to predict traffic flow;

[0082] Step 4.16: Display the prediction results to the user through a visual map.

[0083] The present application adopts the above technical scheme and has the following beneficial effects:

[0084] 1. The graph attention network GAT is used to capture complex dependency relationships in the traffic network. GAT can automatically learn and weight these dependencies by introducing an attention mechanism, enabling the model to more accurately capture the interactions between nodes in the traffic network and more accurately model the dynamic characteristics of traffic flow, improving prediction accuracy.

[0085] 2. The PKO algorithm is used to optimize the weights w and biases b in the ELM model, enabling the model to achieve better performance on a given data set. This optimization strategy can help avoid overfitting and find more robust and generalizable model configurations.

[0086] 3. The reverse learning strategy is used for population initialization, which can speed up convergence and increase population diversity, helping to explore a wider solution space and improve global search efficiency.

[0087] 4. In the POK-ELM algorithm, through the design of exploration, development and local escape stage, effective exploration and utilization of solution space are realized. Such design not only helps to find high-quality solutions, but also avoids the problem of premature convergence, ensuring the flexibility and stability of the algorithm in the process of finding optimal solutions.

[0088] 5. Combining the powerful processing capability of GAT for graph structure data and the advantages of ELM fast training, this method can effectively cope with the large-scale processing demand of real-time and historical traffic flow data, while maintaining high computational efficiency.

[0089] 6. By comprehensively using advanced machine learning techniques, this method aims to provide more accurate traffic flow prediction results, which is of great significance for urban traffic management and planning, such as optimizing signal light control, route navigation and emergency response applications. BRIEF DESCRIPTION OF DRAWINGS

[0090] Figure 1 is the overall flow chart of the prediction model based on GAT and improved PKO-ELM;

[0091] Figure 2 is the overall structure diagram of the prediction model based on GAT and improved PKO-ELM;

[0092] Figure 3 is the structure diagram of the graph structure construction process of urban road graph;

[0093] Figure 4 is the flow chart of the improved PKO-ELM algorithm. DETAILED DESCRIPTION

[0094] The present application will be further illustrated below in conjunction with specific embodiments, which should be understood as merely illustrating the present application and not limiting the scope of the present application. After reading the present application, those skilled in the art can make various modifications to the equivalent forms of the present application, which fall within the scope defined by the claims attached hereto.

[0095] Step 1: Collect real-time and historical traffic flow data sets, including the traffic volume F, average speed and density D of the road segment, and calculate the congestion index C, and preprocess the data:

[0096] Step 1.1: Collect real-time and historical traffic flow data sets, use traffic sensors and electronic maps to obtain traffic data sets of road segments in the traffic network, including traffic volume F, average speed and density D of the road segment.

[0097] Step 1.2: Calculate the congestion index C of the road segment, the congestion index C can be calculated according to the traffic volume F and average speed The calculation is as follows:

[0098]

[0099] Wherein, F is the actual traffic flow of the road, C road is the road capacity, i.e. the maximum flow that the road can carry under ideal conditions, is the average speed of vehicles on the road section, V f is the free flow speed, i.e. the average speed at which vehicles travel without congestion.

[0100] Step 1.3: Data preprocessing includes filling missing values, exponential smoothing data, and normalizing data. Interpolation method is used to handle missing values in the data; exponential smoothing technique is used to smooth the data and reduce noise; all numerical features in steps 1.1-1.2 are normalized to the same scale range using the max-min normalization method.

[0101] Step 2: Traffic road map is constructed as a graph structure, where nodes represent road sections and edges represent the connection relationship between road sections. Node feature matrix X and adjacency matrix A are constructed, as shown in Figure 3

[0102] Step 2.1: Create a graph structure, treat each road section as a node in the graph, and create an edge between two nodes if there is a road connection relationship between them. The graph structure is represented as G(V, E), V represents the set of road sections (l1, l2,... l N ), where l N represents the Nth road section, and E represents the connection relationship between road sections.

[0103] Step 2.2: Define node features x, including the features of each road section, including traffic flow F, average speed density D and congestion index C.

[0104] Step 2.3: The node feature vector x i of road section i is represented as: Wherein, F i is the actual traffic flow of road section i, is the average speed of vehicles on road section i, the density D i of road section i, the congestion index C i of road section i, i takes 1-N, and τ is the vector transpose.

[0105] Step 2.4: The node feature matrix X of all road sections is obtained as: Wherein, N is the total number of road sections.

[0106] ​Step 2.5: Adjacency matrix A describes the adjacency relationship between link i and link j, calculated using a Gaussian function of distance, as follows:

[0107]

[0108] where d ij represents the Euclidean distance between link i and link j, σ represents the standard deviation parameter, d max represents the maximum distance between links.

[0109] Step 2.6: Obtain adjacency matrix A:

[0110] Step 3: Take node feature matrix X and adjacency matrix A as input of graph attention network GAT, update and aggregate features, dynamically assign different weights to neighbor nodes through attention mechanism, extract spatial features of nodes, and finally obtain updated node feature matrix H:

[0111] Step 3.1: Initialization: set the initial node feature matrix H (0) = X and adjacency matrix A, where X ∈ R N×Z , N is the total number of links, Z is the feature dimension of each link node, representing the 4 features of each link node: traffic flow F i , average speed , density D i , and congestion index C i ; adjacency matrix A ∈ R N×N represents the connection relationship between link nodes.

[0112] Step 3.2: Feature dimension transformation: for each link node i, generate a high-dimensional representation for each node through a linear transformation, and the feature transformation of the node feature vector x i of link i is represented as W·x i , where W is a weight matrix used to obtain a stronger feature representation.

[0113] Step 3.3: Calculate attention coefficient: for each link node i and its neighbor link node j, calculate the attention coefficient e ij , as follows:

[0114] e ij = LeakyReLU(a Τ [W·x i ||W·x j ])

[0115] where a Tare the learnable parameters of the attention mechanism, || denotes vector concatenation operation, LeakyReLU is the improved rectified linear unit, which is used to solve the problem that the standard ReLU outputs zero at negative input values.

[0116] Step 3.4: Normalization of attention coefficients: normalization is performed using the softmax function, and the calculation formula is as follows:

[0117]

[0118] where N (i) is the set of neighbor nodes of road segment node i.

[0119] Step 3.5: Feature aggregation: according to the normalized attention coefficients in step 3.4, the multi-head attention mechanism is used to aggregate the features of each target node's neighbor nodes, and the final node feature vector h i is obtained, and the calculation formula is as follows:

[0120]

[0121] where σ(·) is the ReLU activation function, k represents the number of layers of the attention network, denotes the normalized attention coefficient calculated by the vth attention mechanism, W v is the corresponding weight matrix.

[0122] Step 3.6: Generate a new node feature matrix: repeat steps 3.2-3.5, and combine the new features of all road segment nodes N into a new node feature matrix H through k-layer attention network, H = (h1 h2…h i …h N ) τ , which is the node feature representation after GAT processing.

[0123] Step 4: Take the feature matrix H obtained from the graph attention network GAT as input, and construct a model combining the improved peacock optimization algorithm PKO and the extreme learning machine ELM, i.e. the PKO-ELM model for traffic flow prediction, as shown in Figure 4 .

[0124] Step 4.1: Initialize the basic parameters of the PKO algorithm, set the population size M, the number of iterations B, and the dimension of the problem Dim.

[0125] Step 4.2: Population initialization, PKO randomly generates a population containing N individuals from the search space, and each individual X represents a set of weights w and bias b, and the equation for generating the initial population is as follows:

[0126] w i = (UBw - LB w ) x rand + LB w

[0127] b i = (UB b - LB b ) x rand + LB b

[0128] where i denotes the ith individual, w i , b i represent the weight and bias of the ith individual, rand is a random number uniformly distributed in the interval [0, 1], UB w and LB w are the upper bound and lower bound of the weight w, UB b and LB b are the upper bound and lower bound of the bias b.

[0129] Step 4.3: Calculate the output of the ELM hidden layer, configure the ELM using the weight w i and bias b i of the ith individual X i , calculate the output matrix O of the hidden layer by the activation function, the calculation formula is as follows:

[0130] O = σ(Hw i +b i )

[0131] where σ(·) is the Sigmoid activation function, H is the node feature representation processed by GAT in step 3.6, w i , b i represent the weight and bias of the ith individual.

[0132] Step 4.4: Calculate the weight matrix W o of the ELM output layer, according to the mathematical knowledge of Moore-Penrose generalized inverse matrix, solve the generalized matrix W o , the calculation formula is as follows:

[0133] W o = (O τ O) -1 O τ t

[0134] where (O Τ O) -1 O τ is the Moore-Penrose generalized inverse matrix of matrix O, O τ is the transpose of matrix O, (O τ O) -1 is O τInverse of O, t is the sample label.

[0135] Step 4.5: Calculate the predicted output The calculation formula is as follows:

[0136] Step 4.6: Calculate the fitness value, use mean square error MSE as the objective function, calculate the prediction error as the fitness value.

[0137] Step 4.7: For individual X in the population i , calculate its corresponding inverse solution X i ', the calculation formula is as follows:

[0138] w i ' = (UB w + LB w ) * rand-w i

[0139] b i ' = (UB b + LB b ) * rand-b i

[0140] Where w i ', b i ' represents the weight and bias of the inverse solution of the ith individual, rand is a random number uniformly distributed in the interval [0, 1], UB w and LB w are the upper and lower bounds of the weight w, UB b and LB b are the upper and lower bounds of the bias b.

[0141] Step 4.8: Calculate the fitness value of the original individual and its inverse solution, repeat steps 4.2-4.6, update the Q solution with lower fitness value as the final initial population.

[0142] Step 4.9: Execute the three stages of the PKO algorithm for each individual of the initial population Q, including the exploration stage, the development stage and the local escape stage.

[0143] Step 4.10: The exploration stage is used to simulate the behavior of the flowerbird searching for potential prey, and the optimal solution is found by changing the position of the current solution, the update formula of the current position is:

[0144] X i (t+1) = X i (t) + α * T * (X j (t) - X i (t)), i, j = 1, 2, … N and j≠i

[0145] a = 2 * randn(l, Dim) - 1

[0146] wherein X i (t) is the position of the current individual at iteration t, X i (t+1) is the position of the next iteration, a is the step parameter, which is calculated as 2 * randn(l, Dim) - 1, randn(l, Dim) represents a random number drawn from a normal distribution, and T is a dynamically determined parameter, the value of which is determined according to the current strategy, which is the habitat strategy or the hovering strategy.

[0147] The calculation formula of the T parameter of the habitat strategy is as follows:

[0148]

[0149] Crest_angles = 2 * pi * rand

[0150] wherein Max_Iter is the maximum number of iterations, pi represents the constant value of pi, and the constant value BF is set to 8.

[0151] The calculation formula of the T parameter of the hovering strategy is as follows:

[0152]

[0153] wherein PKO_Fitness(j) and PKO_Fitness(i) represent the fitness values of the i-th and j-th parakeets, respectively, and the constant value BF is set to 8.

[0154] Step 4.11: Development phase, further improve the feasible solution found by local search, the position update calculation formula is as follows:

[0155] X i (t+1) = X i (t) + HA * U * a * (b - X best (t)), i = 1, 2, … N

[0156]

[0157] b = X i (t) + U 2 * randn * X best (t)

[0158] wherein a is the step parameter, b represents the fitness influence parameter, Best_Fitness represents the best fitness value obtained in all iterations, and X best (t) represents the best position of all individuals in the current iteration.

[0159] Step 4.12: Local escape phase, promote the sharing of information in the population, avoid premature convergence. Position update formula as follows:

[0160]

[0161] Where, 2 individuals are randomly selected from the population, their positions are represented by X m (t) and X n (t) respectively, abs() is the absolute value function, PE represents the predation efficiency of the bluebird, where PE MAX represents the maximum allowed value of the perception error in the iteration process, PE max and PE min represent the maximum and minimum values of the predation efficiency, respectively 0.5 and 0.

[0162] Step 4.13: Perform iterative updates, repeat step 4.9 to update the position of each individual, repeat step 4.6 to calculate the fitness value, update the individual with low fitness value until the iteration is completed.

[0163] Step 4.14: Complete the iteration, select the individual with the lowest fitness value as the optimal w and b.

[0164] Step 4.15: Configure the optimal w and b into the ELM model, perform traffic flow prediction, and visualize it through the interactive map.

[0165] The prediction results of traffic flow, speed and density information in the future period of time can be intuitively displayed through the interactive map, and the user can interact with it; the evaluation indicators of the prediction results include MAE, RMSE and MAPE, the calculation formulas are as follows:

[0166]

[0167] The application creatively proposes a traffic flow prediction method based on GAT and improved PKO-ELM algorithm, which can be applied to various scenarios to improve the management ability and efficiency of urban traffic systems. For example, in the intelligent traffic signal control system, the method can dynamically adjust the red and green light duration according to the traffic flow changes in the future period of time, effectively alleviating the congestion situation of urban trunk roads and intersections; in the real-time road condition information release system, through mobile applications or vehicle navigation, the method can provide real-time road condition information to drivers, helping pedestrians choose the best path during daily commuting or holiday travel peak period; in addition, in emergency response and disaster management, the prediction method can quickly evaluate and predict the traffic state changes in the affected areas after a sudden event, helping emergency departments to develop evacuation plans and resource allocation schemes, and improving the efficiency of responding to natural disasters or major accidents. These application scenarios demonstrate the important role of this technology in optimizing urban traffic management and improving public safety.

Claims

1. A traffic flow prediction method based on GAT and an improved PKO-ELM algorithm, characterized in that, Includes the following steps: Step 1: Collect and determine real-time and historical traffic flow datasets, including traffic volume F, average speed V, and density D for road segments, as well as calculate the congestion index C, and preprocess the data; Step 2: Construct the traffic road map into a graph structure, where nodes represent road segments and edges represent the connection relationships between road segments, and construct the node feature matrix X and the adjacency matrix A; Step 3: Use the node feature matrix X and the adjacency matrix A as inputs to the graph attention network GAT to update and aggregate features. Dynamically assign different weights to neighboring nodes through the attention mechanism to extract the spatial features of the nodes and finally obtain the updated node feature matrix H. Step 4: Using the obtained feature matrix H as input, construct a model that combines the improved Kingfisher Optimization Algorithm PKO with Extreme Learning Machine (ELM), namely the PKO-ELM model, for traffic flow prediction. The improved Kingfisher Optimization Algorithm PKO uses a back-learning strategy for population initialization. Step 4.1: Initialize the basic parameters of the PKO algorithm, setting the population size M, the number of iterations B, and the problem dimension Dim; Step 4.2: Population Initialization. PKO randomly generates a population of N individuals from the search space. Each individual X represents a set of weights w and biases b. The equation used to generate the initial population is as follows: w i =(UB w -LB w )×rand+LB w b i =(UB b -LB b )×rand+LB b Where i refers to the i-th individual, w i b i Let represent the weight and bias of the i-th individual, and rand be a random number uniformly distributed in the interval [0,1]. UB w and LB w It is the upper and lower bounds of the weight w, UB b and LB b These are the upper and lower bounds of the bias b; Step 4.3: Calculate the output of the ELM hidden layer, using the i-th individual X. i weight w i and bias b i To configure ELM, the output matrix O of the hidden layer is calculated using the activation function. The calculation formula is as follows: O=σ(Hw i +b i ) Where σ(·) is the Sigmoid activation function, H is the node feature matrix after GAT processing, and w i b i Represents the weight and bias of the i-th individual; Step 4.4: Calculate the weight matrix W of the ELM output layer. o Based on the mathematical knowledge of Moore-Penrose generalized inverse matrices, solve for the generalized matrix W. o The calculation formula is as follows: W o =(O τ O) -1 O τ t Among them, (O) Τ O) -1 O τ Let O be the Moore-Penrose generalized inverse of matrix O. τ It is the transpose of matrix O, (O τ O) -1 It is O τ The inverse matrix of O, where t is the sample label; Step 4.5: Calculate the predicted output The calculation formula is as follows: Step 4.6: Calculate the fitness value, using the mean squared error (MSE) as the objective function and the prediction error as the fitness value; Step 4.7: For individual X in the population i Calculate its corresponding inverse solution X i The calculation formula is as follows: w i '=(UB w +LB w )×rand-w i b i '=(UB b +LB b )×rand-b i Among them, w i '、b i ' represents the weights and biases of the reverse solution for the i-th individual, rand is a random number uniformly distributed in the interval [0,1], UB w and LB w It is the upper and lower bounds of the weight w, UB b and LB b These are the upper and lower bounds of the bias b; Step 4.8: Calculate the fitness values ​​of the original individuals and their reverse solutions. Repeat steps 4.2-4.6 and update the Q solutions with lower fitness values ​​as the final initial population. Step 4.9: For each individual in the initial population Q, execute the three phases of the PKO algorithm, including the exploration phase, the development phase, and the local escape phase; Step 4.10: Exploration Phase. This phase simulates the behavior of a kingfisher searching for potential prey. The optimal solution is found by changing the position of the current solution. The update formula for the current position is: X i (t+1)=X i (t)+α*T×(X j (t)-X i (t)),i,j=1,2,...N and j≠i α = 2*randn(1,Dim)-1 Among them, X i (t) is the position of the current individual at iteration t, X i (t+1) is the position of the next iteration, α is the step size parameter, calculated as 2×randn(1,Dim)-1, where randn(1,Dim) represents a random number drawn from a normal distribution, and T is a dynamically determined parameter whose value depends on the current strategy used, which is either a resting strategy or a hovering strategy. The formula for calculating the habitat strategy T parameter is as follows: Crest_angles = 2 * pi * rand Where Max_Iter is the maximum number of iterations, pi represents pi, and the constant value BF is set to 8; The formula for calculating the hovering strategy parameter T is as follows: Where PKO_Fitness(j) and PKO_Fitness(i) represent the fitness values ​​of the i-th and j-th kingfishers, respectively, and the constant value BF is set to 8; Step 4.11: In the development phase, the found feasible solutions are further improved through local search. The position update calculation formula is as follows: X i (t+1)=X i (t)+HA*U*α*(b-X best (t)),i=1,2,...N b=X i (t)+U 2 *randn*X best (t) Among them, X i (t) is the position of the current individual at iteration t, X i (t+1) is the position of the next iteration, α is the step size parameter, b represents the fitness influence parameter, Max_Iter is the maximum number of iterations, Best_Fitness represents the best fitness value obtained in all iterations, and X best (t) represents the optimal position of all individuals in the current iteration; Step 4.12: Local escape phase, promoting information sharing within the population and avoiding premature convergence. The position update formula is as follows: Two individuals are randomly selected from the population, and their positions are denoted by X. m (t) and X n (t) indicates that abs() is an absolute value function, PE represents the predation efficiency of the kingfisher, and PE MAX PE represents the maximum permissible value of the perceived error during the iteration process. max and PE min These represent the maximum and minimum predation efficiency, which are 0.5 and 0, respectively. Step 4.13: Perform iterative updates. Repeat step 4.9 to update the position of each individual, repeat step 4.6 to calculate the fitness value, and update and retain individuals with low fitness values ​​until the iteration ends. Step 4.14: Complete the iteration and select the individual with the lowest fitness value as the optimal w and b; Step 4.15: Configure the optimal w and b into the ELM model to predict traffic flow; Step 4.16: Display the prediction results to the user using a visualization map.

2. The traffic flow prediction method based on GAT and the improved PKO-ELM algorithm according to claim 1, characterized in that, The specific method for preprocessing in step 1 is as follows: Step 1.1: Collect and determine real-time and historical traffic flow datasets. Use traffic sensors and electronic maps to obtain traffic datasets for road network segments. The datasets include the traffic volume F and average speed of each road segment. and density D; Step 1.2: Calculate the congestion index C of the road segment. The congestion index C can be calculated based on the traffic flow F and the average speed V. The calculation formula is as follows: Where F is the traffic volume of the road segment, and C road Road capacity refers to the maximum flow rate a road can handle under ideal conditions. V is the average speed of a vehicle on a road segment. f It is free-flow speed, which is the average speed of a vehicle traveling in the absence of congestion. Step 1.3: Data preprocessing includes imputing missing values, exponentially smoothing the data, and normalizing the data; Step 1.4: Imputing Missing Values. Interpolation is used to handle missing values ​​in the data. Missing values ​​are estimated by utilizing the relationships between known data points to ensure the integrity and continuity of the data. Exponential smoothing is used to smooth the data and reduce noise. Max-min normalization is used to normalize the data by scaling the feature values ​​to a fixed range between 0 and 1.

3. The traffic flow prediction method based on GAT and the improved PKO-ELM algorithm according to claim 1, characterized in that, The specific method for step 2 is as follows: Step 2.1: Create a graph structure, treating each road segment as a node in the graph. If there is a road connection between two nodes, create an edge between them. The graph structure is represented as G(V,E), where V represents the set of road segments (l1, l2, ... l). N ), where l N This represents the Nth road segment, where N is the total number of road segments, and E represents the connection relationship between the road segments. Step 2.2: Define node features x, including features of each road segment, such as traffic flow F and average speed. Density D and congestion index C; Step 2.3: Node feature vector x of road segment i i Represented as: Among them, F i It is the actual traffic volume of road segment i. The average speed of vehicles on road segment i is given by the density D of road segment i. i The congestion index C of road segment i i i takes values ​​from 1 to N, and τ is the vector transpose; Step 2.4: Obtain the node feature matrix X for all road segments as follows: Step 2.5: The adjacency matrix A describes the proximity relationship between road segment i and road segment j, and is calculated using a Gaussian function of distance, as shown in the following formula: Where, d ij d represents the Euclidean distance between road segment i and road segment j, σ represents the standard deviation parameter, and d represents the distance between road segment i and road segment j. max Indicates the maximum distance between road segments; Step 2.6: Obtain the adjacency matrix A:

4. The traffic flow prediction method based on GAT and the improved PKO-ELM algorithm according to claim 1, characterized in that, The specific method for step 3 is as follows: Step 3.1: Initialization: Set the initial node feature matrix H (0) = X and adjacency matrix A, where X∈R N×Z N represents the total number of road segments, Z represents the feature dimension of each road segment node, and represents the four feature traffic flows F of each road segment node. i Average speed Density D i and congestion index C i Adjacency matrix A∈R N×N Indicates the connection relationship between road segment nodes; Step 3.2: Feature Dimension Transformation: For each road segment node i, a high-dimensional representation is generated for each node through a linear transformation. For the node feature vector x of road segment i... i Its characteristic transformation is represented as W·x i , where W is a weight matrix used to obtain stronger feature representations; Step 3.3: Calculate the attention coefficient: For each road segment node i and its neighboring road segment node j, calculate the attention coefficient e. ij The calculation formula is as follows: e ij =LeakyReLU(a Τ [W x i ||W x j ]) Among them, a T is the learnable parameter of the attention mechanism, || represents the vector concatenation operation, and LeakyReLU is an improved modified linear unit used to solve the problem that the standard ReLU outputs zero when the input value is negative; Step 3.4: Normalize the attention coefficient: Use the softmax function for normalization, the calculation formula is as follows: Where, N (i) It is the set of neighboring nodes of node i in road segment; Step 3.5: Feature Aggregation: Based on the normalized attention coefficients from Step 3.4, a multi-head attention mechanism is used to aggregate features from the neighboring nodes of each target node, resulting in the final node feature vector h. i The calculation formula is as follows: Where σ(·) is the ReLU activation function, and k represents the number of layers in the attention network. W represents the normalized attention coefficient calculated by the v-th attention mechanism. v This is the corresponding weight matrix; Step 3.6: Generate a new node feature matrix: Repeat steps 3.2-3.5, using a k-layer attention network to combine the new features of all road segment nodes N into a new node feature matrix H, where H = (h1 h2…h i …h N ) τ This refers to the node feature representation after GAT processing.

Citation Information

Patent Citations

  • A Spark-Based Deep Learning Method for Data-Driven Traffic Flow Forecasting

    AU2020102350A4

  • Short-term traffic flow prediction model based on firework differential evolution hybrid algorithm-extreme learning machine

    CN112115754A