Nitrogen oxide emission prediction method and device based on IPSO-BP neural network
Through the nitrogen oxide emission prediction method based on the IPSO-BP neural network, the particle swarm algorithm is used to optimize the weights and thresholds, which solves the problem of inaccurate emission prediction in the existing technology and achieves higher prediction accuracy and more effective Diesel engine calibration.
Patent Information
- Application Number
- CN202410698504.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-23
AI Technical Summary
Existing marine diesel engines lack a nitrogen oxide emission prediction model with good generalization performance in bench tests, resulting in a large difference between the emission prediction values and actual measured values, and cannot effectively guide the calibration and adjustment of diesel engines.
A nitrogen oxide emission prediction method based on the IPSO-BP neural network is adopted, and the weights and thresholds in the neural network are optimized through the particle swarm algorithm to generate the initial population, and the learning factors and inertia weights are optimized through the optimization formula in multiple rounds of iterations. Improve the accuracy of emissions forecasts.
It significantly improves the prediction accuracy of nitrogen oxide emissions, ensures that diesel engines can meet strict emission standards, provides effective feedback adjustments, and enhances the guiding significance of bench testing.
Smart Images

Figure CN118536574A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a method and device for predicting nitrogen oxide emissions based on an IPSO-BP neural network. Background Art
[0002] When a ship is sailing within a NOX Emission Control Area (NECA), the nitrogen oxide content in the exhaust gas must meet the corresponding emission standards; when sailing outside NECA, another emission standard must be met. With the further tightening of regulations, the nitrogen oxide emission limits are further reduced. At present, the existing marine diesel engines need to undergo engine bench testing before installation. In the existing bench tests, there is a lack of emission prediction models with good generalization performance as a guide. There is a large difference between the emission prediction values obtained by the existing emission prediction models and the actual emission values obtained by actual measurements, which lacks guidance for bench testing and cannot form an effective feedback adjustment effect for the calibration of early diesel engines.
[0003] In view of this, overcoming the defects of the prior art is an urgent problem to be solved in the field of this technology. Summary of the invention
[0004] The technical problem to be solved by the present invention is how to improve the prediction accuracy of the emission prediction model for the emission amount.
[0005] The present invention adopts the following technical solution:
[0006] In a first aspect, a method for predicting nitrogen oxide emissions based on an IPSO-BP neural network is provided, comprising:
[0007] A plurality of particles with different positions and speeds are randomly generated according to all weights and thresholds in the emission prediction model to obtain an initial population;
[0008] Inputting the initial population as an input population into a first round of iteration;
[0009] Each round of iteration includes: iterating the speed and position of the particle corresponding to each individual in the input population through the optimization formula to generate a sub-population, calculating the fitness of all individuals in the sub-population, and sorting the fitness of all individuals in the sub-population to obtain the individual with the smallest fitness as the preferred individual, recording the preferred individual, sorting the fitness size of the preferred individuals in each previous round of iteration, obtaining the preferred individual with the smallest fitness as the optimal individual, and judging whether the current round of iteration meets the termination condition;
[0010] When the current iteration does not meet the termination condition, the offspring population is input as the input population into the next iteration;
[0011] When the current iteration meets the termination condition, the optimal solution of the weight and threshold is obtained according to the optimal individual;
[0012] In each round of iteration except the first round, the learning factor and inertia weight in the optimization formula are optimized according to the current round.
[0013] Preferably, the optimization formula is:
[0014] v id (t) = ωv id (t-1)+c 1 r 1 [pbest id (t-1)-p id (t-1)]+c 2 r 2 [gbest id (t-1)-p id (t-1)];
[0015] p id (t) = p id (t-1)+v id (t);
[0016] Among them, v id (t) is the velocity of the particle in the tth iteration, v id (t-1) is the velocity of the particle in the t-1th iteration, p id (t) is the position of the particle in the tth iteration, p id (t-1) is the position of the particle in the t-1th iteration, ω is the inertia weight, c 1 is the first learning factor, c 2 is the second learning factor, pbest id (t-1) is the position of the best individual in the t-1th iteration, gbest id (t-1) is the position of the best individual in the first t-1 iterations, r 1 and r 2 A random number between 0 and 1.
[0017] Preferably, the optimizing the learning factor and the inertia weight in the optimization formula according to the current round specifically includes:
[0018] Optimization of learning factors includes:
[0019] Setting a first initial learning factor, a first stop optimization factor, a second initial learning factor, and a second stop optimization factor;
[0020] In each round of iteration, before iterating the speed and position of each particle corresponding to each individual in the input population through the optimization formula, the first learning factor c of the current round is calculated according to the first initial learning factor, the first stop optimization factor and the current iteration round. 1 , the second learning factor c of the current round is calculated according to the second initial learning factor, the second stop optimization factor and the current iteration round 2 ;
[0021] The calculated first learning factor c 1 and the second learning factor c 2 It is brought into the optimization formula to iterate the speed and position of the particle corresponding to each individual in the input population.
[0022] Preferably, the first learning factor c of the current round is calculated according to the first initial learning factor, the first stop optimization factor and the current iteration round. 1 , the second learning factor c of the current round is calculated according to the second initial learning factor, the second stop optimization factor and the current iteration round 2 , including:
[0023] The first learning factor c 1 The update formula is:
[0024]
[0025] The second learning factor c 2 The update formula is:
[0026]
[0027] Among them, c 1,fir is the first initial learning factor, c 1,end is the first stopping optimization factor, c 2,fir is the second initial learning factor, c 2,end is the second stop optimization factor, t is the current iteration round, t max is the maximum number of iterations.
[0028] Preferably, the optimizing the learning factor and the inertia weight in the optimization formula according to the current round specifically includes:
[0029] The optimization of inertia weight includes:
[0030] Set the maximum inertia weight and the minimum inertia weight;
[0031] In each round of iteration, before iterating the speed and position of each particle corresponding to each individual in the input population through the optimization formula, the inertia weight ω of the current round is calculated according to the maximum inertia weight, the minimum inertia weight and the current iteration round;
[0032] The calculated inertia weight ω is introduced into the optimization formula to iterate the speed and position of the particle corresponding to each individual in the input population.
[0033] Preferably, the inertia weight ω of the current round is calculated according to the maximum inertia weight, the minimum inertia weight and the current iteration round, specifically including:
[0034] The updating formula of the inertia weight ω is:
[0035]
[0036] Among them, ω max is the maximum inertia weight, ω min is the minimum inertia weight, t is the current iteration round, t max is the maximum iteration round, and tan(·) is the tangent function.
[0037] Preferably, the step of calculating the fitness of all individuals in the offspring population specifically includes:
[0038] Obtain corresponding weights and thresholds based on individual particles;
[0039] Under the preset input conditions, the nitrogen oxide emissions are predicted by the emission prediction model corresponding to the weight and the threshold, and the prediction output of the individual under the preset input conditions is obtained;
[0040] The actual nitrogen oxide emission under the preset input conditions is measured to obtain the actual output under the preset input conditions;
[0041] Fitness calculation is performed according to the predicted output and the actual output.
[0042] Preferably, the calculation formula of the fitness is as follows:
[0043]
[0044] Among them, f is the fitness, f(x i ) is the predicted output of the i-th individual in the offspring population, y i is the actual output under the preset input conditions, and n is the number of grids.
[0045] In a second aspect, a nitrogen oxide emission prediction device based on an IPSO-BP neural network is provided, comprising at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor to execute the nitrogen oxide emission prediction method based on the IPSO-BP neural network.
[0046] In a third aspect, the present invention further provides a non-volatile computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are executed by one or more processors to complete the method described in the first aspect.
[0047] In a fourth aspect, a chip is provided, comprising: a processor and an interface, for calling and running a computer program stored in the memory from a memory, and executing the method of the first aspect.
[0048] According to a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed on a computer or a processor, the computer or the processor executes the method according to the first aspect.
[0049] In the sixth aspect, a nitrogen oxide emission prediction system based on an IPSO-BP neural network is provided, comprising a nitrogen oxide emission prediction device based on an IPSO-BP neural network as in the second aspect, and using a nitrogen oxide emission prediction method based on an IPSO-BP neural network as in the first aspect.
[0050] The present invention provides a nitrogen oxide emission prediction method and device based on an IPSO-BP neural network, which maps all weights and thresholds in an emission prediction model to positions and velocities of particles, randomly generates a plurality of particles with different positions and velocities to obtain an initial population, performs genetic iteration on the initial population through an optimization formula, obtains the optimal individual with the smallest fitness in multiple rounds of iterations, and obtains weights and thresholds with the highest prediction accuracy; wherein, in each round of iteration, the learning factor and inertia weight of the optimization formula are optimized to improve the optimization ability of the optimization formula and the prediction accuracy of the emission prediction model. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0052] Figure 1It is a method flow chart of a method for predicting nitrogen oxide emissions based on an IPSO-BP neural network provided by an embodiment of the present invention;
[0053] Figure 2 is a relationship diagram between the number of nodes in the first hidden layer and the mean square error in a nitrogen oxide emission prediction method based on an IPSO-BP neural network provided in an embodiment of the present invention;
[0054] Figure 3 It is a hierarchical relationship diagram in an emission prediction model of a nitrogen oxide emission prediction method based on an IPSO-BP neural network provided by an embodiment of the present invention;
[0055] Figure 4 It is a flow chart of a learning factor optimization method of a nitrogen oxide emission prediction method based on an IPSO-BP neural network provided by an embodiment of the present invention;
[0056] Figure 5 It is a flow chart of an inertia weight optimization method of a nitrogen oxide emission prediction method based on an IPSO-BP neural network provided by an embodiment of the present invention;
[0057] Figure 6 It is a flow chart of a fitness calculation method of a nitrogen oxide emission prediction method based on an IPSO-BP neural network provided by an embodiment of the present invention;
[0058] Figure 7 It is a comparison diagram between the predicted emission value and the actual emission value without optimizing the genetic algorithm provided by an embodiment of the present invention;
[0059] Figure 8 is a comparison diagram between the predicted emission value after optimization of the genetic algorithm and the actual emission value provided by an embodiment of the present invention;
[0060] Fig. 9 It is a schematic diagram of a nitrogen oxide emission prediction device based on IPSO-BP neural network provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0062] In the description of the present invention, the terms "inside", "outside", "longitudinal", "lateral", "upper", "lower", "top", "bottom" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present invention and do not require that the present invention must be constructed and operated in a specific orientation. Therefore, they should not be understood as limitations on the present invention.
[0063] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0064] Embodiment 1:
[0065] Embodiment 1 of the present invention provides a method for predicting nitrogen oxide emissions based on an IPSO-BP neural network, such as Figure 1 As shown, the method flow includes:
[0066] In step 101, a plurality of particles with different positions and speeds are randomly generated according to all weights and thresholds in the emission prediction model to obtain an initial population.
[0067] The application scenario of this embodiment is to establish a corresponding emission prediction model based on the particle swarm algorithm optimized neural network (Improved Particle Swarm Optimization-Back Propagation, abbreviated as: IPSO-BP) to predict the nitrogen oxide emissions of the diesel engine, which is used to calibrate various parameters of the nitrogen oxides of the diesel engine before the diesel engine is installed, so that the diesel engine can meet the existing emission standards.
[0068] Among them, the process of predicting the nitrogen oxide emissions of a diesel engine through an emission prediction model is as follows: (1) Establish an emission prediction model and set the hidden layer, nodes and transfer functions between each level in the emission prediction model. (2) Input the corresponding parameters in the engine as input to the emission prediction model. (3) Calculate and process each parameter according to the transfer function between each level to obtain the output of the emission prediction model, which is the predicted value of the nitrogen oxide emissions of the diesel engine.
[0069] In this embodiment, the weights and thresholds are the coefficients in each transfer function in the emission prediction model; in this embodiment, a set of weights and thresholds in the emission prediction model are mapped to the position vector and velocity vector of a particle, and a plurality of particles with different positions and velocities are randomly generated, so that a plurality of different sets of weights and thresholds can be obtained; different sets of weights and thresholds are applied to the emission prediction model, and the accuracy of the predicted values of nitrogen oxide emissions is different.
[0070] This embodiment uses genetic iteration to find the speed and position of the particle with the highest fitness, thereby obtaining the weight and threshold with the highest prediction accuracy, and applies them to the emission prediction model to improve the prediction accuracy of nitrogen oxide emissions.
[0071] In step 102, the initial population is input as an input population into a first round of iteration;
[0072] In step 103, each round of iteration includes: iterating the speed and position of the particle corresponding to each individual in the input population through the optimization formula to generate a descendant population, calculating the fitness of all individuals in the descendant population, and sorting the fitness of all individuals in the descendant population to obtain the individual with the smallest fitness as the preferred individual, recording the preferred individual, sorting the fitness size of the preferred individuals in each previous round of iteration, and obtaining the preferred individual with the smallest fitness as the optimal individual.
[0073] In step 104, it is determined whether the current iteration meets the termination condition.
[0074] The optimization formula is used to optimize and iterate the input population to generate a better offspring population. It should be noted that there are learning factors and inertia weights in the optimization formula. The setting of the learning factors and inertia weights will affect the convergence efficiency and optimization performance of the iteration. After the learning factors and relationship weights are set and applied, the optimization ability of the corresponding optimization formula will usually gradually decrease with the iteration process, resulting in the prediction accuracy corresponding to the optimal individual finally iterated is not ideal.
[0075] Therefore, in this embodiment, in each round of iteration except the first round, the learning factor and inertia weight in the optimization formula will be optimized according to the current round, so that the optimization ability of the optimization formula is relatively stable, ensuring that the prediction accuracy corresponding to the optimal individual in the final iteration is more ideal.
[0076] In this embodiment, the fitness is the difference between the predicted nitrogen oxide emissions and the actual nitrogen oxide emissions corresponding to each individual. The greater the difference, the greater the fitness, and the smaller the difference, the smaller the fitness.
[0077] In step 105, when the current iteration does not meet the termination condition, the offspring population is input as the input population into the next iteration.
[0078] In step 106, when the current round of iteration meets the termination condition, the optimal solution of the weight and the threshold is obtained according to the optimal individual.
[0079] In this embodiment, the termination condition may be whether the current iteration round is greater than or equal to a preset maximum iteration round. If the current iteration round is greater than or equal to the preset maximum iteration round, the iteration is judged to be completed and the current optimal individual can be output; if the current iteration round is less than the preset maximum iteration round, the iteration is judged to be not completed and the iteration needs to continue.
[0080] In this embodiment, all weights and thresholds in the emission prediction model are mapped to the positions and velocities of particles, and a plurality of particles with different positions and velocities are randomly generated to obtain an initial population. The initial population is genetically iterated through an optimization formula, and the optimal individual with the smallest fitness is obtained in multiple rounds of iterations to obtain weights and thresholds with the highest prediction accuracy. Among them, the learning factor and inertia weight of the optimization formula are optimized in each round of iteration to improve the optimization ability of the optimization formula and the prediction accuracy of the emission prediction model.
[0081] Before further explaining the corresponding process of genetic iteration, the setting of the emission prediction model of this embodiment is first introduced:
[0082] In this embodiment, when the emission of nitrogen oxides is predicted by the emission prediction model, the parameters input to the emission prediction model may be: engine load rate ES, engine speed R, driving speed V, exhaust flow F and exhaust temperature T. The above five parameters are used as the input layer, and the instantaneous emission mass of the pollutant nitrogen oxides is used as the output layer. The above emission model can be simplified as follows:
[0083] NO X =f(ES,R,V,F,T);
[0084] Among them, f is the mapping from the input layer to the output layer, which is related to the weights between neurons in each layer.
[0085] For each level of the emission prediction model, it is necessary to select a corresponding transfer function, and then calculate and process the input parameters of the emission prediction model; in this embodiment, when the first hidden layer and the second hidden layer are selected between the input layer and the output layer, the logarithmic (logsig) transfer function can be used for calculation and processing between the input layer and the first hidden layer, the linear (purelin) transfer function can be used for calculation and processing between the first hidden layer and the second hidden layer, and the purelin linear transfer function can be used for calculation and processing between the second hidden layer and the output layer. It should be noted that the weights and thresholds described in this embodiment are the weights and thresholds of the transfer functions between each level.
[0086] In this embodiment, in addition to the input layer and the output layer, it is also necessary to set the hidden layer between the input layer and the output layer, as well as the number of nodes in each hidden layer: In this embodiment, a double hidden layer can be used between the input layer and the output layer. The double hidden layer structure has better generalization ability, and the complexity and training time of the model are more appropriate. The hidden layer nodes need to take into account the prediction accuracy and operation efficiency of the model. The nodes of each hidden layer can be set by technicians in this field according to actual conditions; in this embodiment, the number of nodes at each level can be obtained according to the following formula:
[0087]
[0088] M hid =2M in +1;
[0089] Among them, M hid is the number of nodes in the first hidden layer; M in is the number of nodes in the input layer; M out is the number of nodes in the output layer; a is a constant ranging from 1 to 10, which is the adjustment constant of the network.
[0090] From the above formula, we can calculate that M hid The model is trained by increasing the number of nodes one by one, and the mean square error (MSE) of the model verification samples at different nodes is compared. By changing the number of nodes in the first hidden layer, 10 different models can be formed. Some data are selected to train the model, and the prediction error is obtained as follows: Figure 2 shown.
[0091] from Figure 2 It can be seen that when predicting the emission of nitrogen oxides, M hid The training error is smallest when it is 11; therefore, according to the above formula, it can be calculated that in this embodiment, the number of nodes in the input layer is 5, and the number of nodes in the first hidden layer is 11. Since the second hidden layer and the output layer use the same transfer function in this embodiment, the number of nodes in the second hidden layer and the number of nodes in the output layer are both 1.
[0092] like Figure 3 As shown in the figure, it is a schematic diagram of the relationship between the various levels in the emission prediction model, where α 1 ,α 2 ,…α n is the input layer, that is, different input parameters, β 1 ,β 2 ,…β m is each hidden layer, P represents the transfer function between each parameter in the input layer and each hidden layer, δ 1 ,δ2 ,…δ t is the output layer, and Q represents the transfer function corresponding to the calculation processing between each hidden layer and the output layer.
[0093] In this embodiment, the training algorithm of the emission prediction model may adopt the Levenberg-Marquardt (LM) algorithm.
[0094] Next, the process of genetic iteration is explained:
[0095] In this embodiment, the weight and threshold need to be mapped to the position vector and velocity vector of the particle. The mapped particles can be used To express, represents the position of the particle, represents the speed of the particle, i is the serial number of the particle, i=1,2,…,N. In this embodiment, N particles with different positions and different speeds are randomly generated, that is, The initial population is a combination of N weights and thresholds.
[0096] It is worth mentioning that before the genetic iteration process, the range interval of the position and speed of the particles is set in advance, and the position and speed of all individuals in the generated initial population fall within the range interval. When the offspring population is generated by the optimization formula, if the position and speed of the offspring individuals (that is, particles) in the offspring population exceed the range interval, the generated offspring individuals will be discarded. In this embodiment, the range interval of the speed and the range interval of the position can be set by those skilled in the art. In this embodiment, the speed range can be [0,1], and the position range can be [0,5].
[0097] The initial population is input as the input population into the genetic iteration, and the offspring population is generated by the optimization formula. In this embodiment, the optimization formula is as follows:
[0098] v id (t) = ωv id (t-1)+c 1 r 1 [pbest id (t-1)-p id (t-1)]+c 2 r 2 [gbest id (t-1)-p id (t-1)];
[0099] p id (t) = p id (t-1)+v id (t);
[0100] Among them, v id (t) is the velocity of the particle in the tth iteration, v id (t-1) is the velocity of the particle in the t-1th iteration, p id (t) is the position of the particle in the tth iteration, p id (t-1) is the position of the particle in the t-1th iteration, ω is the inertia weight, c 1 is the first learning factor, c 2 is the second learning factor, pbest id (t-1) is the position of the best individual in the t-1th iteration, gbest id (t-1) is the position of the best individual in the first t-1 iterations, r 1 and r 2 A random number between 0 and 1.
[0101] In this embodiment, pbest id (t-1) is the individual with the smallest fitness in the offspring population generated in the t-1th iteration, that is, the preferred individual in the t-1th iteration; gbest id (t-1) is the individual with the smallest fitness among all individuals obtained in the first t-1 iterations, that is, the optimal individual in the first t-1 iterations.
[0102] It can be seen from the optimization formula that the optimization formula involves the first learning factor and the second learning factor, as well as the inertia weight. Both the learning factor and the inertia weight will affect the optimization performance of the optimization formula, where:
[0103] First learning factor c 1 and the second learning factor c 2 represents the particle optimization trajectory is affected by the historical iteration rounds, which may be positive or negative. 1 If c is too large, it means that the particles in the input population will overly rely on historical iteration information during the entire optimization process, causing the particles to fall into a cycle within a certain range. 1 Too small will also cause the particles to fail to converge to a better position. 2 If it is too large, the particles will converge too early and fail to reach the optimal position. 2 Too small will result in less information sharing between particles, and it is also difficult to find the optimal solution. 1 and c 2 Getting a reasonable choice will reduce the probability of particles falling into the local optimum. According to current experience, c 1 and c 2 When the sum of the values is close to 3 to 4, the algorithm shows better performance. 1 and c2 When optimizing, c is usually 1 and c 2 Take 2 for both.
[0104] In this embodiment, a suitable learning factor can make the learning ability of each individual (i.e., particle) in the population aligned with the particle with the best learning ability in the population, and the algorithm optimization accuracy is the highest at this time; if the learning factor is set as a constant, since the individual is constantly optimizing and changing, the unchanged learning factor will gradually reduce the optimization ability of the optimization formula during the iteration process. Therefore, the learning factor should change over time during the optimization process, and according to c 1 The early stage is relatively large, c 2 The later period has a larger regularity to change, so the optimization of the learning factor in this embodiment involves the following designs, such as Figure 4 As shown, including:
[0105] In step 201, a first initial learning factor, a first stop optimization factor, a second initial learning factor, and a second stop optimization factor are set.
[0106] In step 202, in each round of iteration, before iterating the speed and position of the particle corresponding to each individual in the input population through the optimization formula, the first learning factor of the current round is calculated according to the first initial learning factor, the first stop optimization factor and the current iteration round, and the second learning factor of the current round is calculated according to the second initial learning factor, the second stop optimization factor and the current iteration round.
[0107] The first learning factor c 1 The update formula is:
[0108]
[0109] The second learning factor c 2 The update formula is:
[0110]
[0111] Among them, c 1,fir is the first initial learning factor, c 1,end is the first stopping optimization factor, c 2,fir is the second initial learning factor, c 2,end is the second stop optimization factor, t is the current iteration round, t max In this embodiment, the maximum number of iterations is set by those skilled in the art. In this embodiment, the maximum number of iterations may be 100.
[0112] In step 203, the calculated first learning factor and second learning factor are introduced into the optimization formula to iterate the speed and position of the particle corresponding to each individual in the input population.
[0113] The first initial learning factor c 1,fir , the first stop optimization factor c 1,end , the second initial learning factor c 2,fir and the second stopping factor c 2,end All are set by technicians in this field according to actual conditions; 1 The early stage is relatively large, c 2 The later larger law, and c 1 and c 2 The sum of the values should be close to 3 to 4. In this embodiment, the first initial learning factor c 1,fir You can take 2.5, the first stop optimization factor c 1,end It can be taken as 0.5, the second initial learning factor c 2,fir You can take 0.5, the second stop optimization factor c 2,end You can take 2.5.
[0114] For the inertia weight, the inertia weight ω is used to balance the problem between local optimization and global optimization, affecting the convergence speed. For local optimization, the particles are required to gradually narrow the search range based on the original search trajectory, while the global optimization requires the particles to get out of the original search trajectory as much as possible to enter the new search neighborhood. If ω is small, the particle speed is slow, and local search is performed. Only when the optimal solution happens to be within the local range to be optimized can the optimization time be greatly shortened. When ω is large, the particle's motion trajectory will diverge outward due to excessive speed, which will increase the number of iterations and reduce the convergence speed to a certain extent.
[0115] In the actual operation process, the inertia weight will decay with the iteration, showing a linear change trend, resulting in a gradual decrease in the convergence speed. To ensure a normal convergence speed, the inertia weight should maintain a nonlinear decay to ensure that the particle speed decreases relatively slowly. Therefore, the following methods are used for optimization, such as Figure 5 As shown, the method flow includes:
[0116] In step 301 , the maximum inertia weight and the minimum inertia weight are set.
[0117] In step 302, in each round of iteration, before iterating the speed and position of the particle corresponding to each individual in the input population through the optimization formula, the inertia weight of the current round is calculated according to the maximum inertia weight, the minimum inertia weight and the current iteration round.
[0118] The updating formula of the inertia weight ω is:
[0119]
[0120] Among them, ω max is the maximum inertia weight, ω min is the minimum inertia weight, t is the current iteration round, t max is the maximum iteration round, tan(·) is the tangent function
[0121] In step 303, the calculated inertia weight is brought into the optimization formula to iterate the speed and position of the particle corresponding to each individual in the input population.
[0122] In this embodiment, the maximum inertia weight ω max and the minimum inertia weight ω min They are all set by those skilled in the art. In this embodiment, the maximum inertia weight ω max Can be set to 0.8, the minimum inertia weight ω min Can be set to 0.4.
[0123] It should be noted that, since it is necessary to determine the individual with the lowest fitness in the generated offspring population in each round of iteration, it is necessary to calculate the fitness of each individual in each round of iteration, that is, the prediction accuracy of the emission prediction model corresponding to the individual. For the calculation method of fitness, Figure 6 As shown below:
[0124] In step 401, corresponding weights and thresholds are obtained according to individual particles.
[0125] In step 402, under the preset input conditions, the nitrogen oxide emissions are predicted by the emission prediction model corresponding to the weights and thresholds to obtain the predicted output of the individual under the preset input conditions.
[0126] In this embodiment, the preset input conditions are input parameters input into the emission prediction model.
[0127] In step 403, the actual nitrogen oxide emission under the preset input conditions is measured to obtain the actual output under the preset input conditions.
[0128] In step 404, fitness calculation is performed based on the predicted output and the actual output.
[0129] The calculation formula of the fitness is as follows:
[0130]
[0131] Among them, f is the fitness, f(x i ) is the predicted output of the i-th individual in the offspring population, yi is the actual output under the preset input conditions, and n is the number of grids.
[0132] In summary, if Figure 7 As shown, the optimization formula of genetic iteration is not optimized. The corresponding optimal individual is obtained by genetic iteration through the unoptimized optimization formula. The nitrogen oxide emissions are predicted based on the optimal individual and compared with the actual nitrogen oxide emissions. Figure 7 The solid line in the middle is the actual value of nitrogen oxide emissions, and the dotted line is the predicted value of nitrogen oxide emissions. Figure 7 It can be seen that there is a large difference between the predicted value of nitrogen oxide emissions and the actual value of nitrogen oxide emissions.
[0133] like Figure 8 As shown, according to the method of this embodiment, the genetic iteration optimization formula is optimized, and the corresponding optimal individual is obtained by genetic iteration through the optimized optimization formula. The nitrogen oxide emissions are predicted based on the optimal individual and compared with the actual nitrogen oxide emissions. Figure 8 The solid line in the middle is the actual value of nitrogen oxide emissions, and the dotted line is the predicted value of nitrogen oxide emissions. Figure 8 It can be seen that the difference between the predicted value of nitrogen oxide emissions and the actual value of nitrogen oxide emissions is small, and the predicted value of nitrogen oxide emissions is closer to the actual value.
[0134] In summary, the prediction accuracy of nitrogen oxide emissions is significantly improved by optimizing the optimization formula in genetic iteration.
[0135] Embodiment 2:
[0136] Based on Example 1, this example provides another method for predicting nitrogen oxide emissions based on an IPSO-BP neural network, including:
[0137] (1) Initialize the network. In the BP neural network, the number of nodes in each layer is determined by the system's input and output sequence (x, y), and the connection weights w between each layer are initialized. ij and w ki , initialize the hidden layer threshold a, the output layer threshold b, and give the learning rate and neuron activation function.
[0138] (2) Feedforward calculation of BP neural network. The matrix composed of input parameters is used to calculate the output of the hidden layer and the output layer according to the following formulas.
[0139]
[0140] Among them, H is the hidden layer output; M is the number of input layer nodes; i is the number of hidden layer nodes; w ijis the connection weight between the input layer and the hidden layer; q is the number of nodes in the hidden layer; f is the hidden layer activation function; a is the hidden layer threshold.
[0141] The excitation function has various forms. The excitation function selected in this embodiment is as follows:
[0142]
[0143] Among them, O is the output of the output layer; b is the output layer threshold; w ki is the connection weight between the output layer and the hidden layer; L is the number of nodes in the output layer.
[0144] (3) Calculate the error e between the network output O and the expected output y' according to the following formula:
[0145] e k =y′ k -O k ;
[0146] (4) Update the link weights. Based on the output error e, update the link weights w of the neural network according to the following formula: ij and w ki .
[0147]
[0148] j=1,2,…,M; i=1,2,…,q;
[0149] w ki =w ki +ηH i e k ;
[0150] j=1,2,…,q; k=1,2,…,L;
[0151] Where η is the learning rate.
[0152] (5) Threshold update of BP neural network: adjust the thresholds a and b of the hidden layer and output layer through the error e and the following formula.
[0153]
[0154] j=1,2,…,M;
[0155] b k =b k +e k ; k = 1, 2, ..., L;
[0156] (6) Continue iterating and training until the error reaches the set ideal error.
[0157] Embodiment 2:
[0158] like Fig. 9 , which is a schematic diagram of a device for predicting nitrogen oxide emissions based on an IPSO-BP neural network according to an embodiment of the present invention. The device for predicting nitrogen oxide emissions based on an IPSO-BP neural network according to this embodiment includes one or more processors 91 and a memory 92 .
[0159] The processor 91 and the memory 92 may be connected via a bus or other means.
[0160] The memory 92 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs and non-volatile computer executable programs, such as the nitrogen oxide emission prediction method based on the IPSO-BP neural network in the above embodiment. The processor 91 executes the nitrogen oxide emission prediction method based on the IPSO-BP neural network by running the non-volatile software programs and instructions stored in the memory 92.
[0161] The memory 92 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 92 may optionally include a memory remotely arranged relative to the processor 91, and these remote memories may be connected to the processor 91 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0162] The program instructions / modules are stored in the memory 92, and when executed by the one or more processors 91, the nitrogen oxide emission prediction method based on IPSO-BP neural network in the above embodiment is executed, for example, the above described Figure 1 and Figure 4-Figure 6 The steps shown.
[0163] An embodiment of the present invention further provides a non-volatile computer storage medium having computer program instructions stored thereon; when the computer program instructions are executed by a processor, the nitrogen oxide emission prediction method based on the IPSO-BP neural network provided in an embodiment of the present invention is implemented.
[0164] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for predicting nitrogen oxide emissions based on IPSO-BP neural network, characterized in that: include: A plurality of particles with different positions and speeds are randomly generated according to all weights and thresholds in the emission prediction model to obtain an initial population; Inputting the initial population as an input population into a first round of iteration; Each round of iteration includes: iterating the speed and position of the particle corresponding to each individual in the input population through the optimization formula to generate a sub-population, calculating the fitness of all individuals in the sub-population, and sorting the fitness of all individuals in the sub-population to obtain the individual with the smallest fitness as the preferred individual, recording the preferred individual, sorting the fitness size of the preferred individuals in each previous round of iteration, obtaining the preferred individual with the smallest fitness as the optimal individual, and judging whether the current round of iteration meets the termination condition; When the current iteration does not meet the termination condition, the offspring population is input as the input population into the next iteration; When the current iteration meets the termination condition, the optimal solution of the weight and threshold is obtained according to the optimal individual; In each round of iteration except the first round, the learning factor and inertia weight in the optimization formula are optimized according to the current round.
2. The method for predicting nitrogen oxide emissions based on IPSO-BP neural network according to claim 1 is characterized in that: The optimization formula is: v id (t)=ωv id (t-1)+c1r1[pbest id (t-1)-p id (t-1)]+c2r2[gbest id (t-1)-p id (t-1)]; p id (t)=p id (t-1)+v id (t); Among them, v id (t) is the velocity of the particle in the tth iteration, v id (t-1) is the velocity of the particle in the t-1th iteration, p id (t) is the position of the particle in the tth iteration, p id (t-1) is the position of the particle in the t-1th iteration, ω is the inertia weight, c1 is the first learning factor, c2 is the second learning factor, pbest id (t-1) is the position of the best individual in the t-1th iteration, gbest id (t-1) is the position of the best individual in the first t-1 iterations, and r1 and r2 are random numbers between 0 and 1.
3. The method for predicting nitrogen oxide emissions based on IPSO-BP neural network according to claim 2 is characterized in that: The optimization of the learning factor and the inertia weight in the optimization formula according to the current round specifically includes: Optimization of learning factors includes: Setting a first initial learning factor, a first stop optimization factor, a second initial learning factor, and a second stop optimization factor; In each round of iteration, before iterating the speed and position of the particle corresponding to each individual in the input population through the optimization formula, the first learning factor c1 of the current round is calculated according to the first initial learning factor, the first stop optimization factor and the current iteration round, and the second learning factor c2 of the current round is calculated according to the second initial learning factor, the second stop optimization factor and the current iteration round; The calculated first learning factor c1 and second learning factor c2 are introduced into the optimization formula to iterate the speed and position of the particle corresponding to each individual in the input population.
4. The method for predicting nitrogen oxide emissions based on IPSO-BP neural network according to claim 3 is characterized in that: The first learning factor c1 of the current round is calculated according to the first initial learning factor, the first stop optimization factor and the current iteration round, and the second learning factor c2 of the current round is calculated according to the second initial learning factor, the second stop optimization factor and the current iteration round, specifically including: The update formula of the first learning factor c1 is: The update formula of the second learning factor c2 is: Among them, c 1,fir is the first initial learning factor, c 1,end is the first stopping optimization factor, c 2,fir is the second initial learning factor, c 2,end is the second stop optimization factor, t is the current iteration round, t max is the maximum number of iterations.
5. The method for predicting nitrogen oxide emissions based on IPSO-BP neural network according to claim 2 is characterized in that: The optimization of the learning factor and the inertia weight in the optimization formula according to the current round specifically includes: The optimization of inertia weight includes: Set the maximum inertia weight and the minimum inertia weight; In each round of iteration, before iterating the speed and position of each particle corresponding to each individual in the input population through the optimization formula, the inertia weight ω of the current round is calculated according to the maximum inertia weight, the minimum inertia weight and the current iteration round; The calculated inertia weight ω is introduced into the optimization formula to iterate the speed and position of the particle corresponding to each individual in the input population.
6. The method for predicting nitrogen oxide emissions based on IPSO-BP neural network according to claim 5, characterized in that: The inertia weight ω of the current round is calculated according to the maximum inertia weight, the minimum inertia weight and the current iteration round, specifically including: The updating formula of the inertia weight ω is: Among them, ω max is the maximum inertia weight, ω min is the minimum inertia weight, t is the current iteration round, t max is the maximum iteration round, and tan(·) is the tangent function.
7. The method for predicting nitrogen oxide emissions based on IPSO-BP neural network according to claim 1, characterized in that: The calculation of the fitness of all individuals in the offspring population specifically includes: Obtain corresponding weights and thresholds based on individual particles; Under the preset input conditions, the nitrogen oxide emissions are predicted by the emission prediction model corresponding to the weight and the threshold, and the prediction output of the individual under the preset input conditions is obtained; The actual nitrogen oxide emission under the preset input conditions is measured to obtain the actual output under the preset input conditions; Fitness calculation is performed according to the predicted output and the actual output.
8. The method for predicting nitrogen oxide emissions based on IPSO-BP neural network according to claim 7, characterized in that: The calculation formula of the fitness is as follows: Among them, f is the fitness, f(x i ) is the predicted output of the i-th individual in the offspring population, y i is the actual output under the preset input conditions, and n is the number of grids.
9. A nitrogen oxide emission prediction device based on IPSO-BP neural network, characterized in that: It includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor to execute the nitrogen oxide emission prediction method based on the IPSO-BP neural network as described in any one of claims 1-8.
10. A non-volatile computer storage medium, characterized in that: The computer storage medium stores computer program instructions, which, when executed by one or more processors, implement the nitrogen oxide emission prediction method based on the IPSO-BP neural network as described in any one of claims 1 to 8.
