COD Optimization Prediction Model Based on CAWOA-ELM in Water Ecological Environment

,e change of water quality can reflect the important indicators of ecological environment measurement. Sewage discharge is an important factor causing environmental pollution. Establishing an effective water ecological prediction model can detect changes in the ecological environment system quickly and effectively. In order to detect high error rate and poor convergence of the water ecological chemical oxygen demand (COD) prediction model, combining the limit learning machine (ELM) model and whale optimization algorithm, CAWOA is improved by the sin chaos search strategy, while the ELM optimizes the parameters of the algorithm to improve convergence speed, thus improving the generalization performance of the ELM. In the CAWOA, the global optimization results of the WOA are promoted by introducing a sin chaotic search strategy and adaptive inertia weights. On this basis, the COD prediction model of CAWOA-ELM is established and compared with similar algorithms by using the optimized ELM to predict the water ecological COD in a region. Finally, from the experimental results of the CAWOA-ELM algorithm, it has excellent prediction effect and practical application value.


Introduction
With the acceleration of economic development and industrialization, the situation of China's water pollution ecological environment is becoming more and more serious, and industrial and urban water discharge have become the main pollution source [1]. erefore, the establishment of an effective water quality ecological prediction model can not only optimize urban water ecological detection but also is essential for reducing ecological water pollution. However, the formation of the water ecological environment is a complex physical and chemical process, which is influenced by many factors such as factory emissions, domestic water use, and human factors [2]. ese variables are coupled with each other, making it difficult to describe these complex processes with mechanism models. e emergence of learning technology provides an effective way to establish a water ecological detection optimization model [3,4].
A multiobjective problem proposed in the literature [5] is applied in the activated sludge process. rough the genetic algorithm, it is used to process under the conditions of 14 optimized parameters, and the wastewater COD concentration is reduced by 2.22 mg/L after optimization. e effect of multiobjective problem optimization is obvious, and the parameter optimization combination is the best. Dong et al. [6] proposed a system optimization plan to adjust sewage discharge and predicted COD concentration to adjust the sewage discharge model. e optimized model can improve the water quality of the river and optimize the drainage system more effectively. An et al. [7] proposed to optimize the low dissolved oxygen-oxygen-anoxia process, which can solve the problem of low-cost wastewater treatment, thereby providing a new method for low-cost treatment of COD. Nazrifar et al. [8] optimized the influence of COD, pH, H2O2, FeSO4,·and 7H2O content on the overall target. When the value reaches 4, 8 ml/L, 2.33 g/L, the model is optimal, and the effect of COD is 83.51. In the CO 2 emissions, Lim and Kim [9] proposed dynamic optimization to evaluate the production of concrete components. Reuse kinetics to optimize related parameters, and as a result, CO 2 emission costs can be saved. In the NO x and CO emission model, the dynamic optimization algorithm proposed in [10] greatly reduces the NO x and CO emissions. In terms of performance, the proposed dynamic optimization model can reduce emissions.
ELM is a new and effective machine learning technology based on the Moore-Penrose (MP) generalized inverse matrix theory [11]. Weights and thresholds in the neuron weights are given randomly, and then the output weights are calculated by the regularization principle. e ELM network can still approximate any continuous system. Compared with the ANN and SVM, ELM has an advantage of greatly improving learning speed relatively, which has attracted more and more scholars' attention [12,13]. erefore, the prediction model of boiler water ecological COD is adopted by the ELM.
However, ELM regression method is given at random. Without any prior experience, it is easy to cause problems such as the generalization ability and stability of the regression model. In practice, in order to achieve the desired error precision, the ELM usually needs to adjust the weight and threshold. erefore, a sin chaos AWOA is proposed to accelerate the convergence of ELM parameters to improve the stability and the ELM prediction model and further propose a water ecological optimization prediction model of CAWOA-ELM. It is applied to the prediction of river surface water, domestic sewage, and industrial wastewater in a city.
e results show that CAWOA-ELM can accurately predict COD, accurately predict water ecology, and provide an effective means for the promotion of relevant emission optimization.

Chaos Adaptive Whale
Optimization Algorithm 2.1. WOA. WOA [14] is an optimization algorithm that simulates the natural world and was put forward in 2016 to simulate the predation behavior of whale populations. is algorithm is simple to set up and has few parameters. When optimizing the benchmark function, it has the advantages of the traditional imitation algorithm (such as particle swarm optimization algorithm (PSO) [15] and gravity search algorithm (GSA) [16]). However, compared with other swarm intelligence algorithms, traditional WOA also have problems of slow convergence, premature convergence, and global optimal value is not available. Based on this, in recent years, many scholars have implemented many effective improved WOA, such as Kaur and Arora [17] used the chaotic map to optimize the update probability p in WOA, proposed a CWOA, and verified the algorithm with higher convergence speed through the test of benchmark function; Mafarja and Mirjalili [18] combined the annealing algorithm and WOA for the optimization precision of the algorithm, improved the global search ability, and obtained good results in the experiment of publicly testing 18 datasets in the UCI library.

Shrinkage Surrounding Mechanism.
In the WOA, assuming that the size of the whale population is expressed as N and d is to represent the dimensionality, the i-th position whale in the d-th dimension can be expressed as e position keeps changing as the problem is solved, and the most optimal solution is described by the optimal position. e whales are all surrounded by optimal solutions. e mathematical model is described as follows: where t is the number of iterations. A and C are coefficient vectors, which are defined as follows: where r 1 and r 2 are the random numbers [0, 1] in the formula. e control parameters are defined as follows: where T max is the maximum iteration number. e contraction bounding mechanism is realized through the reduction of parameter α by means of (1) and (4).

Bubble Network Attack.
In the WOA, two methods are designed to describe the predation behavior of whales: shrinkage surrounding mechanism and spiral renewal position.
(a) Shrinkage enveloping mechanism: it is achieved by reducing the convergence factor α in equations (2) and (4). (b) Spiral update position: first, the distance between the whale individual and the current optimal position is calculated, and then the whale is simulated to capture food in a spiral manner. e mathematical model can be expressed as in which D ′ � |X p (t) − X(t)| denotes the distance between whales and the prey, b is a constant that defines the shape of a logarithmic spiral, and L is a random number [−1, 1] in the middle. e whale's contraction and envelopment mechanism and spiral updating position's mode are synchronized. e new mode of upd ating P i is usually chosen according to the probability value: if p < P i , X(t + 1) is updated in formula (5); otherwise, formula (6) is used to update: When |A| ≥ 1, the whales are randomly selected to force them away from the reference whales to find a better prey in order to enhance the global exploration ability of the algorithm. e mathematical model is expressed as follows: in which X r indicates the position vector of the whale randomly selected.

2.2.
CAWOA. e shortcomings of the WOA algorithm in dealing with complex optimization problems are low convergence accuracy and easy to fall into local optimum. In view of the above deficiencies, the CAWOA is proposed to improve the global optimization capability of the algorithm. On the basis of WOA, logistic chaotic search strategy is introduced to enhance the ability of the algorithm to jump out of the local optimum. In addition, adaptive inertia weights are introduced into position updating to solve the problem of low convergence accuracy by balancing the development and exploration capabilities.

Sin Chaotic Search Strategy.
Chaotic mapping is a stochastic motion state obtained by the deterministic equation, which has periodicity and inherent randomness in the phase space, realizing global optimization by optimizing the search ability. Yang and Jiaqiang [19] verified that sin chaos has more obvious chaotic characteristics than logistic chaos does. In order to overcome the shortcomings of the local optimum when WOA deals with complex function optimization problems, sin chaotic search is used to search the optimal individuals (elite individuals) of each generation of the WOA for M times of chaotic search. If better individuals are found, they are replaced. It can avoid the local optimum and effectively avoid the WOA falling into the local optimum. e sin chaotic mapping model is defined as follows: is a randomly generated initial vector whose dimension cannot be zero, thus avoiding producing fixed points and zeros in [−1, 1], and its dimension is the same as that of the optimization problem. e iteration counter of the chaotic map is represented by t, and the output of the system traverses the whole solution space by M chaotic iterations.
Assuming that the optimal individuals in the WOA population are X i , the chaos optimization process in the feasible region is Among them, V t i represents a new individual searched by the algorithm; α is the adaptive parameter that controls the chaotic search direction; c ∈ 0, 1 ; and [V min , V max ] is the chaotic search space. Assuming that the elitist solution of the i generation of the WOA is X i � (x i1 , x i2 , . . . , x i D ), the sin chaotic search steps are as follows: Step 1: normalization of X i by using the following formula: Step 2: generating chaotic sequences. Random gener- Step 3: generating M chaotic sequences by substituting formula (9), and generating M chaotic variable se- Step 4: using formula (10) to reverse the normalization of V k i and generate a new solution U k in the field of the original solution space, where (k � 1, 2,. . .,M): e fitness value f(U k ) of U k is calculated and compared with the fitness value f(X i ) of X i , retaining the best solution.

Adaptive Inertia Weight.
Inertia weight is an important parameter in WOA. e inertia weight of formulas (1) and (5) is larger than that of formula (1). Constant invariant inertia weight will reduce the efficiency of the algorithm, which is not conducive to the global optimization of the algorithm. Zhang et al. [20] pointed out that, as the inertia weight increases, the global optimal value is easier to obtain, while a smaller inertia weight can easily achieve local optimization [21,22]. On this basis, an adaptive inertial weight algorithm based on the fitness value is proposed to ensure that Algorithm 1 has a large nonlinear weight at the beginning of the iteration, with different adaptive values, and a small nonlinear weight strategy at the end of the iteration. e following adaptive inertia weights are introduced in formulas (1) and (6): In the formula, f fit (x) represents the individual fitness value, u represents the best fitness value, and u represents the iteration number. e updated formula is as follows: Journal of Chemistry

ELM Optimization Model
3.1. Basic ELM. ELM solves the problem of long time consumption of the BP neural network. However, because the common limit learning machine only contains one hidden layer, the characterization ability of the network is very limited. Compared with the BP neural network which uses the gradient descent method to update weights, ELM has two characteristics: (1) e weights are randomly set and do not need to be adjusted after setting (2) e weights are generated by solving the least squares without iterative updating To solve the output weight of the hidden layer, a standard model can be expressed as follows.
e ELM model is defined as where o is the actual model output, the training purpose of SLFNs is to minimize the output error, and the cost function E of the limit learning machine can be seen as follows: where y is the actual data tag, in the limit case, the output of the network is close to the zero error of the actual data tag, and min(E(S, β)) can be seen: where H, β, and T are, respectively, expressed by the following formula: ELM uses this above model to obtain the output weight of the hidden layer. e above model can be expressed as follows: en, the solution model of the hidden layer output weight can be expressed as e least squares solution is defined as where H † is the generalized inverse matrix of H, which can be obtained by singular value decomposition. As can be seen from the above introduction, the learning process of the whole network of the limit learning machine only needs to be solved once. Relative to the BP network, the training time of the network is very short. At the same time, because the hidden layer input weights of the limit learning machine are randomly generated and do not need iterative updating, ELM solves the local minimum problem existing in the BP neural network.
Using the dynamic nonlinear characteristics to improve the convergence accuracy and speed of the WOA, the flowchart of the CAWOA is as follows: e maximum iteration is T max , the population number is N, and N initial whale populations {X i , i � 1, 2,. . .,N} are generated. e fitness value { f (X i ), i � 1, 2,. . .,N } of each whale individual is calculated, and the best individuals are recorded. While (t < T max ) do for i � 1 to N do According to formula (10), the value of adaptive inertia weight W is calculated. According to formula (4), the value of control parameter alpha is calculated.
Updating the values of other parameters A, C, l, and P. If (p < 0.05) do According to formula (11)  Journal of Chemistry

ELM Work Flow.
Because ELM has a good performance in function regression without prior knowledge, CAWOA is used in combination with the ELM model. e ELM model trains the input sample data, and CAWOA optimization is used to obtain the optimal parameter value.
Step 1: initialization of WOA: N is the population number, and the random input value of each individual is set to x j � (ω 11 , . . . , ω 1M , ω 21 , ω 22 , . . . , ω m1 , . . . , Step 2: variable selection and data acquisition: to verify good performance of the algorithm proposed, a variety of functions are applied for comparative analysis. Unimodal function and multimodal function are used.
Step 5: model validation: verifying the performance of the CAWOA-ELM model using test data.

Test Function Selection.
In order to test the CAWOA-ELM performance, a comprehensive and reasonable experiment is provided. Simulation experiments (including unimodal function and multimodal function) are carried out on 4 benchmark tests, and the corresponding functions are selected as follows: where D is the dimension, ub and lb are the min and max bounds of decision variables, respectively, and f min represents the global optimal value. Among the above four functions, formulas (22) and (23) are unimodal test functions, and formulas (25) and (26) are bimodal test functions.

Algorithm Parameter Setting.
When simulating the algorithm, the population size N � 30, the dimension D � 30, and the maximum iteration t max � 1000. e running environment of the algorithm is "Windows 7 (64-bit)," "CPU E3-1230 with 32 GB," and "MATLAB 2016b." For the statistical analysis of the algorithm, each algorithm runs M � 20 times independently for each benchmark test function and counts its results. All function experiment parameter settings are consistent, and the initial population of all algorithms is consistent.

Journal of Chemistry
In the formula, k represents the number of successes in m repeated experiments (i.e., the results calculated by the algorithm in this experiment are better than the set standard).

Algorithm Test Comparison.
In order to test the performance of CAWOA-ELM algorithm and the correlation test function to obtain the correlation output value when different input values are used, CAWOA-ELM is compared with whale optimization algorithm (WOA), particle swarm optimization (POS), and biogeography-based optimization (BBO). Table 1 displays the simulation value of 4 algorithms on 4 benchmark test functions. e best value (BV), worst value (WV), mean value (MV), standard deviation (SD), and success rate (SR) obtained by running all algorithms for 30 times are given. Table 1 shows that, under the condition of test level α � 0.5, taking CAWOA-ELM algorithm as the benchmark, and comparing the other three algorithms, it is found that the proposed algorithm can have high experimental results. e WOA, PSO algorithm, BBO algorithm, and CAWOA-ELM algorithm in Table 1 verify the good value and analyze the performance under the above four functions. When the variable dimension is 30, it can be seen from Table 1 that CAWOA-ELM algorithm obtains the optimal value in more aspects of sex.
After comparing the data obtained from 30 simulation experiments, the functions f2 and f4 can be optimized, all of which are 0. However, CAWOA-ELM is better than WOA, PSO, and BBO algorithms in the average and SD of functions. In CAWOA-ELM, the mean value and standard deviation of optimal values are obviously better than those of PSO algorithm. For test functions, GA, BBO algorithm, and CAWOA-ELM algorithm are obviously superior to the PSO algorithm in terms of MV and SD optimal values. e convergence of CAWOA-ELM algorithm is further verified. By iterating through four algorithms, the convergence of the algorithm at different times is verified. e SD value decreases continuously with the increase of iteration times. e algorithm convergence analysis is shown in Figure 1. e convergence analysis of the overall algorithm shows that CAWOA-ELM algorithm has better convergence than other algorithms in the overall performance. When the number of iterations is 500, the convergence of the CAWOA-ELM model tends to be stable, and the overall fitness value is better than that of other algorithms.

Experimental Data.
e water environment quality prediction is the creation of a reliable prediction model through the stored water quality monitoring data. It is well known that water quality monitoring data are obtained through real-time monitoring of national or provincial water quality monitoring stations. pH, conductivity, turbidity, dissolved oxygen (DO), CODKMnO4, ammonia nitrogen, total nitrogen, and total phosphorus are proposed in the environmental protection industry standard "Automatic Analyzer Technology for Water Quality Index" (HJ-T100-2003) issued by the Ministry of Environmental Protection. e total organic carbon (TOC) 9 standards are environmental protection industry standards. e revised announcement includes routine monitoring projects such as pH, ammonia nitrogen, total nitrogen, and total phosphorus. At the same time, chemical oxygen demand (COD), biochemical oxygen demand (BOD), and some heavy metal ions are also the water quality parameters that people hope to monitor. erefore, combined with the national announcement and actual needs, this paper selects five indicators that indicate water environmental quality provided by water quality monitoring stations, namely, COD, pH, dissolved oxygen, ammonia nitrogen, and total phosphorus. COD refers to the mass concentration of oxygen corresponding to an oxidant consumed by a strong oxidant in a chemical process to oxidize a reducing substance in water. COD is a key indicator for indicating the degree of pollutants in water and an important pollution parameter in the operation and management of wastewater treatment plants.
e monitoring data of a water plant monitoring station in a city are taken as the research object. e water plant monitoring station records the data of each parameter in the water body every 6 hours. Due to the reasonable interval between data collection, the recorded data can fully reflect the water quality of the water plant. e data of the water plant monitoring station from January 20 to June 18 are selected in the experiment, and the CAWOA model is trained using the data from January to May 2018. Subsequently, the water quality parameter data of June are input into other trained prediction models for testing, and the expected value is compared with the actual value and analyzed.

CAWOA-ELM Simulation Experiment.
e CAWOA is combined with the ELM model to optimize the parameters of the water ecosystem to reduce the COD emission concentration of water pollution. Firstly, the CAWOA is applied to optimize the ELM model parameters, and then the test samples are used to verify the accuracy and generalization ability of the CAWOA-ELM model. Taking the ecological environment of a certain water area as the research object, the data of COD emissions are tested in multiple groups, and various operational parameters such as pH, DO, NH3-N, TP, and COD that affect the water quality characteristics are predicted and selected. 30 groups of data are compared experimentally, 20 groups of samples are selected for training optimization modeling, and the remaining 10 groups are used as test samples to verify the accuracy and generalization ability of the model. e selected 20 sets of training data and the other 10 sets of predicted data are subjected to regression prediction, and the predicted values are as shown in Figure 2. In order to verify the superiority of this algorithm in modeling, this algorithm is compared with four models of BBO-ELM, PSO-ELM, WOA-ELM, and  Journal of Chemistry 7 standard ELM. e absolute value of the prediction error of each method is shown in Figure 2.
As can be seen from Figure 2(a), the CAWOA-ELM model can better predict training and test samples, and there are some errors in predicting samples. As can be seen from Figure 2(b), the data in samples 17, 18, and 19 do not participate in the training of the model, and compared with other participating training samples, the error is relatively large, which is in line with the principle of system modeling. It can be further found that the predicted performance of BBO-ELM is comparable to that of PSO-ELM, while the predictive performance of WOA-ELM is poor, especially for the three future samples that are not involved in training. e performance of the ELWO model optimized by CAWOA has been greatly improved compared with the WOA-ELM model.
To further describe the superiority of the CAWOA-ELM, the predictive value (PV) and relative error (RE) of training samples 17, 18, and 19 are shown in Table 2. From Table 2, we can see that the predicted value of CAWOA-ELM works very well, and the error values are 0.07, 0.11, and 0.21, respectively. e error values of 0.07, 0.11, and 0.21 are the smallest of the five models, especially for WOA-ELM and standard ELM models. It shows that the CAWOA-ELM model has good accuracy and generalization ability. e CAWOA-ELM prediction model provides an effective means for accurate prediction calculation of COD.

Conclusion
Water ecological environment discharge has multidimensional characteristics, many factors lead to the prediction effect, and the multidimensional characteristic relationship is relatively complex, which makes the prediction difficult. It can effectively predict the COD value of water ecological discharge. A combined prediction model based on the CAWOA-ELM algorithm is proposed. In order to test the advantages of the algorithm, CAWOA-ELM algorithm is compared with WOA, PSO, and BBO algorithms. e convergence proves that the CAWOA-ELM algorithm has faster convergence effect. A CAWOA-ELM model for predicting COD is set up, in which 30% of the samples are used as test samples and 70% as training sets. e model is used to train and test datasets. e COD values detected by the CAWOA-ELM model have good accuracy, and the differences between the other models can be used as an application model for predicting COD values.  Data Availability e raw data supporting the conclusions of this article will be made available from the corresponding author upon request, without undue reservation.

Conflicts of Interest
e authors declare that they have no conflicts of interest regarding this work.