Next-Generation Optimization Models and Algorithms in Cloud and Fog ComputingView this Special Issue
Research on Danjiang Water Quality Prediction Based on Improved Artificial Bee Colony Algorithm and Optimized BP Neural Network
In order to ensure “a river of clear water is supplied to Beijing and Tianjin” and improve the water quality prediction accuracy of the Danjiang water source, while avoiding the local optimum and premature maturity of the artificial bee colony algorithm, an improved artificial bee colony algorithm (ABC algorithm) is proposed to optimize the Danjiang water quality prediction model of BP neural network is proposed. This method improves the local and global search capabilities of the ABC algorithm by adding adaptive local search factors and mutation factors, improves the performance of local search, and avoids local optimal conditions. The improved ABC algorithm is used to optimize the weights and thresholds of the BP neural network to establish a water quality grade prediction model. Taking the water quality monitoring data of Danjiang source (Shangzhou section) from 2015 to 2019 as the research object, it is compared with GA-BP, PSO-BP, ABC-BP, and BP models. The research results show that the improved ABC-BP algorithm has the highest prediction accuracy, faster convergence speed, stronger stability, and robustness.
The Party Central Committee, State Council, Provincial Committee, and Provincial Government attach great importance to the work of ecological environment protection in Qinling area. General Secretary Xi Jinping emphasized: “No one can destroy the natural ecological beauty of the Qinling Mountains.” The Danjiang River originates from the southern foot of the Qinling Mountains in the northwestern part of Shangluo, Shaanxi Province, and flows through Shaanxi Province, Henan Province, and Hubei Province. It is injected into Danjiangkou Reservoir in Danjiangkou City of Hubei Province and intersects with the Han River . The total length of the mainstream is 390 km, which is the longest tributary of the Hanjiang River. The basin area is 17300 square kilometers, accounting for 10% of the total area of the Hanjiang River Basin . The Danjiang River is an important water source for the Middle Route Project of the “South-to-North Water Diversion”. In recent years, Shangluo City has fully implemented the circular development strategy to protect the water sources, built ecological Shangluo, and ensured that “a river of clean water is supplied to Beijing and Tianjin.” However, with the advancement of the resettlement project and social economic development, more and more domestic sewage is discharged to the Danjiang River, which directly affects the water quality of the Danjiang River Basin. Therefore, by predicting the water quality of the Danjiang River Basin, a scientific decision-making basis can be provided for the protection and management of the water environment.
The currently used common methods for water quality prediction include the GM model, artificial neural network, and SVM. In the literature , the gray prediction method is used for water quality prediction. This method is only suitable for short-term prediction. There is also the disadvantage that the larger the gray level of the data, the lower the prediction accuracy. Literature  and Literature  proposed a water quality prediction model based on the weighted combination, combined exponential smoothing method, and water quality prediction model of GM (1,1) model. Compared with the literature , the prediction accuracy of this method has been improved to a certain extent, but there is a problem of excessive error, which cannot be solved. Literature  and Literature  proposed an improved water quality prediction model based on the gray GM(1,1) model, which is much better than the traditional gray GM(1,1) model. The BP neural network has the advantages of self-learning and fault tolerance, which is widely used in water quality prediction. In the literature , BP neural network was applied to the study of water quality evaluation and temporal-spatial evolution trend of water quality. The results showed that the evaluation results of this method were more objective and the evaluation process was more convenient. Aiming at the problem of low prediction accuracy of small sample data and easy to fall into local optimum of BP neural network, a water quality prediction model of double hidden layer BP neural network based on artificial bee colony algorithm is proposed in the literature , the initial weights and thresholds of BP neural network are optimized by the ABC algorithm, and the prediction accuracy is improved. However, the BP neural network with double hidden layers has overfitting, which easily leads to the decrease of the generalization ability of the prediction model.
Aiming at the problems existing in the current water quality prediction model, this paper improves the local and global search ability of the ABC algorithm by adding adaptive local search factors and mutation factors. The improved ABC algorithm is used to optimize the weights and thresholds of the BP neural network, and the improved ABC-BP hybrid neural network model is obtained. Taking the water quality monitoring data of the source of Dan River (Shangzhou District) from 2015 to 2019 as the research object, compared with GA-BP, PSO-BP, ABC-BP, and BP models. The results show that the algorithm has the highest prediction accuracy and faster convergence speed.
2. Principle of BP Neural Network
BP neural network is mainly composed of input layer, hidden layer (one or more layers), and output layer . The neurons in the same layer are not interconnected, and the neurons in the adjacent layer are connected by weights, and the output of each layer of nodes only affects the input of the nodes of the lower layer. The BP neural network model structure is shown in Figure 1. The learning process of the BP neural network is mainly composed of two parts: forward propagation of signal and backpropagation of error. In the forward propagation process of the signal, after the input signal passes through the network weight, threshold, and neuron transfer function, an output signal can be obtained in the output layer. If the error between the output value and the expected value is greater than the specified amount, then the error will be entered The backpropagation process of the error, that is, through the error return layer by layer, the error is “allocated” to the neurons of each layer, and the weight is self-adjusted until the error between the output data value of the output layer and the expected data value reaches the preset range, then the training of the network is completed.
Suppose the number of nodes in the input layer, hidden layer, and output layer of the BP neural network is n, m, and l, respectively; the weights between the input layer and the hidden layer and the weights between the hidden layer and the output layer are and , respectively; the thresholds of the hidden layer and the output layer are and , respectively; is the transfer function; the expected output of the output layer is .
The output of the hidden layer node and the output layer node is
The error between the output value and the expected output is
It can be seen from the error formula that the error can be changed by adjusting the weights and , and the weight adjustment is proportional to the drop of the error gradient, then for the output layer and the hidden layerwhere is the learning rate,
Among them, the transfer function , then .
BP weight adjustment formula is
Since the BP neural network has slow convergence speed and low prediction accuracy, it cannot meet the performance requirements of water quality prediction. Therefore, this paper uses an improved artificial bee colony algorithm to optimize the weights and thresholds of the BP neural network to improve its water quality prediction performance.
3. Artificial Bee Colony Algorithm
In order to solve the problem of multivariate function optimization, Karaboga proposed the artificial bee colony (ABC) algorithm model in 2005, which simulates the honey-collecting behavior of bees to search for global optimization goals [11, 12].
3.1. Basic Artificial Bee Colony Algorithm
Artificial bee colony algorithm is a swarm intelligence optimization algorithm that simulates the process of bees searching for the best quality and the largest number of nectar sources in nature. The algorithm contains three types of bee colonies: collecting bees, observing bees, and investigating bees. The nectar source is a possible solution in the solution space. Assuming that the algorithm is solved in the K-dimensional space, the total amount of nectar source is N, and the initial position formula is .where is the position of the initial solution, and are the upper and lower bounds of j dimension, ; ; And both are randomly generated and are not equal to each other; is a randomly generated number between 0 and 1.
Suppose the probability of finding a new high-quality nectar source and being selected is
In the formula, represents the ith nectar source, that is, the fitness value of the solution. If the fitness of the new solution is higher than the original solution, it will be replaced by the new solution.where is the objective function value of the ith solution.
When falling into the local optimum, the honey bee will abandon the nectar source and become a scout bee. According to formula (9), a new nectar source position will be randomly generated to replace the corresponding position in the initially marked nectar source to determine the final nectar source. According to this, iteration is carried out repeatedly until the termination condition of the algorithm is reached .
In the formula, ; , and t is not equal to i, both t and j are randomly generated; is a randomly selected value between [1,−1].
3.2. Improved Artificial Bee Colony Algorithm
In order to enhance the global optimization and local search capabilities of the algorithm, adaptive local search factors and mutation factors are added to improve the ABC algorithm to avoid premature phenomena .
3.2.1. Adaptive Search Factor
In the initial search stage of the algorithm, an adaptive local search factor is introduced to prevent falling into local optimization. The local search is enhanced by adaptively adjusting the population update step size, and the global and local search capabilities of the algorithm are balanced. That is, equation (9) is updated to
In the formula, is the previous worst source of nectar.
The introduction of can speed up the algorithm convergence speed and avoid premature maturity. The change of iswhere and are the maximum and minimum values of inertia weight; is the maximum number of maximum mixing iterations between the subpopulations; represents the total number of iterations of the current subpopulation.
3.2.2. Variation Factor
In order to improve the global optimization ability and accuracy of the algorithm, the mutation factor Levy is introduced. Compared with other operators (such as the Gaussian operator, etc.), the mutation factor can greatly improve the global optimization ability of the algorithm and prevent the algorithm from emergence of precocious puberty. The introduction of the Levy mutation factor enhances the global optimization capability of the algorithm based on the adaptive factor. The specific implementation is to add the Levy mutation operator to equation (3) and update it to the following equation:
In the formula, is a random number that obeys the Levy distribution.
4. Improved Water Quality Prediction Model of ABC-BP Algorithm
In this paper, a water quality prediction model is established by improving the ABC-BP algorithm. The input of the BP neural network is ammonia nitrogen (NH3–N), dissolved oxygen (DO), chemical oxygen demand (COD), permanganate index (IMn), and total phosphorus, six water quality evaluation indicators of total nitrogen and total nitrogen, and the output is the water quality grade. The water quality prediction model is shown in Figure 2, and the algorithm flow chart is shown in Figure 3.
Step 1. Take 6 indicators of NH3–N, DO, COD, IMn, total phosphorus, and total nitrogen as the input of the BP network for training.
Step 2. Optimize the weights and thresholds trained by the BP network.
Step 3. Determine whether the output data O and the error value meet the requirements, if the requirements are met by the formula (6), the optimal solution is the output, and the optimal weight and threshold are obtained.
Step 4. If the requirements are not met, the search bee will find a new nectar source according to formula (13) and output the value of the solution.
Step 5. Repeat the loop, and finally get the optimal solution.
Step 6. If the number of calculations exceeds the set maximum number of iterations, the training ends, otherwise the function of formula (7) is returned.
Step 7. Obtain the optimal solution, and verify the BP neural network according to the weight and threshold.
5. Experimental Analysis
5.1. Data Source
In order to verify the reliability and effectiveness of the improved ABC-BP algorithm for water quality prediction, the water quality measurement data from the six monitoring points in the Shangzhou section of Shangluo City in the Danjiang River Basin from 2015 to 2019 was used as the research object for experimental research. The geographical distribution and latitude and longitude information of water quality monitoring points are shown in Figure 4 and Table 1, respectively.
5.2. Water Quality Evaluation Index
Water quality evaluation is the process of determining the water quality level of the sampled water sample based on the various index values of the sampled water sample and the water quality evaluation standard, combined with a certain mathematical model . Since there are many indicators for water quality analysis , combined with surface water environmental quality standards, the water quality evaluation indicators used in this article are DO, NH3–N, COD, IMn, total phosphorus and total nitrogen , which correspond to The water quality grades and content standards are shown in Table 2.
5.3. Data Preprocessing and Evaluation Indicators
In order to improve the accuracy of the predicted data, use formula (15) to normalize the data and convert the data to the range of [−1, 1].
In the formula, represents the original water quality data, is the maximum value in the original data sequence, is the minimum value in the original data sequence, and y represents the data after the normalization transformation, which can reduce the difference between the result and the actual value The deviation. In order to facilitate the comparison of water quality grade evaluation of different evaluation methods, formula (16) is used as the evaluation index of water quality grade evaluation:
In the formula, C represents the accuracy of evaluation; N is the total number of samples; TN is the number of samples correctly classified.
5.4. Experimental Results and Analysis
The water quality measured data from 2015 to 2019 in the Shangzhou section of Shangluo city in the Danjiang River basin was selected as the research object. After sorting, the measured data was divided into two parts: a training set and a test set. The training set was mainly used to establish a Danjiang water quality prediction model, the test set is mainly used to test the pros and cons of the built model. In order to verify the superiority of the improved ABC-BP algorithm, it is compared with GA-BP, PSO-BP, and ABC-BP algorithms.
Six indicators of NH3–N, DO, COD, IMn, total phosphorus, and total nitrogen were used as the input of the improved ABC-BP model, and the water quality grade was used as the output of the improved ABC-BP model to establish the improved ABC-BP water quality evaluation model [18, 19]. This article sets the number of input layer nodes of the BP network inputnum = 6, the number of hidden layer nodes hiddennum = 20, the output layer node outputnum = 5, the hidden layer transfer function is the purelin function, the output layer transfer function is the logsig function, and the training function is the trainlm function, The maximum number of training times is set to 1000 times, and the learning accuracy target is 0.0001. Different algorithms are run independently for 10 times, and the average of the 10 water quality prediction results is used as the final evaluation result. The population size of GA-BP, PSO-BP, and ABC-BP algorithms are all set to 10, the maximum number of iterations is 100, the search interval is [−1,1], the algorithm runs 10 times independently, and the results of 10 water quality predictions The average value is used as the final evaluation result . The results are shown in Table 3, Figures 5 and 6.
From the comparison results of the evaluation accuracy in Table 3, it can be seen that in the training set and test set, the optimal accuracy rate of improved ABC-BP is the highest, 96.58% and 97.32%, respectively, and the accuracy rate is higher than that of GA-BP, PSO-BP, and ABC-BP; compared with the ABC-BP, the optimal accuracy rate is increased by 3.64% and 3.28%, respectively; compared with the PSO-BP, the optimal accuracy rate is increased by 3.90 and 4.07%, respectively; compared with the GA-BP, the optimal accuracy rates were increased by 3.86% and 3.99%, respectively, indicating that the improved ABC-BP can effectively improve the accuracy of water quality evaluation.
On the training set and test set, the worst and average accuracy rates of the improved ABC-BP algorithm are higher than those of GA-BP, PSO-BP, and ABC-BP, which shows that the improved ABC-BP algorithm has better stability and robustness.
Figures 7 and 8 are the simulation comparison diagrams between the single BP neural network algorithm, the improved ABC-BP algorithm, the standard ABC-BP algorithm iteration number, and the target error. From the figure, it can be seen that the improved ABC-BP algorithm, the number of iterations of the BP algorithm tending to the target error value is lower than that of the other two algorithms. When the standard ABC algorithm falls into the local optimization, the improved ABC-BP algorithm can jump out of the local optimization. Due to the addition of the levy factor and the adaptive factor, the prediction accuracy, convergence speed, and stability of the improved ABC-BP algorithm are greatly improved. Figure 9 is a fitting diagram of actual output and target output. It can be seen from the figure that the fitting is better, indicating that the improved ABC-BP algorithm has better convergence.
In order to compare and study the influence of different hidden layer node numbers, learning rate, and iteration number parameters on the water quality prediction and evaluation results, the accuracy rates of different parameters were compared, and the results are shown in Figure 10.
It can be seen from Figure 10(a) that the accuracy rate of the water quality evaluation model gradually increases with the number of hidden layer nodes. When the number of nodes is 20, the accuracy rate reaches the maximum, and when the number of hidden layer nodes increases, the accuracy rate gradually decreases, and the network complexity increases. Therefore, considering the prediction accuracy, network generalization ability, and complexity, the best number of hidden layer nodes of the BP neural network is 20. It can be seen from Figure 10(b) that as the learning rate increases, the accuracy of the water quality evaluation model gradually increases. When the learning rate is 0.05, the accuracy reaches the maximum, and after it exceeds 0.05, the accuracy gradually increases and then it reduces. It can be seen that when the learning rate is 0.05, the effect of the model is the best, and the generalization ability and accuracy rate reach the best state. It can be seen from Figure 10(c) that as the number of iterations increases, the accuracy of the water quality evaluation model gradually increases. When the number of iterations is about 500, the prediction accuracy is the highest. After more than 500, the accuracy increases with iterations. The increase in frequency gradually decreases. It can be seen that when the number of iterations is about 500, the local search ability and global search ability of the model are the best, and the accuracy rate is the highest. At the same time, the iteration time and prediction accuracy of GA-BP, PSO-BP, ABC-BP, and improved ABC-BP are compared, and the results are shown in Table 4. Analysis of the results shows that the improved ABC-BP algorithm has the shortest iteration time, the highest accuracy, and the best model. The above analysis lays the foundation for the construction of the later water quality evaluation model and the study of parameter selection.
In order to build a stable, reliable, and highly accurate water quality prediction model, an improved ABC-BP algorithm model is proposed. By adding the adaptive local search factors and mutation factors, the local and global search capabilities of the ABC algorithm are improved to improve the performance of local search and avoid local optimal conditions. The improved ABC algorithm is used to optimize the weights and thresholds of the BP neural network and establish a water quality grade prediction model. Taking the water quality monitoring data of Danjiang source (Shangzhou section) from 2015 to 2019 as the research object, compared with GA-BP, PSO-BP, ABC-BP, and BP models, the research results show that the improved ABC-BP algorithm has lower iterations, faster convergence speed, highest prediction accuracy, and has good engineering application and promotion value. Since there are fewer evaluation indicators that affect the water quality grade in this article, more water quality evaluation methods with more influencing factors will be studied later to further improve the applicability of the model.
The datasets used and/or analyzed during the current study are available from the corresponding author on reasonable request.
Conflicts of Interest
The author(s) declare no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
The authors acknowledge the National Natural Science Foundation of China (Grant: 61876143), Shaanxi Provincial Department of Education 2019 Special Scientific Research Plan Project (Grant: 19JK0261), Shaanxi Provincial Department of Science and Technology 2019 Scientific Research Plan Project (Grant: 2019JQ-541), and Special Project of Shangluo University Serving Local Scientific Research (Grant: 19FK002).
L. I. Xiao-gang, B Qiao-hui, and P Jiang-li, “Grain size analysis and heavy metal pollution assessment of river surface sediments in Danjiang River basin,” Acta Agriculturae Jiangxi, vol. 31, no. 4, pp. 93–98, 2019.View at: Google Scholar
Y. Cheng, G. Xu, L. I Peng, X.-J. Liu, T.-G. Zhang, and L. Fei-Fei, “Spatial variation characteristics of runoff nutrients in Dan River,” Journal of Northwest A&F University, vol. 44, no. 4, pp. 93–99, 2016.View at: Google Scholar
L.-L. Guo, Z.-H. Zou, and A. N. Yan, “Study on water quality forecast based on GM(1,1) residual modification model,” Mathematics in Practice and Theory, vol. 44, no. 19, pp. 176–181, 2014.View at: Google Scholar
D. Liu and Z. Zou, “Application of weighted combination model on forecasting water quality,” Acta Scientiae Circumstantiae, vol. 32, no. 12, pp. 3128–3132, 2012.View at: Google Scholar
M. Xu, Y. Fu, Z. Liu, G. Li, and P. Qu, “Forecasting of water quality using grey GM(1,1) -wavelet-GARCH hybrid method in Songhua River Basin,” Transactions of the Chinese Society of Agricultural Engineering, vol. 32, no. 10, pp. 137–142, 2016.View at: Google Scholar
C. Zhang, Y. Luo, and P. Lv, “Application of grey metablism GM(1,1) in the quality prediction of water in main stream yangtze river,” Environment and Ecology in the Three Gorges, vol. 34, no. 4, pp. 11–14, 2012.View at: Google Scholar
Y. Ran, W. He, X. Lei, and H. Xia, “Application of GM(1,1) model and improved model to predict the water Quality of Weihe River in Tianshui section,” Journal of Water Resources &Water Engineering, vol. 22, no. 5, pp. 88–91, 2011.View at: Google Scholar
Y. He, Y. Tang, L. Chen, Y. Li, A. Jing, and J. Xiao, “Evaluation of water quality based on BP neural network and study of the temporal and spatial evolution trend of water quality,” Environmental Protection Science, vol. 44, no. 3, pp. 114–120, 2018.View at: Google Scholar
C. Su, N. Xiang, G. Chen, and F. Wang, “Water quality evaluation model based on artificial bee colony algorithm and BP neural network,” Chinese Journal of Environmental Engineering, vol. 6, no. 2, pp. 699–704, 2012.View at: Google Scholar
J. I. Guang-yue, “Prediction of Xijiang River water quality based on improved particle swarm optimization and BP neural network,” CHINESE JOURNAL OF HYDRODYNAMICS, vol. 35, no. 5, pp. 567–574, 2020.View at: Google Scholar
S Yan-xia, J. Chen, and W. U. Ding-hui, “A multi-objective artifificial bee colony based on evolutionary knowledge integrated,” Control and Decision, vol. 32, no. 12, pp. 2176–2182, 2017.View at: Google Scholar
Q. Liu, H. Xu, and C. Shi, “Research on power flow optimization based on multi-objective artificial bee colony algorithm,” Power System Protection and Control, vol. 43, no. 8, pp. 1–7, 2015.View at: Google Scholar
W. Tan, Y. Wang, and S. Li, “Crack identification of asphalt pavement surface based on improved artificial bee colony algorithm and BP neural network,” Journal of Railway Science and Engineering, vol. 16, no. 12, pp. 2991–2998, 2019.View at: Google Scholar
J. Wu, H. Ding, X. Ma, B. Yan, and X. Wang, “Application of improved adaptive bee colony optimization algorithm in transformer fault diagnosis,” Power System Protection and Control, vol. 48, no. 9, pp. 174–180, 2020.View at: Google Scholar
X. Sun and X. Sun, “Study on water quality classification forecast based on MFOA-ELM,” Journal of Chinese Agricultural Mechanization, vol. 40, no. 8, pp. 176–181, 2019.View at: Google Scholar
L. Zhu, Y. Wang, M. Han, Y. Zhu, H. Yu, and Y. Song, “Spatio-temporal distribution of water quality and source identification of pollution in Wushui River Basin,” Acta Scientiae Circumstantiae, vol. 38, no. 6, pp. 2150–2156, 2018.View at: Google Scholar
L Bing, Y Gui-shan, W Rong-rong, L Bao-gui, D Xue, and X Chen, “Temporal variability of water quality in poyang lake outlet and the associated water level fluctuations:A water quality sampling revelation,” Resources and Environment in the Yangtze Basin, vol. 26, no. 2, pp. 289–296, 2017.View at: Google Scholar