[go: up one dir, main page]

CN117994986B - A traffic flow prediction optimization method based on intelligent optimization algorithm - Google Patents

A traffic flow prediction optimization method based on intelligent optimization algorithm Download PDF

Info

Publication number
CN117994986B
CN117994986B CN202410404518.5A CN202410404518A CN117994986B CN 117994986 B CN117994986 B CN 117994986B CN 202410404518 A CN202410404518 A CN 202410404518A CN 117994986 B CN117994986 B CN 117994986B
Authority
CN
China
Prior art keywords
electric eel
eel
optimization algorithm
neural network
electric
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410404518.5A
Other languages
Chinese (zh)
Other versions
CN117994986A (en
Inventor
袁一凡
贾皓强
桂文豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yuezheng Testing And Certification Technology Co ltd
Beijing Jiaotong University
Original Assignee
Yuezheng Testing And Certification Technology Co ltd
Beijing Jiaotong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yuezheng Testing And Certification Technology Co ltd, Beijing Jiaotong University filed Critical Yuezheng Testing And Certification Technology Co ltd
Priority to CN202410404518.5A priority Critical patent/CN117994986B/en
Publication of CN117994986A publication Critical patent/CN117994986A/en
Application granted granted Critical
Publication of CN117994986B publication Critical patent/CN117994986B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/01Detecting movement of traffic to be counted or controlled
    • G08G1/0104Measuring and analyzing of parameters relative to traffic conditions
    • G08G1/0125Traffic data processing
    • G08G1/0129Traffic data processing for creating historical data or processing based on historical data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/004Artificial life, i.e. computing arrangements simulating life
    • G06N3/006Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/065Traffic control systems for road vehicles by counting the vehicles in a section of the road or in a parking area, i.e. comparing incoming count with outgoing count

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本发明公开了一种基于智能优化算法的交通车流量预测优化方法,涉及车流量预测领域,包括:S1、对影响车流量的关键影响因素分析并对关键影响因素数据采集,进行数据预处理;S2、将影响车流量的关键数据集按训练集、测试集、验证集划分,使用滑动窗口技术将训练数据集输入到BP神经网络模型;S3、改进电鳗觅食优化算法的迁移阶段的位置更新策略;S4、改进电鳗觅食优化算法的寻优机制;S5、利用改进的电鳗觅食优化算法对BP神经网络的初始权重和阈值寻优,建立加强BP神经网络模型;S6、将步骤S2的测试集与验证集输入到加强BP神经网络模型中,同时对输出结果进行反标准化处理得到车流量预测数据,提高车流量预测的准确性。

The invention discloses a traffic vehicle flow prediction optimization method based on an intelligent optimization algorithm, which relates to the field of vehicle flow prediction, and comprises the following steps: S1, analyzing key influencing factors affecting vehicle flow and collecting data of key influencing factors, and performing data preprocessing; S2, dividing a key data set affecting vehicle flow into a training set, a test set, and a validation set, and inputting the training data set into a BP neural network model by using a sliding window technology; S3, improving a position update strategy in a migration phase of an electric eel foraging optimization algorithm; S4, improving an optimization mechanism of an electric eel foraging optimization algorithm; S5, optimizing the initial weights and thresholds of a BP neural network by using the improved electric eel foraging optimization algorithm, and establishing an enhanced BP neural network model; S6, inputting the test set and the validation set of step S2 into the enhanced BP neural network model, and performing de-standardization processing on the output result to obtain vehicle flow prediction data, so as to improve the accuracy of vehicle flow prediction.

Description

一种基于智能优化算法的交通车流量预测优化方法A traffic flow prediction optimization method based on intelligent optimization algorithm

技术领域Technical Field

本发明属于车流量预测领域,具体涉及一种基于智能优化算法的交通车流量预测优化方法。The present invention belongs to the field of vehicle flow prediction, and in particular relates to a traffic vehicle flow prediction optimization method based on an intelligent optimization algorithm.

背景技术Background technique

通过对未来车流量的预测,可以更准确地了解道路网络的运行状况,从而进行更为科学的交通规划和资源配置,同时,车流量预测有助于预测交通拥堵和交通事故的风险,对于现在流程的网约车来说,车流量预测可以提供实时的交通信息,帮助他们规划更为合理的出行路径和时间,这不仅可以减少出行者的等待时间和拥堵成本,还可以提升城市交通的出行效率和舒适度,最后,对未来车流量的预测可以实现更为精准和高效的交通管理和服务,推动智能交通的快速发展。By predicting future traffic flow, we can more accurately understand the operating conditions of the road network, thereby conducting more scientific traffic planning and resource allocation. At the same time, traffic flow forecasts help predict the risks of traffic congestion and traffic accidents. For the current online car-hailing process, traffic flow forecasts can provide real-time traffic information to help them plan more reasonable travel routes and times, which can not only reduce travelers' waiting time and congestion costs, but also improve urban traffic efficiency and comfort. Finally, predictions of future traffic flow can achieve more accurate and efficient traffic management and services, and promote the rapid development of intelligent transportation.

现有的交通车流量预测技术多种多样,它们主要基于不同的数据收集和分析方法,以实现对未来车流量的准确预测,通过建立数学或统计模型来预测交通量。这些模型可以是传统的线性模型,如线性回归模型,也可以是非线性模型,如支持向量机、神经网络等。模型的选择和建立需要基于具体的交通流量数据和预测需求。There are many existing traffic flow prediction technologies, which are mainly based on different data collection and analysis methods to achieve accurate prediction of future traffic flow, and predict traffic volume by establishing mathematical or statistical models. These models can be traditional linear models, such as linear regression models, or nonlinear models, such as support vector machines, neural networks, etc. The selection and establishment of the model needs to be based on specific traffic flow data and prediction requirements.

反向传播神经网络(BP)是一种有监督的学习算法,具有很强的自适应、自学习、非线性映射能力,能较好地解决数据少、信息贫、不确定性问题,且不受非线性模型的限制,是目前应用最广泛的神经网络模型之一,常用于时序数据回归预测等问题。但在危险化学品生产风险预测领域应用较少。Back propagation neural network (BP) is a supervised learning algorithm with strong adaptive, self-learning and nonlinear mapping capabilities. It can better solve the problems of small data, poor information and uncertainty, and is not limited by nonlinear models. It is one of the most widely used neural network models and is often used for time series data regression prediction and other problems. However, it is less used in the field of hazardous chemical production risk prediction.

BP神经网络是一种基于局部搜索的算法,在训练过程中,网络的权重通过逐步改善目标函数值的方式进行调整,容易陷入局部极小值,导致权重收敛到局部最小值而无法继续优化;且BP神经网络的初始化权值和阈值随机产生,对收敛速度和精度有较大影响。利用优化算法对神经网络的初始权重和阈值进行寻优是一种有效的方法,这种方法可以在神经网络训练前先通过优化算法来确定网络的初始权重和阈值,找到最优的权重和阈值组合,以达到更好的神经网络模型效果。BP neural network is an algorithm based on local search. During the training process, the weight of the network is adjusted by gradually improving the value of the objective function, which is easy to fall into the local minimum, causing the weight to converge to the local minimum and unable to continue to optimize; and the initial weights and thresholds of the BP neural network are randomly generated, which has a great impact on the convergence speed and accuracy. Using optimization algorithms to optimize the initial weights and thresholds of the neural network is an effective method. This method can determine the initial weights and thresholds of the network through optimization algorithms before training the neural network, and find the optimal weight and threshold combination to achieve a better neural network model effect.

电鳗觅食优化算法(EEFO),EEFO从自然界中电鳗鱼的智能群体觅食行为中获得灵感,该算法数学建模了四种关键的觅食行为:互动、休息、狩猎和迁移,以在优化过程中提供探索和利用;目前算法的收敛速度较慢,特别是在处理复杂问题或高维空间中;此外,电鳗觅食优化算法容易陷入局部最优解,而难以逃离,当被困在局部最优解附近时,无法发现全局最优解。Electric Eel Foraging Optimization Algorithm (EEFO), EEFO draws inspiration from the intelligent group foraging behavior of electric eels in nature. The algorithm mathematically models four key foraging behaviors: interaction, rest, hunting, and migration to provide exploration and utilization in the optimization process; the current algorithm converges slowly, especially when dealing with complex problems or high-dimensional spaces; in addition, the electric eel foraging optimization algorithm is prone to fall into local optimal solutions and is difficult to escape. When trapped near the local optimal solution, the global optimal solution cannot be found.

发明内容Summary of the invention

本发明的目标为:通过改进的电鳗觅食优化算法,提高电鳗觅食优化算法的寻优精度和全局寻优速度,利用电鳗觅食优化算法对BP神经网络的初始权重和阈值寻优,避免模型陷入局部极小值,同时提升BP神经网络模型的收敛速度和精度,提出一种改进的BP神经网络预测模型,提高交通车流量预测的准确度。The objective of the present invention is to improve the optimization accuracy and global optimization speed of the electric eel foraging optimization algorithm through an improved electric eel foraging optimization algorithm, optimize the initial weights and thresholds of the BP neural network using the electric eel foraging optimization algorithm to avoid the model falling into a local minimum, and at the same time improve the convergence speed and accuracy of the BP neural network model, and propose an improved BP neural network prediction model to improve the accuracy of traffic flow prediction.

本发明为实现上述目标所采用的技术方案是:The technical solution adopted by the present invention to achieve the above-mentioned object is:

一种基于智能优化算法的交通车流量预测优化方法,包括改进的电鳗觅食优化算法和BP神经网络模型,利用改进的电鳗觅食优化算法对BP神经网络的初始权重和阈值进行寻优,提高交通车流量预测的准确度,具体步骤为。A traffic flow prediction optimization method based on an intelligent optimization algorithm includes an improved electric eel foraging optimization algorithm and a BP neural network model. The improved electric eel foraging optimization algorithm is used to optimize the initial weights and thresholds of the BP neural network to improve the accuracy of traffic flow prediction. The specific steps are as follows.

S1、对影响车流量的关键影响因素分析,并对关键影响因素数据采集,进行数据预处理。S1. Analyze the key factors affecting traffic flow, collect data on key factors, and perform data preprocessing.

S2、将影响车流量的关键数据集按训练集、测试集、验证集的方式划分,并使用滑动窗口技术将训练数据集输入到BP神经网络模型。S2. Divide the key data sets that affect traffic flow into training sets, test sets, and validation sets, and use the sliding window technology to input the training data sets into the BP neural network model.

S3、在电鳗觅食优化算法的迁移阶段融合冠豪猪优化器的第四防御机制,改进电鳗觅食优化算法的迁移阶段的位置更新策略。S3. The fourth defense mechanism of the crown porcupine optimizer is integrated into the migration phase of the electric eel foraging optimization algorithm to improve the position update strategy of the migration phase of the electric eel foraging optimization algorithm.

S4、当电鳗觅食优化算法各阶段位置更新均结束后,引入随机变异扰动策略,改进电鳗觅食优化算法的寻优机制。S4. After the position updates of each stage of the electric eel foraging optimization algorithm are completed, a random mutation perturbation strategy is introduced to improve the optimization mechanism of the electric eel foraging optimization algorithm.

S5、根据影响车流量的关键数据的特征变量和目标变量构建BP神经网络,利用改进的电鳗觅食优化算法对BP神经网络的初始权重和阈值寻优,建立加强的BP神经网络模型。S5. Construct a BP neural network based on the characteristic variables and target variables of the key data affecting the traffic flow, use the improved electric eel foraging optimization algorithm to optimize the initial weights and thresholds of the BP neural network, and establish an enhanced BP neural network model.

S6、将步骤S2的测试集与验证集输入到加强的BP神经网络模型中,同时对输出结果进行反标准化处理得到车流量预测数据。S6. Input the test set and validation set of step S2 into the enhanced BP neural network model, and perform de-standardization on the output results to obtain traffic flow prediction data.

进一步的,所述步骤S1中,所述影响车流量的关键因素数据包括以下变量,分别为:历史的车流量、历史节假日以及早晚高峰的车流量数据、当天的天气数据和加油站、停车场、公交车站、地铁站交通设施的分布和容量数据。Furthermore, in step S1, the key factor data affecting traffic flow include the following variables: historical traffic flow, historical holidays and traffic flow data during peak hours, weather data of the day, and distribution and capacity data of transportation facilities such as gas stations, parking lots, bus stations, and subway stations.

进一步的,所述步骤S1中,采用肯德尔秩相关系数法(Kendall RankCorrelation)对影响交通车流量的关键因素数据进行相关性分析,相关性系数公式如下:Furthermore, in step S1, the Kendall Rank Correlation method is used to perform correlation analysis on the key factor data affecting traffic flow. The correlation coefficient The formula is as follows:

;

式中,为车流量数据集中的预测值数量,为第一个数据集中的两个排 名,为第二个数据集中相应的排名,为符号函数,如果,则函数值为1,函数值为-1,否则,函数值为 0。 In the formula, is the number of predicted values in the traffic flow dataset, and For the two rankings in the first dataset, and is the corresponding ranking in the second dataset, is a symbolic function, if ,but The function value is 1. but The function value is -1, otherwise, The function value is 0.

进一步的,将历史的车流量、历史节假日以及早晚高峰的车流量数据、当天的天气数据和加油站、停车场、公交车站、地铁站交通设施的分布和容量数据作为特征变量制作数据集,同时对数据集进行预处理,利用补差众数法和四分位差规则对数据缺失值和异常值进行补齐和剔除,采用最大—最小标准化处理公式如下,使用线性变换将样本数据压缩在0到1之间:Furthermore, historical traffic volume, historical holidays and traffic volume data during morning and evening rush hours, the weather data of the day, and the distribution and capacity data of transportation facilities such as gas stations, parking lots, bus stations, and subway stations are used as feature variables to create a data set. At the same time, the data set is preprocessed, and the missing values and outliers are filled and eliminated using the supplementary mode method and the interquartile range rule. The maximum-minimum standardization processing formula is used as follows, and the sample data is compressed between 0 and 1 using linear transformation:

;

式中,为第个输入变量归一化后的数据,范围(0,1);为检验数据, 为数据样本最小值,为数据样本最大值。 In the formula, For the The data after normalization of the input variables, range (0, 1); To test the data, is the minimum value of the data sample, is the maximum value of the data sample.

进一步的,所述步骤S2中,将数据集按6:2:2的比例划分训练集、测试集、验证集, 若车流量数据集数量为的时间序列Furthermore, in step S2, the data set is divided into a training set, a test set, and a validation set in a ratio of 6:2:2. If the number of vehicle flow data sets is Time Series ;

式中,为数据集第时刻车流量值,为当前时刻数据集的车流量值。 In the formula, For the dataset Traffic flow value at the moment, is the traffic flow value of the dataset at the current moment.

进一步的,在进行车流量预测时,根据滑动窗口的大小及滑动步长,将 车流量数据集的历史数据值切分成若干子序列,再依次输入模型中。 Furthermore, when predicting traffic flow, the size of the sliding window and sliding step length , the traffic flow dataset The historical data values are divided into several subsequences and then input into the model one by one.

进一步的,所述步骤S3中,改进的电鳗觅食优化算法的迁移阶段的位置更新策略为:Furthermore, in step S3, the position update strategy of the migration phase of the improved electric eel foraging optimization algorithm is:

(1); (1);

式中,为第次迭代时,第只电鳗的位置;为第次迭代时,第 只电鳗的位置;为第次迭代,改进的电鳗觅食优化算法种群中电鳗的最优位置; 为收敛速度因子;为区间[0,1]内的一个随机值,满足+=1;为+1和-1两 者的随机值;为当前第只鳗鱼位置的适应度值,为改进的电鳗防御因子,数学模 型公式为: In the formula, For the At the iteration, The location of the electric eel; For the At the iteration, The location of the electric eel; For the The optimal position of the electric eels in the population of the improved electric eel foraging optimization algorithm in the iteration; is the convergence speed factor; and is a random value in the interval [0,1], satisfying + =1; A random value of +1 or -1; For the current The fitness value of each eel position, For the improved electric eel defense factor, the mathematical model formula is:

;

式中,为改进的电鳗觅食优化算法的当前迭代次数,为在0到1之间随机 生成的数值,为第次迭代时,最差的电鳗的位置,为当前迭代第只电鳗的位 置的适应度值,为第次迭代时,最差的电鳗的位置的适应度值。 In the formula, is the current iteration number of the improved electric eel foraging optimization algorithm, is a randomly generated value between 0 and 1. For the At the iteration, the worst position of the electric eel is For the current iteration The fitness value of the electric eel's position, For the The fitness value of the worst electric eel position at the iteration.

进一步的,最差的电鳗的位置为第次迭代时,电鳗种群中适应度值最大 的电鳗位置。 Further, the worst electric eel position For the At the iteration, the position of the electric eel with the largest fitness value in the electric eel population.

进一步的,融合冠豪猪优化器的第四防御机制改进后的电鳗觅食优化算法在迭代 后期,最优值收敛速度更快且不容易陷入布局最优,改进的电鳗防御因子非线性变化, 在迭代前期初始时,电鳗防御因子最大值为2,最小值为0,随迭代次数的增加,电鳗防御因 子先缓慢减小,后期快速减小,有利于改进后的电鳗觅食优化算法的迁移阶段的位置更新 策略跳出局部最优解。 Furthermore, the electric eel foraging optimization algorithm improved by integrating the fourth defense mechanism of the crown porcupine optimizer converges to the optimal value faster in the later iteration and is not easy to fall into the layout optimality. The improved electric eel defense factor Nonlinear changes. At the beginning of the iteration, the maximum value of the electric eel defense factor is 2 and the minimum value is 0. With the increase of the number of iterations, the electric eel defense factor decreases slowly at first and then decreases rapidly in the later stage, which is conducive to the position update strategy of the migration stage of the improved electric eel foraging optimization algorithm to jump out of the local optimal solution.

进一步的,所述步骤S4,改进的电鳗觅食优化算法的寻优机制为:在改进的电鳗觅食优化算法的每代寻优过程后期,当改进的电鳗觅食优化算法各阶段位置更新均结束后,在当前种群中任选一个电鳗个体进行随机变异扰动,变异的个体存入种群,用于下一轮算法迭代,随机变异扰动策略数学模型为:Furthermore, in step S4, the optimization mechanism of the improved electric eel foraging optimization algorithm is as follows: in the late stage of each generation optimization process of the improved electric eel foraging optimization algorithm, when the position updates of each stage of the improved electric eel foraging optimization algorithm are completed, an electric eel individual is randomly selected in the current population for random mutation disturbance, and the mutated individual is stored in the population for the next round of algorithm iteration. The mathematical model of the random mutation disturbance strategy is:

(2); (2);

式中,为当前迭代次数时,扰动后的电鳗位置;为随机选取 需要变异个体在种群中的索引及变异维度索引,为改进的电鳗觅食优化算法的寻优下 限;为改进的电鳗觅食优化算法的寻优上限。 In the formula, is the position of the electric eel after disturbance at the current iteration number; and To randomly select the index of the individual that needs to be mutated in the population and the mutation dimension index, The lower bound of the improved electric eel foraging optimization algorithm; The optimal upper limit of the improved electric eel foraging optimization algorithm.

进一步的,在种群中随机选取需要变异个体进行变异,使得下次迭代时,在改进的电鳗觅食优化算法寻优范围内产中新的个体,增加种群的丰富度,为改进的电鳗觅食优化算法提供更多的寻优选择的同时避免了改进的电鳗觅食优化算法陷入局部最优的问题。Furthermore, individuals that need to be mutated are randomly selected from the population for mutation, so that in the next iteration, new individuals are produced within the optimization range of the improved electric eel foraging optimization algorithm, thereby increasing the richness of the population, providing more optimization options for the improved electric eel foraging optimization algorithm while avoiding the problem of the improved electric eel foraging optimization algorithm falling into local optimality.

进一步的,所述步骤S5,利用改进的电鳗觅食优化算法对BP神经网络的初始权重和阈值寻优,建立加强的BP模型的具体步骤为:Furthermore, in step S5, the specific steps of optimizing the initial weights and thresholds of the BP neural network using the improved electric eel foraging optimization algorithm and establishing the enhanced BP model are as follows:

S51、初始化改进的电鳗觅食优化算法种群,依据神经网络权重和阈值特点,电鳗个体编码采用实数编码方法,每个电鳗个体位置由一个实数向量表示,所述实数向量由输入层、隐含层、输出层之间的权重和阈值组成;S51, initializing the population of the improved electric eel foraging optimization algorithm, according to the weight and threshold characteristics of the neural network, the electric eel individual coding adopts the real number coding method, and each electric eel individual position is represented by a real number vector, and the real number vector is composed of the weights and thresholds between the input layer, the hidden layer, and the output layer;

S52、利用加强的BP神经网络模型的实际车流量数据输出与预测车流量数据输出 之间的误差绝对值和作为改进的电鳗觅食优化算法对BP神经网络模型参数优化的适应度 函数,公式为: S52, using the absolute value of the error between the actual traffic flow data output and the predicted traffic flow data output of the enhanced BP neural network model and as the fitness function for optimizing the parameters of the BP neural network model by the improved electric eel foraging optimization algorithm , the formula is:

;

式中,为加强的BP神经网络模型的输出层节点数,为系数,分别为 输出层节点的期望车流量数据输出和预测车流量数据输出; In the formula, is the number of output layer nodes of the enhanced BP neural network model, is the coefficient, and They are the expected traffic flow data output and the predicted traffic flow data output of the output layer node respectively;

S53、计算每个电鳗个体的适应度,并根据改进的电鳗觅食优化算法位置更新策略来调整电鳗个体的位置,产生新的种群位置,通过随机变异扰动策略,按照公式(2)对种群扰动更新;S53, calculating the fitness of each electric eel individual, and adjusting the position of the electric eel individual according to the position update strategy of the improved electric eel foraging optimization algorithm to generate a new population position, and updating the population disturbance according to formula (2) through the random mutation disturbance strategy;

S54、将新产生的种群个体重新带入加强的BP神经网络模型中进行训练,再次根据训练结果计算适应度值,重复迭代,直到达到最大迭代次数,输出最优电鳗个体位置;S54, bringing the newly generated population individuals back into the enhanced BP neural network model for training, calculating the fitness value again according to the training results, repeating the iteration until the maximum number of iterations is reached, and outputting the optimal electric eel individual position;

S55、将电鳗最优个体位置,即一组最优BP神经网络的权重和阈值,作为BP神经网络的初始权重和阈值,通过反向传播算法对BP神经网络进行训练,最终得到训练好的加强的BP神经网络模型。S55. The optimal individual position of the electric eel, that is, a set of optimal BP neural network weights and thresholds, are used as the initial weights and thresholds of the BP neural network, and the BP neural network is trained through a back propagation algorithm to finally obtain a trained enhanced BP neural network model.

进一步的,改进的电鳗觅食优化算法位置更新策略,包括:改进的电鳗觅食优化算法的全局搜索和收敛开发,模拟电鳗的相互作用、休息、迁徙和狩猎行为,具体步骤为:Furthermore, the improved electric eel foraging optimization algorithm position update strategy includes: global search and convergence development of the improved electric eel foraging optimization algorithm, simulating the interaction, rest, migration and hunting behaviors of electric eels, and the specific steps are:

S531、利用电鳗搜索空间中的区域信息,与种群中其他随机选择的鳗鱼相互作用,通过确定种群中随机选择的鳗鱼和在搜索空间中随机生成的鳗鱼之间的差异来更新电鳗个体的位置,数学模型为:S531. Using the regional information in the electric eel search space, interacting with other randomly selected eels in the population, updating the position of the electric eel individual by determining the difference between the randomly selected eels in the population and the eels randomly generated in the search space, the mathematical model is:

(3); (3);

式中,为第次迭代时,第只电鳗的位置,为从当前 种群中随机选择的电鳗的位置,且不等于为权重系数,为当前电鳗种群个体 的平均位置,为取值0到1的随机数,为从当前种群中 随机选择的电鳗的位置的适应度值,为电鳗初始位置; In the formula, For the At the iteration, The location of the electric eel, and is the position of an electric eel randomly selected from the current population, and not equal to , is the weight coefficient, is the average position of the current electric eel population individuals, and is a random number ranging from 0 to 1. and is the fitness value of the position of an electric eel randomly selected from the current population, is the initial position of the electric eel;

S532、模拟电鳗休息行为,搜索合适位置休息,休息位置作为电鳗的新位置,电鳗种群的新位置的数学模型公式为:S532, simulating the resting behavior of electric eels, searching for a suitable resting position, and using the resting position as the new position of the electric eels. The mathematical model formula of the new position of the electric eel population is:

(4); (4);

式中,为第次迭代时,第只电鳗的位置;为遵循均值为0,标准 差为1的正态分布;为从当前种群中随机选择的一条鳗鱼的位置;函数为 函数用来返回最接近的整数;为电鳗搜索半径,数学模型为: In the formula, For the At the iteration, The location of the electric eel; To follow a normal distribution with a mean of 0 and a standard deviation of 1; is the position of an eel randomly selected from the current population; Function is a function used to return the nearest integer; is the search radius of the electric eel, and the mathematical model is:

;

式中,为当前迭代时的可选的休息范围;为目标休 息区域的范围;为截止到当前迭代时的全局最佳位置;为目标休息区域范 围的比例,数学模型为: In the formula, For the current iteration Optional rest range when is the range of the target rest area; As of the current iteration The global best position when is the ratio of the target rest area, and the mathematical model is:

;

式中,为目标休息区域范围的比例初值,公式为:为在0到1之间随机生成的数值; In the formula, is the initial value of the ratio of the target rest area, and the formula is: ; A randomly generated value between 0 and 1;

S533、将电鳗的迁徙和狩猎位置更新策略融合冠豪猪优化器的第四防御机制,改进后的电鳗位置更新策略如公式(1)。S533. The migration and hunting position update strategies of the electric eel are integrated with the fourth defense mechanism of the crown porcupine optimizer. The improved electric eel position update strategy is shown in formula (1).

进一步的,所述步骤S6中,加强的BP神经网络模型采用多元线性回归的预测方式,其中,BP神经网络包含输入层、隐含层和输出层,其数学表达式为:Furthermore, in step S6, the enhanced BP neural network model adopts a prediction method of multiple linear regression, wherein the BP neural network includes an input layer, a hidden layer and an output layer, and its mathematical expression is:

;

式中,为经BP神经网络预测的车流量输出值;为激活函数;为BP神经网 络输入值,输入的数据是影响车流量的关键因素数据;为隐含节点的连接权重;为隐 含节点间的阈值;为隐含节点的阈值;为隐藏节点数。 In the formula, is the traffic flow output value predicted by BP neural network; is the activation function; Input values for the BP neural network, the input data are key factors affecting traffic flow; is the connection weight of the hidden node; is the threshold between hidden nodes; is the threshold of hidden nodes; is the number of hidden nodes.

进一步的,BP神经网络陷入局部最小值的原因是由于网络的权重和阈值为随机生成导致的,其权重和阈值包含:输入层到隐含层的权值和阈值;隐含 层到输出层的权值和阈值,公式如下: Furthermore, the reason why the BP neural network falls into the local minimum is due to the weight of the network and threshold , The weights and thresholds are randomly generated, including: the weights from the input layer to the hidden layer and threshold ; The weight from hidden layer to output layer and threshold , the formula is as follows:

;

;

式中,为激活函数;为第个输入信号;为第个隐含层输出值。 In the formula, is the activation function; For the Input signal; For the Hidden layer output value.

综上所述,由于采用本技术方案,本发明的有益效果为:首次利用电鳗觅食优化算法优化BP神经网络对车流量预测,针对BP神经网络在预测上存在的不足,初次将电鳗觅食优化算法用于优化BP神经网络,同时,在电鳗觅食优化算法的迁移阶段融合冠豪猪优化器的第四防御机制,改进电鳗觅食优化算法的迁移阶段的位置更新策略,提高电鳗觅食优化算法的收敛速度和精度,进一步在电鳗觅食优化算法的每代寻优过程后期,当电鳗觅食优化算法各阶段均结束后,在当前种群中任选一个电鳗个体进行随机变异扰动,提升电鳗觅食优化算法跳出局部最优解的能力,从而提高车流量预测的准确度。To sum up, due to the adoption of the present technical scheme, the beneficial effects of the present invention are: for the first time, the electric eel foraging optimization algorithm is used to optimize the BP neural network for traffic flow prediction. In view of the shortcomings of the BP neural network in prediction, the electric eel foraging optimization algorithm is used for the first time to optimize the BP neural network. At the same time, the fourth defense mechanism of the crown porcupine optimizer is integrated in the migration stage of the electric eel foraging optimization algorithm, the position update strategy in the migration stage of the electric eel foraging optimization algorithm is improved, and the convergence speed and accuracy of the electric eel foraging optimization algorithm are improved. Further, in the later stage of each generation of the optimization process of the electric eel foraging optimization algorithm, when all stages of the electric eel foraging optimization algorithm are completed, an electric eel individual in the current population is randomly selected for random mutation disturbance, so as to enhance the ability of the electric eel foraging optimization algorithm to jump out of the local optimal solution, thereby improving the accuracy of traffic flow prediction.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1为一种基于智能优化算法的交通车流量预测优化方法流程图。FIG1 is a flow chart of a traffic flow prediction optimization method based on an intelligent optimization algorithm.

图2为改进的电鳗觅食优化算法对BP神经网络的权重和阈值寻优的流程图。Figure 2 is a flow chart of the improved electric eel foraging optimization algorithm for optimizing the weights and thresholds of the BP neural network.

图3为IEEFO-BP神经网络对车流量数据预测的流程图。FIG3 is a flow chart of the IEEFO-BP neural network for predicting traffic flow data.

图4为电鳗觅食优化算法与改进的电鳗觅食优化算法最优个体适应度值对比曲线。Figure 4 is a comparison curve of the optimal individual fitness values of the electric eel foraging optimization algorithm and the improved electric eel foraging optimization algorithm.

图5为EEFO-BP模型与IEEFO-BP模型对车流量数据预测的误差对比图。Figure 5 is a comparison of the errors of the EEFO-BP model and the IEEFO-BP model in predicting traffic flow data.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例;基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

请参阅图1-图5,本发明提供一种技术方案:Please refer to Figures 1 to 5, the present invention provides a technical solution:

一种基于智能优化算法的交通车流量预测优化方法,包括改进的电鳗觅食优化算法模型和BP神经网络,利用改进的电鳗觅食优化算法优化BP神经网络权重和阈值,提高交通车流量预测的准确度,如图1所示,具体步骤为。A traffic flow prediction optimization method based on an intelligent optimization algorithm includes an improved electric eel foraging optimization algorithm model and a BP neural network. The improved electric eel foraging optimization algorithm is used to optimize the BP neural network weights and thresholds to improve the accuracy of traffic flow prediction. As shown in Figure 1, the specific steps are as follows.

S1、对影响车流量的关键影响因素分析,并对关键影响因素数据采集,进行数据预处理。S1. Analyze the key factors affecting traffic flow, collect data on key factors, and perform data preprocessing.

S2、将影响车流量的关键数据集按训练集、测试集、验证集的方式划分,并使用滑动窗口技术将训练数据集输入到BP神经网络模型。S2. Divide the key data sets that affect traffic flow into training sets, test sets, and validation sets, and use the sliding window technology to input the training data sets into the BP neural network model.

S3、在电鳗觅食优化算法的迁移阶段融合冠豪猪优化器的第四防御机制,改进电鳗觅食优化算法的迁移阶段的位置更新策略。S3. The fourth defense mechanism of the crown porcupine optimizer is integrated into the migration phase of the electric eel foraging optimization algorithm to improve the position update strategy of the migration phase of the electric eel foraging optimization algorithm.

S4、当电鳗觅食优化算法各阶段位置更新均结束后,引入随机变异扰动策略,改进电鳗觅食优化算法的寻优机制。S4. After the position updates of each stage of the electric eel foraging optimization algorithm are completed, a random mutation perturbation strategy is introduced to improve the optimization mechanism of the electric eel foraging optimization algorithm.

S5、根据影响车流量的关键数据的特征变量和目标变量构建BP神经网络,利用改进的电鳗觅食优化算法对BP神经网络的初始权重和阈值寻优,建立加强的BP神经网络模型。S5. Construct a BP neural network based on the characteristic variables and target variables of the key data affecting the traffic flow, use the improved electric eel foraging optimization algorithm to optimize the initial weights and thresholds of the BP neural network, and establish an enhanced BP neural network model.

S6、将步骤S2的测试集与验证集输入到加强的BP神经网络模型中,同时对输出结果进行反标准化处理得到车流量预测数据。S6. Input the test set and validation set of step S2 into the enhanced BP neural network model, and perform de-standardization on the output results to obtain traffic flow prediction data.

进一步的,所述步骤S1中,所述影响车流量的关键因素数据包括以下变量,分别为:历史的车流量、历史节假日以及早晚高峰的车流量数据、当天的天气数据和加油站、停车场、公交车站、地铁站交通设施的分布和容量数据。Furthermore, in step S1, the key factor data affecting traffic flow include the following variables: historical traffic flow, historical holidays and traffic flow data during peak hours, weather data of the day, and distribution and capacity data of transportation facilities such as gas stations, parking lots, bus stations, and subway stations.

进一步的,所述步骤S1中,采用肯德尔秩相关系数法(Kendall RankCorrelation)对影响交通车流量的关键因素数据进行相关性分析,相关性系数公式如下:Furthermore, in step S1, the Kendall Rank Correlation method is used to perform correlation analysis on the key factor data affecting traffic flow. The correlation coefficient The formula is as follows:

;

式中,为车流量数据集中的预测值数量,为第一个数据集中的两个排 名,为第二个数据集中相应的排名,为符号函数,如果,则函数值为1,函数值为-1,否则,函数 值为0。 In the formula, is the number of predicted values in the traffic flow dataset, and For the two rankings in the first dataset, and is the corresponding ranking in the second dataset, is a symbolic function, if ,but The function value is 1. but The function value is -1, otherwise, The function value is 0.

进一步的,将历史的车流量、历史节假日以及早晚高峰的车流量数据、当天的天气数据和加油站、停车场、公交车站、地铁站交通设施的分布和容量数据作为特征变量制作数据集,同时对数据集进行预处理,利用补差众数法和四分位差规则对数据缺失值和异常值进行补齐和剔除,采用最大—最小标准化处理公式如下,使用线性变换将样本数据压缩在0到1之间:Furthermore, historical traffic volume, historical holidays and traffic volume data during morning and evening rush hours, the weather data of the day, and the distribution and capacity data of transportation facilities such as gas stations, parking lots, bus stations, and subway stations are used as feature variables to create a data set. At the same time, the data set is preprocessed, and the missing values and outliers are filled and eliminated using the supplementary mode method and the interquartile range rule. The maximum-minimum standardization processing formula is used as follows, and the sample data is compressed between 0 and 1 using linear transformation:

;

式中,为第个输入变量归一化后的数据,范围(0,1);为检验数据,为数据样本最小值,为数据样本最大值。 In the formula, For the The data after normalization of the input variables, range (0, 1); To test the data, is the minimum value of the data sample, is the maximum value of the data sample.

进一步的,所述步骤S2中,将数据集按6:2:2的比例划分训练集、测试集、验证集, 若车流量数据集数量为的时间序列Furthermore, in step S2, the data set is divided into a training set, a test set, and a validation set in a ratio of 6:2:2. If the number of vehicle flow data sets is Time Series ;

式中,为数据集第时刻车流量值,为当前时刻数据集的车流量值。 In the formula, For the dataset Traffic flow value at the moment, is the traffic flow value of the dataset at the current moment.

在进行车流量预测时,根据滑动窗口的大小及滑动步长,将车流量数 据集的历史数据值切分成若干子序列,再依次输入模型中。 When predicting traffic flow, according to the size of the sliding window and sliding step length , the traffic flow dataset The historical data values are divided into several subsequences and then input into the model one by one.

进一步的,所述步骤S3中,改进的电鳗觅食优化算法的迁移阶段的位置更新策略为:Furthermore, in step S3, the position update strategy of the migration phase of the improved electric eel foraging optimization algorithm is:

(1); (1);

式中,为第次迭代时,第只电鳗的位置;为第次迭代时,第 只电鳗的位置;为第次迭代,改进的电鳗觅食优化算法种群中电鳗的最优位置; 为收敛速度因子,取值为随迭代的增加,从1线性下降为0;为区间[0,1]内的一 个随机值,满足+=1;为+1和-1两者的随机值;为当前第只鳗鱼位置的适 应度值,为改进的电鳗防御因子,数学模型公式为: In the formula, For the At the iteration, The location of the electric eel; For the At the iteration, The location of the electric eel; For the The optimal position of the electric eels in the population of the improved electric eel foraging optimization algorithm in the iteration; is the convergence speed factor, and its value decreases linearly from 1 to 0 as the number of iterations increases; and is a random value in the interval [0,1], satisfying + =1; A random value of +1 or -1; For the current The fitness value of each eel position, For the improved electric eel defense factor, the mathematical model formula is:

;

式中,为改进的电鳗觅食优化算法的当前迭代次数,为在0到1之间随机 生成的数值,为第次迭代时,最差的电鳗的位置,为当前迭代第只电鳗的 位置的适应度值,为第次迭代时,最差的电鳗的位置的适应度值。 In the formula, is the current iteration number of the improved electric eel foraging optimization algorithm, is a randomly generated value between 0 and 1. For the At the iteration, the worst position of the electric eel is For the current iteration The fitness value of the electric eel's position, For the The fitness value of the worst electric eel position at the iteration.

进一步的,所述步骤S4,改进的电鳗觅食优化算法的寻优机制为:在改进的电鳗觅食优化算法的每代寻优过程后期,当改进的电鳗觅食优化算法各阶段位置更新均结束后,在当前种群中任选一个电鳗个体进行随机变异扰动,变异的个体存入种群,用于下一轮算法迭代,随机变异扰动策略数学模型为:Furthermore, in step S4, the optimization mechanism of the improved electric eel foraging optimization algorithm is as follows: in the late stage of each generation optimization process of the improved electric eel foraging optimization algorithm, when the position updates of each stage of the improved electric eel foraging optimization algorithm are completed, an electric eel individual is randomly selected in the current population for random mutation disturbance, and the mutated individual is stored in the population for the next round of algorithm iteration. The mathematical model of the random mutation disturbance strategy is:

(2); (2);

式中,为当前迭代次数时,扰动后的电鳗位置;为随机选取 需要变异个体在种群中的索引及变异维度索引,为改进的电鳗觅食优化算法的寻优下 限;为改进的电鳗觅食优化算法的寻优上限。 In the formula, is the position of the electric eel after disturbance at the current iteration number; and To randomly select the index of the individual that needs to be mutated in the population and the mutation dimension index, It is the lower bound of the optimization of the improved electric eel foraging optimization algorithm; The optimal upper limit of the improved electric eel foraging optimization algorithm.

进一步的,所述步骤S5,如图2所示,利用改进的电鳗觅食优化算法对BP神经网络的初始权重和阈值寻优,建立加强的BP模型的具体步骤为:Furthermore, in step S5, as shown in FIG2 , the specific steps of optimizing the initial weights and thresholds of the BP neural network using the improved electric eel foraging optimization algorithm and establishing the enhanced BP model are as follows:

S51、初始化改进的电鳗觅食优化算法种群,依据神经网络权重和阈值特点,电鳗个体编码采用实数编码方法,每个电鳗个体位置由一个实数向量表示,所述实数向量由输入层、隐含层、输出层之间的权重和阈值组成;S51, initializing the population of the improved electric eel foraging optimization algorithm, according to the weight and threshold characteristics of the neural network, the electric eel individual coding adopts the real number coding method, and each electric eel individual position is represented by a real number vector, and the real number vector is composed of the weights and thresholds between the input layer, the hidden layer, and the output layer;

S52、利用加强的BP神经网络模型的实际车流量数据输出与预测车流量数据输出 之间的误差绝对值和作为改进的电鳗觅食优化算法对BP神经网络模型参数优化的适应度 函数,公式为: S52, using the absolute value of the error between the actual traffic flow data output and the predicted traffic flow data output of the enhanced BP neural network model and as the fitness function for optimizing the parameters of the BP neural network model by the improved electric eel foraging optimization algorithm , the formula is:

;

式中,为加强的BP神经网络模型的输出层节点数,为系数,分别为 输出层节点的期望车流量数据输出和预测车流量数据输出; In the formula, is the number of output layer nodes of the enhanced BP neural network model, is the coefficient, and They are the expected traffic flow data output and the predicted traffic flow data output of the output layer node respectively;

S53、计算每个电鳗个体的适应度,并根据改进的电鳗觅食优化算法位置更新策略来调整电鳗个体的位置,产生新的种群位置,通过随机变异扰动策略,按照公式(2)对种群扰动更新;S53, calculating the fitness of each electric eel individual, and adjusting the position of the electric eel individual according to the position update strategy of the improved electric eel foraging optimization algorithm to generate a new population position, and updating the population disturbance according to formula (2) through the random mutation disturbance strategy;

S54、将新产生的种群个体重新带入加强的BP神经网络模型中进行训练,再次根据训练结果计算适应度值,重复迭代,直到达到最大迭代次数,输出最优电鳗个体位置;S54, bringing the newly generated population individuals back into the enhanced BP neural network model for training, calculating the fitness value again according to the training results, repeating the iteration until the maximum number of iterations is reached, and outputting the optimal electric eel individual position;

S55、将电鳗最优个体位置,即一组最优BP神经网络的权重和阈值,作为BP神经网络的初始权重和阈值,通过反向传播算法对BP神经网络进行训练,最终得到训练好的加强的BP神经网络模型。S55. The optimal individual position of the electric eel, that is, a set of optimal BP neural network weights and thresholds, are used as the initial weights and thresholds of the BP neural network, and the BP neural network is trained through a back propagation algorithm to finally obtain a trained enhanced BP neural network model.

进一步的,改进的电鳗觅食优化算法位置更新策略,包括:改进的电鳗觅食优化算法的全局搜索和收敛开发,模拟电鳗的相互作用、休息、迁徙和狩猎行为,具体步骤为:Furthermore, the improved electric eel foraging optimization algorithm position update strategy includes: global search and convergence development of the improved electric eel foraging optimization algorithm, simulating the interaction, rest, migration and hunting behaviors of electric eels, and the specific steps are:

S531、利用电鳗搜索空间中的区域信息,与种群中其他随机选择的鳗鱼相互作用,通过确定种群中随机选择的鳗鱼和在搜索空间中随机生成的鳗鱼之间的差异来更新电鳗个体的位置,数学模型为:S531. Using the regional information in the electric eel search space, interacting with other randomly selected eels in the population, updating the position of the electric eel individual by determining the difference between the randomly selected eels in the population and the eels randomly generated in the search space, the mathematical model is:

(3); (3);

式中,为第次迭代时,第只电鳗的位置,为从当前 种群中随机选择的电鳗的位置,且不等于为权重系数,为当前电鳗种群个体 的平均位置,为取值0到1的随机数,为从当前种群中 随机选择的电鳗的位置的适应度值,为电鳗初始位置; In the formula, For the At the iteration, The location of the electric eel, and is the position of an electric eel randomly selected from the current population, and not equal to , is the weight coefficient, is the average position of the current electric eel population individuals, and is a random number ranging from 0 to 1. and is the fitness value of the position of an electric eel randomly selected from the current population, is the initial position of the electric eel;

S532、模拟电鳗休息行为,搜索合适位置休息,休息位置作为电鳗的新位置,电鳗种群的新位置的数学模型公式为:S532, simulating the resting behavior of electric eels, searching for a suitable resting position, and using the resting position as the new position of the electric eels. The mathematical model formula of the new position of the electric eel population is:

(4); (4);

式中,为第次迭代时,第只电鳗的位置;为遵循均值为0,标准 差为1的正态分布;为从当前种群中随机选择的一条鳗鱼的位置;函数为 函数用来返回最接近的整数;为电鳗搜索半径,数学模型为: In the formula, For the At the iteration, The location of the electric eel; To follow a normal distribution with a mean of 0 and a standard deviation of 1; is the position of an eel randomly selected from the current population; Function is a function used to return the nearest integer; is the search radius of the electric eel, and the mathematical model is:

;

式中,为当前迭代时的可选的休息范围;为目标休 息区域的范围;为截止到当前迭代时的全局最佳位置;为目标休息区域范 围的比例,数学模型为: In the formula, For the current iteration Optional rest range when is the range of the target rest area; As of the current iteration The global best position when is the ratio of the target rest area, and the mathematical model is:

;

式中,为目标休息区域范围的比例初值,公式为:为在0到1之间随机生成的数值; In the formula, is the initial value of the ratio of the target rest area, and the formula is: ; A randomly generated value between 0 and 1;

S533、将电鳗的迁徙和狩猎位置更新策略融合冠豪猪优化器的第四防御机制,改进后的电鳗位置更新策略如公式(1)。S533. The migration and hunting position update strategy of the electric eel is integrated with the fourth defense mechanism of the crown porcupine optimizer. The improved electric eel position update strategy is shown in formula (1).

进一步的,所述步骤S6中,加强的BP神经网络模型采用多元线性回归的预测方式,其中,BP神经网络包含输入层、隐含层和输出层,其数学表达式为:Furthermore, in step S6, the enhanced BP neural network model adopts a prediction method of multiple linear regression, wherein the BP neural network includes an input layer, a hidden layer and an output layer, and its mathematical expression is:

;

式中,为经BP神经网络预测的车流量输出值;为激活函数;为BP神经网 络输入值,输入的数据是影响车流量的关键因素数据;为隐含节点的连接权重;为隐 含节点间的阈值;为隐含节点的阈值;为隐藏节点数。 In the formula, is the traffic flow output value predicted by BP neural network; is the activation function; Input values for the BP neural network, the input data are key factors affecting traffic flow; is the connection weight of the hidden node; is the threshold between hidden nodes; is the threshold of hidden nodes; is the number of hidden nodes.

进一步的,BP神经网络陷入局部最小值的原因是由于网络的权重和阈值为随机生成导致的,其权重和阈值包含:输入层到隐含层的权值和阈值;隐含 层到输出层的权值和阈值,公式如下: Furthermore, the reason why the BP neural network falls into the local minimum is due to the weight of the network and threshold , The weights and thresholds are randomly generated, including: the weights from the input layer to the hidden layer and threshold ; The weight from hidden layer to output layer and threshold , the formula is as follows:

;

;

式中,为激活函数;为第个输入信号;为第个隐含层输出值。 In the formula, is the activation function; For the Input signal; For the Hidden layer output value.

实施中,交通车流量关键影响因素相关数据来源于历史的交通数据,键影响因素 相关数据预处理后,用于电鳗觅食优化算法优化的BP模型(EEFO-BP)和改进的电鳗觅食优 化算法优化的BP模型(IEEFO-BP);Matlab仿真中,设置电鳗觅食优化算法和改进的电鳗觅 食优化算法的最大种群规模=50,最大迭代次数=20,算法寻优上界=50,算 法寻优上界=0,BP神经网络权重和阈值。 In the implementation, the data related to the key influencing factors of traffic flow are derived from historical traffic data. After preprocessing, the data related to the key influencing factors are used for the BP model optimized by the electric eel foraging optimization algorithm (EEFO-BP) and the BP model optimized by the improved electric eel foraging optimization algorithm (IEEFO-BP); in the Matlab simulation, the maximum population size of the electric eel foraging optimization algorithm and the improved electric eel foraging optimization algorithm is set. =50, maximum number of iterations =20, algorithm optimization upper bound =50, algorithm optimization upper bound =0, BP neural network weight and threshold.

如图3所示,利用得到的加强的BP神经网络模型对交通车流量关键影响因素相关数据训练,计算期望车流量预测值和实际的车流量预测值的差值,判断差值是否达到具备实际应用的效果,如果没有达到,更新BP神经网络权重和阈值,利用改进的电鳗觅食优化算法优化得到的BP神经网络权重和阈值重新对交通车流量关键影响因素相关数据训练,重复进行,最后达到实际应用的效果后,输出车流量预测结果。As shown in Figure 3, the enhanced BP neural network model is used to train the data related to the key influencing factors of traffic flow, and the difference between the expected traffic flow prediction value and the actual traffic flow prediction value is calculated to determine whether the difference has achieved the effect of practical application. If not, the BP neural network weights and thresholds are updated, and the BP neural network weights and thresholds optimized using the improved electric eel foraging optimization algorithm are used to re-train the data related to the key influencing factors of traffic flow. The process is repeated and finally, after achieving the effect of practical application, the traffic flow prediction result is output.

图4为电鳗觅食优化算法与改进的电鳗觅食优化算法最优个体适应度值对比曲 线,从图中对比,IEEFO在迭代初期相比IEEFO有更小的适应度值,说明IEEFO一开始就找到 了更优的BP神经网络的权重和阈值;IEEFO达到最低适应度的速度比EEFO快,说明 IEEFO算法的寻优速度比EEFO算法快,且IEEFO算法的适应度值比EEFO算法的更小,说明 IEEFO算法优化BP神经网络得到的权重和阈值精度更好。 Figure 4 is a comparison curve of the optimal individual fitness values of the electric eel foraging optimization algorithm and the improved electric eel foraging optimization algorithm. From the comparison in the figure, IEEFO has a smaller fitness value than IEEFO at the beginning of the iteration, indicating that IEEFO found a better weight of the BP neural network at the beginning. and threshold ; IEEFO reaches the minimum fitness faster than EEFO, which means that the optimization speed of IEEFO algorithm is faster than that of EEFO algorithm, and the fitness value of IEEFO algorithm is smaller than that of EEFO algorithm, which means that the weights obtained by IEEFO algorithm in optimizing BP neural network are and threshold Better accuracy.

图5为EEFO-BP模型与IEEFO-BP模型对交通车流量数据预测的误差对比图,IEEFO-BP在这个特定的时间序列预测任务中表现出比EEFO-BP更好的预测准确性和稳定性;同时,IEEFO-BP方法的误差更小且与目标车流量预测值更一致,而EEFO-BP在部分时刻会产生较大的预测误差,说明本专利提出的一种基于智能优化算法的交通车流量预测优化方法所具有的实际效果更优。Figure 5 is a comparison chart of the errors of the EEFO-BP model and the IEEFO-BP model in predicting traffic flow data. IEEFO-BP shows better prediction accuracy and stability than EEFO-BP in this specific time series prediction task; at the same time, the error of the IEEFO-BP method is smaller and more consistent with the target traffic flow prediction value, while EEFO-BP will produce larger prediction errors at some moments, indicating that the traffic flow prediction optimization method based on the intelligent optimization algorithm proposed in this patent has better actual effect.

Claims (3)

1. The traffic flow prediction optimization method based on the intelligent optimization algorithm is characterized by comprising the following specific steps of:
S1, analyzing key influence factors influencing traffic flow, collecting key influence factor data, and preprocessing the data;
s2, dividing a key data set influencing traffic flow in a training set, a testing set and a verification set mode, and inputting the training data set into a BP neural network model by using a sliding window technology;
S3, fusing a fourth defense mechanism of the porcupine optimizer in the migration stage of the electric eel foraging optimization algorithm, and improving a position updating strategy of the migration stage of the electric eel foraging optimization algorithm; the position updating strategy of the migration stage of the improved electric eel foraging optimization algorithm is shown in a formula (1):
In the method, in the process of the invention, The position of the ith electric eel is the t iteration; /(I)The position of the ith electric eel is the t+1th iteration; /(I)For the t iteration, the optimal position of the electric eel in the improved electric eel foraging optimization algorithm population is improved; a is a convergence speed factor; ζ 4 and ζ 5 are random values within the interval [0,1], satisfying ζ 45 =1; delta is a random value of both +1 and-1; /(I)For the fitness value of the current ith eel position, gamma t is an improved eel defense factor, and the mathematical model formula is as follows:
Wherein t is the current iteration number of the improved eel foraging optimization algorithm, rand is a value randomly generated between 0 and 1, For the t iteration, F i is the fitness value of the position of the i-th electric eel in the current iteration, and F worst is the fitness value of the position of the worst electric eel in the t iteration;
S4, introducing a random variation disturbance strategy after the position update of each stage of the electric eel foraging optimization algorithm is finished, and improving the optimizing mechanism of the electric eel foraging optimization algorithm; the improved electric eel foraging optimization algorithm comprises the following optimizing mechanisms: at the later stage of each generation of optimizing process of the improved electric eel foraging optimizing algorithm, after the position update of each stage of the improved electric eel foraging optimizing algorithm is finished, selecting one electric eel individual in the current population to carry out random variation disturbance, storing the variant individual in the population, and using the random variation disturbance strategy mathematical model as shown in a formula (2) for the next round of optimizing iteration:
Vu1,u2(t)=lbu1+rand(ubu2-lbu2);
Wherein, V u1,u2 (t) is the position of the disturbed electric eel when the current iteration times are given; u 1 and u 2 are indexes of individuals needing variation in the population at random, lb is the optimizing lower limit of the improved electric eel foraging optimizing algorithm; ub is the optimizing upper limit of the improved electric eel foraging optimizing algorithm;
s5, constructing a BP neural network according to characteristic variables and target variables of key data affecting traffic flow, optimizing initial weights and thresholds of the BP neural network by utilizing an improved electric eel foraging optimization algorithm, and constructing a reinforced BP neural network model; the specific steps of establishing the reinforced BP model are as follows:
S51, initializing an improved electric eel foraging optimization algorithm population, adopting a real number coding method according to the characteristics of the weight and the threshold value of a neural network, wherein each electric eel individual position is represented by a real number vector, and the real number vector consists of weights and threshold values among an input layer, an implicit layer and an output layer;
s52, utilizing the absolute value of the error between the actual traffic flow data output and the predicted traffic flow data output of the enhanced BP neural network model and the fitness function F for optimizing the BP neural network model parameters as an improved electric eel foraging optimization algorithm, wherein the formula is as follows:
wherein n is the number of output layer nodes of the enhanced BP neural network model, k is a coefficient, and y i and o i are respectively expected traffic flow data output and predicted traffic flow data output of the output layer nodes;
S53, calculating the fitness of each electric eel individual, adjusting the position of the electric eel individual according to an improved electric eel foraging optimization algorithm position updating strategy, generating a new population position, and updating the population disturbance according to a formula (2) through a random variation disturbance strategy;
S54, newly generated population individuals are brought into the reinforced BP neural network model again for training, fitness values are calculated again according to training results, iteration is repeated until the maximum iteration times are reached, and the optimal electric eel individual positions are output;
s55, training the BP neural network by using the optimal individual position of the electric eel, namely the weight and the threshold value of a group of optimal BP neural network as the initial weight and the threshold value of the BP neural network through a back propagation algorithm, and finally obtaining a trained reinforced BP neural network model;
s6, inputting the test set and the verification set in the step S2 into the reinforced BP neural network model, and performing inverse standardization processing on the output result to obtain vehicle flow prediction data.
2. The traffic flow prediction optimization method based on the intelligent optimization algorithm according to claim 1, wherein in the step S1, the key factor data affecting the traffic flow is in a time series data form, and the method comprises the following steps: historical traffic flow, speed, density data, historical holiday and peak traffic flow data in the morning and evening, weather data on the day, and distribution and capacity data of gas stations, parking lots, bus stops, subway station traffic facilities.
3. The traffic flow prediction optimization method based on the intelligent optimization algorithm according to claim 1, wherein the step S53, the improved electric eel foraging optimization algorithm location update strategy, comprises: the global search and convergence development of the improved electric eel foraging optimization algorithm simulate the interaction, rest, migration and hunting behaviors of the electric eels, and specifically comprises the following steps:
S531, utilizing regional information in the electric eel search space to interact with other eels randomly selected in the population, and updating the positions of electric eel individuals by determining differences between the eels randomly selected in the population and eels randomly generated in the search space, wherein a mathematical model is shown in a formula (3):
In the method, in the process of the invention, For the t+1st iteration, the i-th electric eel position, x i (t) and x j (t) are randomly selected electric eels from the current population, i is not equal to j, C is a weight coefficient,/>For the average positions of individuals in the current electric eel population, p 1 and p 2 are random numbers with values of 0 to 1, F (x i (t)) and F (x j (t)) are fitness values of the positions of the electric eels randomly selected from the current population, and x r (t) is the initial position of the electric eels;
S532, simulating the rest behavior of the electric eels, searching for a proper position for rest, wherein the rest position is used as a new position of the electric eels, and a mathematical model formula of the new position of the electric eels is shown as a formula (4):
In the method, in the process of the invention, The position of the ith electric eel is the t+1th iteration; n 2 is a normal distribution following a mean of 0 and a standard deviation of 1; x i (t) is the position of an eel randomly selected from the current population; the round function is a function used to return the nearest integer; /(I)Searching radius for electric eel, and the mathematical model is as follows:
wherein Z (t) is an optional rest range at the current iteration t; z (t) -x prey (t) is the range of the target rest area; x prey (t) is the global optimal position when it is cut off to the current iteration t; a1 is the proportion of the range of the target rest area, and the mathematical model is as follows:
a1=a0×sin(2πr);
Wherein a 0 is the proportional initial value of the target rest area range, and the formula is as follows: r is a randomly generated value between 0 and 1, and T max is the maximum iteration number;
s533, fusing migration and hunting position updating strategies of the electric eels with a fourth defense mechanism of the porcupine optimizer, wherein the improved electric eels position updating strategy is shown in a formula (1).
CN202410404518.5A 2024-04-07 2024-04-07 A traffic flow prediction optimization method based on intelligent optimization algorithm Active CN117994986B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410404518.5A CN117994986B (en) 2024-04-07 2024-04-07 A traffic flow prediction optimization method based on intelligent optimization algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410404518.5A CN117994986B (en) 2024-04-07 2024-04-07 A traffic flow prediction optimization method based on intelligent optimization algorithm

Publications (2)

Publication Number Publication Date
CN117994986A CN117994986A (en) 2024-05-07
CN117994986B true CN117994986B (en) 2024-05-28

Family

ID=90902423

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410404518.5A Active CN117994986B (en) 2024-04-07 2024-04-07 A traffic flow prediction optimization method based on intelligent optimization algorithm

Country Status (1)

Country Link
CN (1) CN117994986B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118194008A (en) * 2024-05-17 2024-06-14 贵州大学 Multi-domain feature selection method for crested porcupine driven by defense strategy fusion
CN118736528B (en) * 2024-06-28 2025-02-11 山东大学 Unmanned driving target recognition method and system based on variable structure convolutional neural network
CN118485008B (en) * 2024-07-16 2024-09-20 中国华西工程设计建设有限公司 Soil slope stability evaluation method and system
CN119441716A (en) * 2024-10-09 2025-02-14 江西耐普矿机股份有限公司 A slurry pump fault detection and life prediction system and method based on big data
CN119168157B (en) * 2024-10-11 2025-04-29 南通大学 Cold water unit load prediction method based on improved tyrannosaurus optimization neural network
CN119044104B (en) * 2024-11-04 2025-02-28 昆明理工大学 A method for predicting soil element content based on fractional-order multi-channel

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104599501A (en) * 2015-01-26 2015-05-06 大连理工大学 Traffic flow forecasting method optimizing support vector regression by mixed artificial fish swarm algorithm
CN108492568A (en) * 2018-04-25 2018-09-04 南京邮电大学 A kind of Short-time Traffic Flow Forecasting Methods based on space-time characterisation analysis
CN110414719A (en) * 2019-07-05 2019-11-05 电子科技大学 A traffic flow forecasting method based on multivariate grey model time series
WO2019228848A1 (en) * 2018-05-31 2019-12-05 Vivacity Labs Limited Traffic management system
CN111768622A (en) * 2020-06-23 2020-10-13 南通大学 A Short-term Traffic Prediction Method Based on Improved Grey Wolf Algorithm
WO2021027153A1 (en) * 2019-08-15 2021-02-18 平安科技(深圳)有限公司 Method and apparatus for constructing traffic flow data analysis model
CN114021689A (en) * 2021-09-16 2022-02-08 湖州师范学院 A Chaos Search Optimization Method for Adaptive Neural Network Traffic Flow Prediction
KR20230057558A (en) * 2021-10-22 2023-05-02 세종대학교산학협력단 Short-term traffic flow prediction method and device using deep learning

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104599501A (en) * 2015-01-26 2015-05-06 大连理工大学 Traffic flow forecasting method optimizing support vector regression by mixed artificial fish swarm algorithm
CN108492568A (en) * 2018-04-25 2018-09-04 南京邮电大学 A kind of Short-time Traffic Flow Forecasting Methods based on space-time characterisation analysis
WO2019228848A1 (en) * 2018-05-31 2019-12-05 Vivacity Labs Limited Traffic management system
CN110414719A (en) * 2019-07-05 2019-11-05 电子科技大学 A traffic flow forecasting method based on multivariate grey model time series
WO2021027153A1 (en) * 2019-08-15 2021-02-18 平安科技(深圳)有限公司 Method and apparatus for constructing traffic flow data analysis model
CN111768622A (en) * 2020-06-23 2020-10-13 南通大学 A Short-term Traffic Prediction Method Based on Improved Grey Wolf Algorithm
CN114021689A (en) * 2021-09-16 2022-02-08 湖州师范学院 A Chaos Search Optimization Method for Adaptive Neural Network Traffic Flow Prediction
KR20230057558A (en) * 2021-10-22 2023-05-02 세종대학교산학협력단 Short-term traffic flow prediction method and device using deep learning

Non-Patent Citations (7)

* Cited by examiner, † Cited by third party
Title
Electric eel foraging optimization: A new bio-inspired optimizer for engineering applications;Weiguo Zhao;Expert Systems With Applications;20231023(第238期);全文 *
Social predation in electric eels;Douglas A. Bastos;Ecology and Evolution;20211111;全文 *
一种改进的灰色神经网络交通量预测模型;陈沥;马晓旦;夏晓梅;;物流科技;20151010(第10期);全文 *
基于改进WNN的城市轨道交通客流量预测;岳小雪;郑云水;林俊亭;;计算机工程与应用;20160601(第11期);全文 *
基于改进小波神经网络的短时交通流量预测研究;曹莉;唐玲;吴浩;高祥;乐英高;;四川理工学院学报(自然科学版);20151220(第06期);全文 *
基于混合人工鱼群优化SVR的交通流量预测;姚卫红;方仁孝;张旭东;;大连理工大学学报;20151115(第06期);全文 *
改进粒子群算法优化BP神经网络的短时交通流预测;李松;刘力军;翟曼;;系统工程理论与实践;20120915(第09期);全文 *

Also Published As

Publication number Publication date
CN117994986A (en) 2024-05-07

Similar Documents

Publication Publication Date Title
CN117994986B (en) A traffic flow prediction optimization method based on intelligent optimization algorithm
CN113313947B (en) A Road Condition Evaluation Method Based on Graph Convolutional Networks for Short-Term Traffic Prediction
CN110969290A (en) A method and system for predicting runoff probability based on deep learning
CN102270309A (en) Short-term electric load prediction method based on ensemble learning
CN116721537A (en) Urban short-time traffic flow prediction method based on GCN-IPSO-LSTM combination model
CN112884236B (en) A short-term load forecasting method and system based on VDM decomposition and LSTM improvement
CN111861013A (en) A kind of power load forecasting method and device
CN113240181B (en) A method and device for rolling simulation of reservoir dispatching operation
CN114580762A (en) An error correction method for hydrological forecast based on XGBoost
CN118199061B (en) Short-term power prediction method and system for renewable energy sources
CN119090108B (en) Fixed-point area route optimization method and system for responsive public transportation service
CN116187565A (en) Office building energy consumption prediction method based on improved atomic search optimization BP network
CN114139794A (en) Prediction method of charging demand of regional public parking lot based on parking big data
CN117060408A (en) New energy power generation prediction method and system
CN108710975A (en) A kind of electric automobile load prediction technique
CN119692204B (en) A pump station regulation method, device and electronic equipment based on digital twin
CN114169585B (en) Wind power generation power prediction method based on Markov chain and combined model
CN110807508B (en) Bus Peak Load Forecasting Method Considering Complicated Meteorological Effects
CN114707422A (en) Intelligent power check method based on load prediction
CN119514786A (en) A passenger flow prediction method based on CS optimized composite neural network
CN118470972A (en) Traffic flow prediction model method based on discrete graph structure
CN118483770A (en) A wind speed prediction method for multiple wind farms with multiple features based on graph embedding and GIN-GRU
CN118211492A (en) A method for well pattern and well location optimization based on knowledge transfer
CN115994459B (en) Method, system and equipment for optimizing construction time sequence of mass power grid infrastructure projects
Tungom et al. NEO: Neural Demand Prediction and Evolutionary Optimization of EV Network Charging Infrastructure

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant