A method for predicting the risk of hazardous chemicals in production safety
By improving the Kingfisher optimization algorithm to adjust the LSTM model parameters, the problems of low efficiency and slow model convergence speed of hazardous chemical production safety risk prediction methods in the existing technology are solved, and higher accuracy risk prediction is achieved.
Patent Information
- Application Number
- CN202411025332.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-07-30
AI Technical Summary
The existing risk prediction methods for hazardous chemicals are inefficient when dealing with large-scale, high-dimensional, nonlinear complex data, and the convergence speed of the LSTM prediction model is slow and prone to fall into the problem of local optimality.
By improving the Kingfisher Optimization Algorithm (DPKO), the number of hidden units, maximum training cycle, initial learning rate and regularization coefficient of the LSTM prediction model are adjusted to improve the prediction accuracy of the model.
The LSTM model has significantly improved the prediction accuracy of the safety production risks of hazardous chemicals, solved the problem of slow convergence speed and easy to fall into local optimality, and provided a more accurate risk prediction method.
Smart Images

Figure CN118553340B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of data prediction and relates to a method for predicting the safety production risks of hazardous chemicals. Background Art
[0002] Existing methods for predicting the safety risks of hazardous chemicals usually include qualitative analysis and quantitative analysis. Qualitative analysis, such as hazard and operability studies (HAZOP) and fault tree analysis (FTA), mainly relies on the experience and judgment of experts. Although these methods can provide important safety information, they often lack accurate numerical predictions and cannot effectively process complex data. Quantitative analysis methods, such as statistical analysis based on historical data, can provide certain quantitative assessments, but are often limited by insufficient data or quality issues. Traditional methods are often inefficient in processing large-scale, high-dimensional, nonlinear complex data, and are difficult to adapt to the current data-driven industrial environment. With the development of industrial automation and information technology, a large amount of data is generated in the production process of hazardous chemicals. These data contain rich safety production information, which makes it possible to adopt new data analysis and risk prediction methods.
[0003] There are fewer risk events in the production process of hazardous chemicals, resulting in limited data samples, making it difficult for the model to learn enough information. At the same time, production data may contain noise and outliers, which need to be cleaned and preprocessed, otherwise it will affect the accuracy of the model, resulting in the LSTM model being overfitted when the training data is limited, and failing to perform well on new data. The problems existing in the LSTM prediction model have not been solved. At present, the hyperparameters of the model are optimized using methods such as grid search, random search, or Bayesian optimization and intelligent optimization algorithms. Intelligent optimization algorithms are good at global search in complex data spaces, can jump out of local optimality, can dynamically adjust search strategies, adapt to different optimization problems, and improve prediction accuracy.
[0004] The Pied Kingfisher Optimizer (PKO) is inspired by the unique hunting behavior and symbiotic relationship of Pied Kingfishers in nature. It is built around three different stages: perching / hovering prey (exploration / diversification), prey (exploitation / enhancement), and cultivating symbiotic relationships. These behaviors are transformed into mathematical models that can effectively solve various optimization challenges in various search spaces. However, in the optimization problem of chemical risk prediction, PKO may converge slowly, especially in the initial stage, and requires more iterations to reach the global optimum. At the same time, the stability of the algorithm may be insufficient when the search space is complex and there are multiple local extreme values. Summary of the invention
[0005] Based on the problems existing in the background technology, the object of the present invention is to solve the problems of slow convergence speed and easy falling into local optimum of PKO algorithm by improving the Pied Kingfisher Optimization Algorithm, and use the improved Pied Kingfisher Optimization Algorithm (DPKO) to adjust the number of hidden units Q, maximum training cycle H, initial learning rate A and regularization coefficient E of LSTM prediction model to improve the accuracy of LSTM prediction model in predicting hazardous chemical production safety risk data.
[0006] The technical solution adopted by the present invention to achieve the above-mentioned objectives is: a method for predicting the safety production risks of hazardous chemicals, including an improved Pied Kingfisher Optimization Algorithm (DPKO) and an LSTM prediction model. The improved Pied Kingfisher Optimization Algorithm (DPKO) is used to optimize the parameters of the number of hidden units Q, the maximum training cycle H, the initial learning rate A and the regularization coefficient E of the LSTM prediction model to obtain accurate prediction parameters and improve the accuracy of the safety production risk prediction of hazardous chemicals. The specific steps include:
[0007] S1. Analyze the key influencing factors of hazardous chemicals production safety risks and collect data on key influencing factors j, including data correlation analysis and data preprocessing.
[0008] S2. Divide the key data sets that affect the safe production of chemicals into training sets and test sets, and use the sliding window technology to input the training data set into the LSTM prediction model.
[0009] S3. Improvement of the optimization algorithm of the Pied Kingfisher, including improvement of the mathematical model of the initialization phase of the Pied Kingfisher optimization algorithm and the perching and hovering strategy in the global search phase, specifically:
[0010] S31, using a multi-point mutation strategy to improve the mathematical model of the initialization stage; the multi-point mutation strategy includes introducing new random values in the dimension of random initialization of the Pied Kingfisher optimization algorithm;
[0011] S32, establishing an "information exchange" strategy, integrating the "information exchange" strategy with the perching and hovering strategy, and establishing an improved perching and hovering strategy;
[0012] S33, introducing an adaptive weight factor w into the improved perching hovering strategy, wherein the adaptive weight factor uses population dispersion to adapt to changes in population diversity and a damping factor to adjust the smoothness of the weight factor;
[0013] S4. Use the improved Pied Kingfisher optimization algorithm to adjust the number of hidden units Q, maximum training cycle H, initial learning rate A and regularization coefficient E parameters of the LSTM prediction model to establish the DPKO-LSTM prediction model.
[0014] S5. Input the test set and validation set of step S2 into the DPKO-LSTM prediction model, and perform de-standardization on the output results to obtain hazardous chemical production safety risk prediction data, so as to achieve accurate prediction of hazardous chemical production safety risks.
[0015] Preferably, in step S1, the key influencing factors of the safety production risks of hazardous chemicals include the following 8 variables, namely chemical flammability data, chemical explosiveness data, chemical reactivity data, chemical production process temperature data, chemical toxicity LC50 data, production process pressure data, production process flow rate data, and production process concentration data.
[0016] Preferably, in step S1, data preprocessing includes data missing value processing, outlier processing and data standardization; wherein, the missing values are filled with the mean value through formula (1);
[0017] (1);
[0018] In formula (1), For the The value of the bth variable of the data, n is the total number of data samples, o is the oth data, is the value of the bth variable of the oth data;
[0019] Among them, the z-score method is used to detect outliers, specifically: if |zs|>3, the data is considered to be an outlier;
[0020] Among them, formula (2) is used to standardize the data to make data of different dimensions comparable. The mathematical model is: (2);
[0021] In formula (2), After standardization The value of the bth variable of the data, is the smallest value of the bth variable, is the value of the largest b-th variable.
[0022] Preferably, in step S1, after data preprocessing is completed, formula (3) is used to perform data correlation analysis to measure the monotonic relationship between two variables. The mathematical model is:
[0023] (3);
[0024] In formula (3), is the data correlation coefficient, For each pair of variable observations and The difference between the rankings of , n is the total number of data samples; where 0< <1, it is positively correlated. The closer it is to 1, the stronger the positive correlation; −1< <0, it is negatively correlated. The closer it is to -1, the stronger the negative correlation.
[0025] Preferably, in step S2, the 14 key influencing factors are taken as a time series data set, and a total of n time series data sets are set, that is, the total number of data samples is n; the n time series data sets are divided into 80% as a training set and 20% as a test set. Further, the sliding window technology is used to generate training data and labels, and the window size is 30. The input data is generated. In order to conform to the input format of LSTM, the input data needs to be adjusted to a three-dimensional tensor.
[0026] Preferably, in step S31, the mathematical model in the initialization phase is improved by using a multi-point mutation strategy, and the specific steps are as follows:
[0027] S311. For each individual Pied Kingfisher , randomly select z dimensions from the Dim dimensions of the Pied Kingfisher optimization algorithm for mutation, and g dimensions form a set ;
[0028] S312: For each dimension selected for mutation ,in , update each dimension value according to formula (4):
[0029] (4);
[0030] In formula (4), is the variation position value of the jth dimension of the i-th Pied Kingfisher individual, is the lower bound position value of the j-th dimension, is the upper bound position value of the j-th dimension, is a uniform random value between 0 and 1;
[0031] S313, if the dimension If no mutation is selected, the original value of the individual Pied Kingfisher is kept, and the value of each dimension is updated according to formula (5):
[0032] (5);
[0033] In formula (5), is the random position value of the j-th dimension of the i-th Pied Kingfisher individual.
[0034] Preferably, the multi-point mutation mechanism improves the ability of the pied kingfisher population to escape from the local optimal solution and increases the global search capability of the pied kingfisher optimization algorithm by introducing randomness in multiple randomly selected dimensions; it is further explained that the pied kingfisher optimization algorithm improved by the multi-point mutation mechanism can improve the speed of optimizing the parameters when optimizing the number of hidden units Q, maximum training cycle H, initial learning rate A and regularization coefficient E of the LSTM prediction model, thereby making the LSTM prediction model more robust for hazardous chemical risk prediction.
[0035] Preferably, in step S32, an "information exchange" strategy is established, including: establishing two centers, with the current global best position As the center, the optimization solution of the Pied Kingfisher optimization algorithm is close to the global optimal solution. At the same time, with the current global average position as the center, a random number is introduced and random numbers As weights, the degree of movement of the individual kingfisher to the global optimal position and the population average position is adjusted, that is, the optimal solution of the kingfisher optimization algorithm approaches the global optimal solution and the convergence speed of the global average solution; the perching and hovering strategy is integrated with the "information exchange" strategy to establish an improved perching and hovering strategy, and the mathematical model is:
[0036] (6);
[0037] In formula (6), q is the qth individual of Pied Kingfisher, ,in , is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t+1-th iteration, is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t-th iteration, is the maximum population size, is the global best position, is the direction control factor, which controls the moving direction of the Pied Kingfisher, and T is the step length factor.
[0038] Preferably, the present invention proposes to establish an "information exchange" strategy, integrate the "information exchange" strategy into the perching and hovering strategy, and establish an improved perching and hovering strategy. Compared with the perching and hovering strategy of the pied kingfisher optimization algorithm before improvement, the improved perching and hovering strategy integrating the "information exchange" strategy ensures that each pied kingfisher individual not only considers itself and the current optimal position when updating its position, but also considers the distribution of the entire population, thereby increasing the diversity of the population and preventing individuals from converging to the local optimal solution too early. It is further explained that when the parameters of the number of hidden units Q, the maximum training cycle H, the initial learning rate A and the regularization coefficient E of the LSTM prediction model are adjusted using the improved pied kingfisher optimization algorithm The mathematical model of the perching and hovering strategy can improve the accuracy of LSTM parameter optimization.
[0039] Preferably, an adaptive weight factor w is introduced into the improved perching and hovering strategy, and the mathematical model of the adaptive weight factor w is:
[0040] (7);
[0041] In formula (7), is the adaptive weight factor value for the tth iteration, is the maximum value of the adaptive weight factor, is the minimum value of the adaptive weight factor, Tmax is the maximum number of iterations, is the position fitness value of the i-th Pied Kingfisher individual in the t-th iteration, is the minimum fitness value of the tth iteration, is the fitness value of the average position of the Pied Kingfisher population in the tth iteration, is the population dispersion of the tth iteration, L is the damping factor, and its value is in [0, 1];
[0042] Among them, the mathematical model of population dispersion design for the tth iteration is:
[0043] ;
[0044] Where stdf(t) is the standard deviation of the fitness value of the population at the t-th iteration, and stdf(t-1) is the standard deviation of the fitness value of the population at the t-1th iteration.
[0045] Preferably, in the adaptive weight factor, the damping factor b controls the sensitivity of the weight factor to changes in the number of iterations and the individual fitness. A smaller damping factor value will make the weight factor change more smoothly, while a larger damping factor value may cause the weight factor to change drastically during the iteration process; the population discreteness k(t) measures the evolutionary discreteness of the population by comparing the standard deviation of the fitness values of the current generation and the previous generation. If the discreteness of the current generation is large, it means that there is more diversity in the population. At this time, k(t) will be large, which may increase the variation of the weight factor and further improve the global exploration ability of the piebald kingfisher optimization algorithm; through the fitness value of the current individual, the minimum fitness value and the average fitness value of the current generation population, by comparing the fitness value of the current individual with the minimum and average fitness values of the population, the relative performance of the individual in the population can be evaluated. If the fitness value of the current individual is high, the weight factor will be reduced accordingly to reduce excessive dependence on the individual, further allowing the piebald kingfisher optimization algorithm to explore other solutions and improve the balance between the global search and local development of the piebald kingfisher optimization algorithm.
[0046] Preferably, an adaptive weight factor is introduced to establish a mathematical model for position update in the global search phase of the algorithm according to formula (8);
[0047] (8);
[0048] In formula (8), q is the qth individual of Pied Kingfisher, ,in , is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t+1-th iteration, is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t-th iteration, is the maximum population size, is the global best position, is the direction control factor, which controls the moving direction of the Pied Kingfisher, and T is the step length factor.
[0049] Preferably, the fitness function is used to guide the improved kingfisher optimization algorithm to optimize the number of hidden units Q, the maximum training cycle H, the initial learning rate A and the regularization coefficient E of the LSTM prediction model. The fitness function f is designed by minimizing the mean square error (MSE), and the mathematical model of the fitness function is:
[0050] (9);
[0051] In formula (9), n is the total number of data samples, For the Items of data, For the The actual value of the data. For the The predicted value of the data.
[0052] Preferably, in step S4, the LSTM prediction model is optimized using the improved kingfisher optimization algorithm to establish a DPKO-LSTM prediction model, and the specific method is:
[0053] S41, the number of hidden units Q, the maximum training cycle H, the initial learning rate A and the regularization coefficient E parameters of the LSTM prediction model are represented by a 4-dimensional space vector;
[0054] S42, setting the maximum number of iterations Tmax, the maximum population size N, the upper bound ub and the lower bound lb of the position value of the improved pied kingfisher optimization algorithm, the individual position value of the improved pied kingfisher optimization algorithm adopts a real number encoding method, and each pied kingfisher individual position value is represented by a real number vector;
[0055] S43, using the improved initialization phase mathematical model of step S31 to generate initial position values of individuals of the Pied Kingfisher population;
[0056] S44, calculating the fitness value of each individual position of the spotted kingfisher, and recording the individual position value of the spotted kingfisher corresponding to the minimum value of the N fitness values as the best position of the current iteration ; Compare the best position of the current iteration with the current global best position Compare and take the position with the smaller fitness value as the new global optimal position;
[0057] S45, whether the current number of iterations t satisfies t=Tmax, if so, the optimization process is terminated, the individual position of the kingfisher corresponding to the minimum fitness value of the current iteration is parsed into a 4-dimensional space vector of the LSTM prediction model parameters, and the optimal number of hidden units Q, maximum training cycle H, initial learning rate A and regularization coefficient E parameter values are obtained; otherwise, step S46 is executed;
[0058] S46, establishing an improved position update mathematical model of the Pied Kingfisher optimization algorithm, and using the position update mathematical model to update the position value, wherein the position value is a 4-dimensional vector value of the number of hidden units Q, the maximum training cycle H, the initial learning rate A, and the regularization coefficient E parameters of the LSTM prediction model;
[0059] S47. Execute t=t+1 for the current iteration number t, and then return to step S43 to continue execution.
[0060] Preferably, step S46, establishing an improved position update mathematical model of the kingfisher optimization algorithm, includes: a global search stage and a local convergence stage; wherein the global search stage includes an improved perching hovering strategy; wherein the local convergence stage includes a hunting strategy; using the position update mathematical model to update the position value, the specific steps are:
[0061] S461, set the random function rand, if rand is less than 0.8, execute step S462; otherwise, execute step S463;
[0062] S462, in the global search phase, a new position update strategy of the Pied Kingfisher algorithm is established by updating the step size factors at different phases; including:
[0063] Step 1: If rand is greater than 0.5, then use formula (10) to update the step factor T; if rand is greater than 0.5 and less than 0.8, then use formula (11) to update the step factor T;
[0064] (10);
[0065] In formula (10), Tmax is the maximum number of iterations, t is the current number of iterations, BF is the beating factor, and rand is a uniform random value between 0 and 1;
[0066] (11);
[0067] In formula (11), is the position fitness value of the Mth individual Pied Kingfisher in the tth iteration, is the position fitness value of the Bth individual Pied Kingfisher in the tth iteration;
[0068] Step 2: Introduce the step size factor T into the improved perching hovering strategy, introduce the adaptive weight, establish a position update mathematical model in the global search phase according to formula (8), and update the position value;
[0069] S463, hunting strategy uses the current position information of each individual kingfisher and the position information of the best individual, combines with random disturbance to update the individual position, establishes the position update mathematical model in the local convergence stage according to formula (12), and updates the position value;
[0070] (12);
[0071] In formula (12), is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t+1-th iteration, is the position value of the jth dimension of the ith Pied Kingfisher individual in the tth iteration, HA is the hunting ability factor, γ and α are the convergence control factors, and c is the balance factor;
[0072] S464, the symbiotic strategy simulates the symbiotic behavior of the Pied Kingfisher and other species by introducing random disturbances and control parameters, and establishes a mathematical model for position update in the local escape stage according to formula (13) to update the position value;
[0073] (13);
[0074] In formula (13), The position of the mth individual of Pied Kingfisher in the tth iteration, The position of the nth individual of Pied Kingfisher in the tth iteration, PE is the linear predation efficiency factor, and γ and α are the convergence control factors.
[0075] By introducing multi-point mutation, "information exchange" strategy and adaptive weight factor to the Pied Kingfisher Optimization Algorithm (PKO), the convergence speed and global search capability of the algorithm are significantly improved, and the problem that the original algorithm is prone to falling into local optimality is effectively solved. Secondly, the improved Pied Kingfisher Optimization Algorithm (DPKO) is used to optimize key parameters such as the number of hidden units, maximum training cycle, initial learning rate and regularization coefficient of the LSTM prediction model, which significantly improves the prediction accuracy of the LSTM model. Further combining the improved Pied Kingfisher Optimization Algorithm and the LSTM model, the present invention provides a more accurate risk prediction method for the safe production of hazardous chemicals. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] Figure 1 A flow chart of a method for optimizing risk prediction of hazardous chemical production;
[0077] Figure 2 A flow chart of the method for optimizing the LSTM prediction model using the improved Pied Kingfisher optimization algorithm;
[0078] Figure 3 Comparison of the fitness of the LSTM prediction model optimized by the Pied Kingfisher optimization algorithm before and after improvement;
[0079] Figure 4 This is the fitting effect diagram of DPKO-LSTM model for chemical production risk prediction;
[0080] Figure 5 This is a comparison chart of the effects of PKO-LSTM prediction model and DPKO-LSTM prediction model on the risk prediction of hazardous chemical production;
[0081] Figure 6 This is a comparison chart of the errors of the PKO-LSTM prediction model and the DPKO-LSTM prediction model in predicting the production risks of hazardous chemicals. DETAILED DESCRIPTION
[0082] 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.
[0083] See also Figure 1-Figure 6 The present invention provides a technical solution: a method for optimizing the prediction of production risks of hazardous chemicals, which uses an improved LSTM prediction model to predict the production risks of hazardous chemicals. The specific steps are as follows: Figure 1 shown.
[0084] S1. Analyze the key influencing factors of hazardous chemical production safety risks and collect data on key influencing factors, including data correlation analysis and data preprocessing.
[0085] Furthermore, the key influencing factors of hazardous chemical production safety risks include 8 variables, among which the data come from the historical production data of refined products and by-products (gasoline, diesel, ethanol). The data set includes chemical flammability data, chemical explosiveness data, chemical reactivity data, chemical production process temperature data, chemical toxicity LC50 data, production process pressure data, production process flow rate data, and production process concentration data.
[0086] Furthermore, the historical production data of refined products and by-products (gasoline, diesel, and ethanol) are preprocessed, including data missing value processing, outlier processing, and data standardization; first, the missing values are filled using the mean value through formula (1);
[0087] (1);
[0088] In formula (1), For the The value of the bth variable of the data, n is the total number of data samples, o is the oth data, is the value of the bth variable of the oth data;
[0089] Among them, the z-score method is used to detect outliers, specifically: if |zs|>3, the data is considered to be an outlier;
[0090] Among them, formula (2) is used to standardize the data to make data of different dimensions comparable. The mathematical model is: (2);
[0091] In formula (2), After standardization The value of the bth variable of the data, is the smallest value of the bth variable, is the value of the largest b-th variable.
[0092] Furthermore, after the historical production data is preprocessed, formula (3) is used to perform data correlation analysis to measure the monotonic relationship between two variables. The mathematical model is:
[0093] (3);
[0094] In formula (3), is the data correlation coefficient, For each pair of variable observations and The difference between the rankings of , n is the total number of data samples; where 0< <1, it is positively correlated. The closer it is to 1, the stronger the positive correlation; −1< <0, it is negatively correlated. The closer it is to -1, the stronger the negative correlation.
[0095] S2. Divide the key data sets that affect the safe production of chemicals into training sets and test sets, and use the sliding window technology to input the training data set into the LSTM prediction model.
[0096] Furthermore, the eight key influencing factors are taken as a time series data set, and a total of n time series data sets are set, that is, the total number of data samples is n; the n time series data sets are divided into 80% as training sets and 20% as test sets. Further, the sliding window technology is used to generate training data and labels with a window size of 30 to generate input data, and the input data is adjusted to a three-dimensional tensor.
[0097] S3. Improvement on the optimization algorithm of Pied Kingfisher, including improvement on the mathematical model of the initialization phase of the optimization algorithm of Pied Kingfisher and the perching and hovering strategy in the global search phase.
[0098] Further, S31, the mathematical model of the initialization stage is improved by using a multi-point mutation strategy; the multi-point mutation strategy includes introducing new random values in the dimension of random initialization of the Pied Kingfisher optimization algorithm.
[0099] Furthermore, the mathematical model of the initialization stage is improved by using a multi-point mutation strategy. The specific steps are as follows:
[0100] S311. For each individual Pied Kingfisher , randomly select z dimensions from the Dim dimensions of the Pied Kingfisher optimization algorithm for mutation, and g dimensions form a set ;
[0101] S312: For each dimension selected for mutation ,in , update each dimension value according to formula (4):
[0102] (4);
[0103] In formula (4), is the variation position value of the jth dimension of the i-th Pied Kingfisher individual, is the lower bound position value of the j-th dimension, is the upper bound position value of the j-th dimension, is a uniform random value between 0 and 1;
[0104] S313, if the dimension If no mutation is selected, the original value of the individual Pied Kingfisher is kept, and the value of each dimension is updated according to formula (5):
[0105] (5);
[0106] In formula (5), is the random position value of the j-th dimension of the i-th Pied Kingfisher individual.
[0107] Further, S32, an "information exchange" strategy is established, and the "information exchange" strategy is integrated into the perching and hovering strategy to establish an improved perching and hovering strategy.
[0108] Furthermore, an “information exchange” strategy was established, including: establishing two centers to take the current global best position As the center, the optimization solution of the Pied Kingfisher optimization algorithm is close to the global optimal solution. At the same time, with the current global average position as the center, a random number is introduced and random numbers As weights, the degree of movement of the individual kingfisher to the global optimal position and the population average position is adjusted, that is, the optimal solution of the kingfisher optimization algorithm approaches the global optimal solution and the convergence speed of the global average solution; the perching and hovering strategy is integrated with the "information exchange" strategy to establish an improved perching and hovering strategy, and the mathematical model is:
[0109] (6);
[0110] In formula (6), q is the qth individual of Pied Kingfisher, ,in , is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t+1-th iteration, is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t-th iteration, is the maximum population size, is the global best position, is the direction control factor, which controls the moving direction of the Pied Kingfisher, and T is the step length factor.
[0111] Furthermore, the directional control factor The design is random, and a value is randomly generated in each iteration. The mathematical model is:
[0112] ;
[0113] In the formula, Generates a random value from the problem dimension.
[0114] Furthermore, in S33, an adaptive weight factor w is introduced into the improved perching hovering strategy, and the adaptive weight factor adopts population dispersion to adapt to the change of population diversity and a damping factor to adjust the smoothness of the weight factor.
[0115] Furthermore, the mathematical model of the adaptive weight factor w is:
[0116] (7);
[0117] In formula (7), is the adaptive weight factor value for the tth iteration, is the maximum value of the adaptive weight factor, is the minimum value of the adaptive weight factor, Tmax is the maximum number of iterations, is the position fitness value of the i-th Pied Kingfisher individual in the t-th iteration, is the minimum fitness value of the tth iteration, is the fitness value of the average position of the Pied Kingfisher population in the tth iteration, is the population dispersion of the tth iteration, L is the damping factor, and its value is in [0, 1];
[0118] Among them, the mathematical model of population dispersion design for the tth iteration is:
[0119] ;
[0120] Where stdf(t) is the standard deviation of the fitness value of the population at the t-th iteration, and stdf(t-1) is the standard deviation of the fitness value of the population at the t-1th iteration.
[0121] Further, S4, the number of hidden units Q, the maximum training cycle H, the initial learning rate A and the regularization coefficient E parameters of the LSTM prediction model are adjusted using the improved kingfisher optimization algorithm to establish the DPKO-LSTM prediction model, such as Figure 2 As shown, the specific steps are:
[0122] S41, the number of hidden units Q, the maximum training cycle H, the initial learning rate A and the regularization coefficient E parameters of the LSTM prediction model are represented by a 4-dimensional space vector;
[0123] S42, setting the maximum number of iterations Tmax, the maximum population size N, the upper bound ub and the lower bound lb of the position value, and the problem dimension Dim of the improved pied kingfisher optimization algorithm; the individual position value of the improved pied kingfisher optimization algorithm adopts a real number encoding method, and each individual position value of the pied kingfisher is represented by a real number vector;
[0124] S43, using the improved initialization phase mathematical model of step S31 to generate initial position values of individuals of the Pied Kingfisher population;
[0125] S44, calculating the fitness value of each individual position of the spotted kingfisher, and recording the individual position value of the spotted kingfisher corresponding to the minimum value of the N fitness values as the best position of the current iteration ; Compare the best position of the current iteration with the current global best position Compare the two and take the position with the smaller fitness value as the new global optimal position; the mathematical model of the fitness function is:
[0126] (9);
[0127] In formula (9), n is the total number of data samples, For the Items of data, For the The actual value of the data. For the The predicted value of the data;
[0128] S45, whether the current number of iterations t satisfies t=Tmax, if so, the optimization process is terminated, the individual position of the kingfisher corresponding to the minimum fitness value of the current iteration is parsed into a 4-dimensional space vector of the LSTM prediction model parameters, and the optimal number of hidden units Q, maximum training cycle H, initial learning rate A and regularization coefficient E parameter values are obtained; otherwise, step S46 is executed;
[0129] S46, establishing an improved position update mathematical model of the Pied Kingfisher optimization algorithm, and using the position update mathematical model to update the position value, wherein the position value is a 4-dimensional vector value of the number of hidden units Q, the maximum training cycle H, the initial learning rate A, and the regularization coefficient E parameters of the LSTM prediction model;
[0130] S47. Execute t=t+1 for the current iteration number t, and then return to step S43 to continue execution.
[0131] Furthermore, an improved position update mathematical model of the Pied Kingfisher optimization algorithm is established, including: a global search stage and a local convergence stage; wherein the global search stage includes an improved perching hovering strategy; wherein the local convergence stage includes a hunting strategy; the position value is updated using the position update mathematical model, and the specific steps are:
[0132] S461, set the random function rand, if rand is less than 0.8, execute step S462; otherwise, execute step S463;
[0133] S462, in the global search phase, a new position update strategy of the Pied Kingfisher algorithm is established by updating the step size factors at different phases; including:
[0134] Step 1: If rand is greater than 0.5, then use formula (10) to update the step factor T; if rand is greater than 0.5 and less than 0.8, then use formula (11) to update the step factor T;
[0135] (10);
[0136] In formula (10), Tmax is the maximum number of iterations, t is the current number of iterations, BF is the beating factor, and rand is a uniform random value between 0 and 1;
[0137] (11);
[0138] In formula (11), is the position fitness value of the Mth individual Pied Kingfisher in the tth iteration, is the position fitness value of the Bth individual Pied Kingfisher in the tth iteration;
[0139] Step 2: Introduce the step factor T into the improved perching hovering strategy, introduce the adaptive weight, establish the position update mathematical model of the global search phase according to formula (8), and update the position value; the mathematical model is:
[0140] (8);
[0141] In formula (8), q is the qth individual of Pied Kingfisher, ,in , is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t+1-th iteration, is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t-th iteration, is the maximum population size, is the global best position, is the direction control factor, which controls the moving direction of the Pied Kingfisher, and T is the step length factor;
[0142] S463, hunting strategy uses the current position information of each individual kingfisher and the position information of the best individual, combines with random disturbance to update the individual position, establishes the position update mathematical model in the local convergence stage according to formula (12), and updates the position value;
[0143] (12);
[0144] In formula (12), is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t+1-th iteration, is the position value of the jth dimension of the ith Pied Kingfisher individual in the tth iteration, HA is the hunting ability factor, γ and α are the convergence control factors, and c is the balance factor;
[0145] S464, the symbiotic strategy simulates the symbiotic behavior of the Pied Kingfisher and other species by introducing random disturbances and control parameters, and establishes a mathematical model for position update in the local escape stage according to formula (13) to update the position value;
[0146] (13);
[0147] In formula (13), The position of the mth individual of Pied Kingfisher in the tth iteration, The position of the nth Pied Kingfisher individual in the tth iteration. PE is the linear predation efficiency factor.
[0148] Furthermore, the hunting ability factor HA mathematical model is designed as follows:
[0149] .
[0150] Furthermore, the mathematical model of the convergence control factor γ is designed as:
[0151] .
[0152] Furthermore, the mathematical model of the balance factor c is:
[0153] ;
[0154] In the formula, is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t-th iteration; is the best position of the current iteration, and γ is the convergence control factor.
[0155] Furthermore, the mathematical model of linear predation efficiency factor PE is:
[0156] ;
[0157] In the formula, is the maximum value of the predation efficiency factor, which is 0.5. is the maximum value of the predation efficiency factor, which is 0; t is the current iteration parameter, and Tmax is the maximum number of iterations.
[0158] S5. Input the test set and validation set of step S2 into the DPKO-LSTM prediction model, and perform de-standardization on the output results to obtain hazardous chemical production safety risk prediction data, so as to achieve accurate prediction of hazardous chemical production safety risks.
[0159] Furthermore, the data is denormalized using formula (14):
[0160] (14);
[0161] In formula (14), and are the minimum and maximum values in the original data set. After standardization The value of the bth variable of the data item.
[0162] Furthermore, in Matlab software, the program design of the improved piebald kingfisher optimization algorithm (DPKO) was completed, and the maximum population size N=60, the maximum number of iterations Tmax=40, the upper bound ub=[150,80,0.05, 1e-3] and the lower bound lb=[30,50,0.001, 1e-4] of the improved piebald kingfisher optimization algorithm were set, and the problem dimension Dim=4. In order to further verify the advancement of the method of the present invention, the program design of the piebald kingfisher optimization algorithm (PKO) was completed at the same time, and the parameter settings were the same as those of the improved piebald kingfisher optimization algorithm (DPKO); further, the LSTM prediction model program, PKO-LSTM and DPKO-LSTM prediction models were designed in Matlab respectively, the historical production data of refined products and by-products (gasoline, diesel, ethanol) were converted into xlsx format, and the program was run to read the data.
[0163] Furthermore, we get Figure 3 The fitness comparison chart of the LSTM prediction model optimized by the Pied Kingfisher optimization algorithm before and after the improvement. From the comparison in the figure, in the early stage of iteration, the fitness of the DPKO algorithm decreases rapidly, showing a strong optimization ability. After 5 iterations, the fitness is basically stable at a low level, indicating that the improved Pied Kingfisher optimization algorithm can quickly converge to a better solution; in contrast, the fitness of the PKO algorithm decreases slowly and fluctuates greatly during the entire iteration process, indicating that the standard Pied Kingfisher optimization algorithm has not effectively escaped from the local optimum.
[0164] Furthermore, if Figure 4 The figure shows the relationship between the predicted value of the DPKO-LSTM model for production safety risk prediction and the actual observed value. The straight line in the figure represents the ideal fitting situation, that is, the predicted value of the model is completely equal to the actual value, and the scatter points represent the actual data points. The horizontal axis of each point is the predicted value of the model, and the vertical axis is the actual observed value. Most of the data points in the figure are closely surrounded by the straight line, indicating that there is a strong positive correlation between the predicted value of the DPKO-LSTM model and the actual observed value, indicating that the prediction ability of the DPKO-LSTM model is relatively accurate; at the same time, the distribution trend of data points around the straight line shows the consistency of the prediction. Overall, the deviation between the predicted value of the DPKO-LSTM model and the actual value is small, indicating that the performance of the DPKO-LSTM model on different data points has a certain stability.
[0165] Furthermore, if Figure 5As shown in the figure, the results of production safety risk prediction are compared. The prediction results of the basic LSTM model are relatively smooth, but the response is slightly slower when processing peaks and valleys, indicating that the basic LSTM model is not sensitive enough to the rapid changes in the data; the prediction results of the PKO-LSTM model are improved compared with the basic LSTM model, especially when tracking mutations in the data, but there are still deviations at some peaks; the DPKO-LSTM model of the method of the present invention shows the best prediction ability, and its prediction line tracks the actual data changes more closely and accurately, especially in the prediction of peaks and valleys, which is closer to the actual data.
[0166] Furthermore, if Figure 6 As shown in the figure, the error changes of the basic LSTM model, PKO-LSTM model and DPKO-LSTM model in the prediction of production safety risks; the prediction error of the DPKO-LSTM model is significantly better than that of the other two methods, indicating that the improvements of the DPKO-LSTM model in parameter optimization and model adjustment are effective and suitable for application scenarios with high-precision prediction of production safety risks.
Claims
1. A method for predicting the safety production risks of hazardous chemicals, characterized in that: The specific steps are: S1. Analyze the key influencing factors of hazardous chemical production safety risks and collect data on the key influencing factors, including data correlation analysis and data preprocessing; S2. Divide the key data sets that affect the safe production of chemicals into training sets and test sets, and use the sliding window technology to input the training data sets into the LSTM prediction model; S3. Improvement of the optimization algorithm of the Pied Kingfisher, including improvement of the mathematical model of the initialization phase of the Pied Kingfisher optimization algorithm and the perching and hovering strategy in the global search phase, specifically: S31, improving the mathematical model of the initialization stage by using a multi-point mutation strategy; the multi-point mutation strategy includes introducing new random values in the dimension of random initialization of the Pied Kingfisher optimization algorithm; S32, establishing an "information exchange" strategy, integrating the "information exchange" strategy with the perching and hovering strategy, and establishing an improved perching and hovering strategy; S33, introducing an adaptive weight factor w into the improved perching hovering strategy, wherein the adaptive weight factor uses population dispersion to adapt to changes in population diversity and a damping factor to adjust the smoothness of the weight factor; S4, using the improved Pied Kingfisher optimization algorithm to adjust the number of hidden units Q, maximum training cycle H, initial learning rate A and regularization coefficient E parameters of the LSTM prediction model, and establish the DPKO-LSTM prediction model; S5, input the test set and validation set of step S2 into the DPKO-LSTM prediction model, and perform de-standardization on the output results to obtain the hazardous chemical production safety risk prediction data, so as to achieve accurate prediction of hazardous chemical production safety risks; In step S1, the key influencing factors of the safety production risk of hazardous chemicals include 8 variables, namely chemical flammability data, chemical explosiveness data, chemical reactivity data, chemical production process temperature data, chemical toxicity LC50 data, production process pressure data, production process flow rate data, and production process concentration data; In step S31, the mathematical model of the initialization phase is improved by using a multi-point mutation strategy, and the specific steps are as follows: S311. For each individual Pied Kingfisher , randomly select z dimensions from the Dim dimensions of the Pied Kingfisher optimization algorithm for mutation, where the z dimensions form a set ; S312: From the set Select the The dimension values are mutated, where , update each dimension value according to formula (4): (4); In formula (4), is the variation position value of the jth dimension of the i-th Pied Kingfisher individual, is the lower bound position value of the j-th dimension, is the upper bound position value of the j-th dimension, is a uniform random value between 0 and 1; S313, if the dimension If no mutation is selected, the original value of the individual Pied Kingfisher is kept, and the value of each dimension is updated according to formula (5): (5); In formula (5), is the random position value of the jth dimension of the i-th Pied Kingfisher individual; In step S32, an "information exchange" strategy is established, including: establishing two centers, with the current global best position As the center, the optimization solution of the Pied Kingfisher optimization algorithm is close to the global optimal solution. At the same time, with the current global average position as the center, a random number is introduced and random numbers As weights, the degree of movement of the individual Pied Kingfisher to the global optimal position and the population average position is adjusted, that is, the optimal solution of the Pied Kingfisher optimization algorithm approaches the global optimal solution and the convergence speed of the global average solution; the perching and hovering strategy is integrated with the "information exchange" strategy to establish an improved perching and hovering strategy, and the mathematical model is: (6); In formula (6), q is the qth individual of Pied Kingfisher, ,in , is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t+1-th iteration, is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t-th iteration, is the maximum population size, is the global best position, is the direction control factor, which controls the moving direction of the Pied Kingfisher, and T is the step length factor; In step S33, an adaptive weight factor w is introduced into the improved perching and hovering strategy, and the mathematical model of the adaptive weight factor w is: (7); In formula (7), is the adaptive weight factor value for the tth iteration, is the maximum value of the adaptive weight factor, is the minimum value of the adaptive weight factor, Tmax is the maximum number of iterations, is the position fitness value of the i-th Pied Kingfisher individual in the t-th iteration, is the minimum fitness value of the tth iteration, is the fitness value of the average position of the Pied Kingfisher population in the tth iteration, is the population dispersion of the tth iteration, L is the damping factor, and its value is in [0, 1]; Among them, the mathematical model of population dispersion design for the tth iteration is: ; Where, stdf(t) is the standard deviation of the fitness value of the population at the t-th iteration, and stdf(t-1) is the standard deviation of the fitness value of the population at the t-1th iteration; Among them, the adaptive weight factor is introduced, and the mathematical model of position update in the global search phase of the algorithm is established according to formula (8); (8); In formula (8), q is the qth individual of Pied Kingfisher, ,in , is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t+1-th iteration, is the position value of the j-th dimension of the i-th Pied Kingfisher individual in the t-th iteration, is the maximum population size, is the global best position, is the direction control factor, which controls the moving direction of the Pied Kingfisher, and T is the step length factor; The improved kingfisher optimization algorithm is used to optimize the LSTM prediction model and establish the DPKO-LSTM prediction model. The specific method is as follows: S41, the number of hidden units Q, the maximum training cycle H, the initial learning rate A and the regularization coefficient E parameters of the LSTM prediction model are represented by a 4-dimensional space vector; S42, setting the maximum number of iterations Tmax, the maximum population size N, the upper bound ub and the lower bound lb of the position value, and the problem dimension Dim of the improved pied kingfisher optimization algorithm; the individual position value of the improved pied kingfisher optimization algorithm adopts a real number encoding method, and each individual position value of the pied kingfisher is represented by a real number vector; S43, using the improved initialization phase mathematical model of step S31 to generate initial position values of individuals of the Pied Kingfisher population; S44, calculating the fitness value of each individual position of the spotted kingfisher, and recording the individual position value of the spotted kingfisher corresponding to the minimum value of the N fitness values as the best position of the current iteration ; The best position of the current iteration is compared with the current global best position Compare and take the position with the smaller fitness value as the new global optimal position; S45, whether the current number of iterations t satisfies t=Tmax, if so, the optimization process is terminated, the individual position of the kingfisher corresponding to the minimum fitness value of the current iteration is parsed into a 4-dimensional space vector of the LSTM prediction model parameters, and the optimal number of hidden units Q, maximum training cycle H, initial learning rate A and regularization coefficient E parameter values are obtained; otherwise, step S46 is executed; S46, establishing an improved position update mathematical model of the Pied Kingfisher optimization algorithm, and using the position update mathematical model to update the position value, wherein the position value is a 4-dimensional vector value of the number of hidden units Q, the maximum training cycle H, the initial learning rate A, and the regularization coefficient E parameters of the LSTM prediction model; S47. Execute t=t+1 for the current iteration number t, and then return to step S43 to continue execution.
2. A method for predicting safety production risks of hazardous chemicals according to claim 1, characterized in that: The fitness function f is designed by minimizing the mean square error, and the mathematical model of the fitness function is: (9); In formula (9), n is the total number of data samples, For the Items of data, For the The actual value of the data. For the The predicted value of the data.
Citation Information
Patent Citations
LNG large storage tank area risk prediction method based on genetic particle swarm optimization CNN-LSTM
CN117610729A
Method for realizing engineering optimization based on green bird optimization algorithm
CN118246330A