A method, system and device for predicting water consumption based on time series

Through the time series-based water consumption prediction method, the optimized least squares support vector machine and population optimization algorithm are used to solve the problem of inaccurate water consumption prediction in water plants, achieve more accurate water consumption prediction and liquid level balance, and reduce The occurrence of water hammer phenomenon.

CN113947240BActive Publication Date: 2024-08-27XIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111165076.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2024-08-27
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

The existing water consumption prediction method of water plants is inaccurate, making it difficult to maintain a balanced water level in the reservoir, which may cause water hammer.

Method used

A water consumption prediction method based on time series is adopted, by obtaining historical water flow data, using pre-optimized least squares support vector machine for processing, and combining the population optimization algorithm and Nelder-Mead algorithm to optimize model parameters to improve prediction accuracy.

Benefits of technology

It achieves more accurate water consumption prediction, maintains water level balance in the reservoir, reduces the occurrence of water hammer, and improves the effectiveness of model parameter selection and algorithm convergence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113947240B
    Figure CN113947240B
Patent Text Reader

Abstract

The present invention discloses a water consumption prediction method, system and device based on time series, including obtaining historical water flow and establishing an actual data set; using a pre-optimized least squares support vector machine to process the actual data set to obtain a predicted water flow time series; matching the predicted water flow time series to a set time period to obtain the corresponding predicted water consumption. It can be used to more accurately predict water consumption, so that the water plant can maintain the liquid level balance of the water reservoir, and can effectively reduce the occurrence of water hammer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of single-objective optimization research in swarm intelligence evolutionary computing, and specifically belongs to a water consumption prediction method, system and equipment based on time series. Background Art

[0002] There are many methods for calculating water consumption in water plants, such as support vector machines, long short-term memory neural networks, etc. However, the parameters of these models are difficult to determine based on historical experience, or improper selection of parameters will cause large deviations between water consumption prediction and actual water consumption. Failure to accurately predict water consumption may make it difficult to maintain a dynamic balance of the water level in the reservoir, resulting in a shortage of water or an oversupply of water, and in severe cases, water hammer may occur. Therefore, correctly predicting water consumption can enable water plants to maintain a balanced water level in the reservoir and effectively reduce the occurrence of water hammer. Summary of the invention

[0003] In order to solve the problems existing in the prior art, the present invention provides a water consumption prediction method, system and device based on time series to solve the problem of inaccurate water consumption prediction in the prior art.

[0004] To achieve the above-mentioned object, the present invention provides the following technical solutions: a method for predicting water consumption based on time series, comprising: obtaining historical water flow and establishing an actual data set;

[0005] The actual data set is processed using a pre-optimized least squares support vector machine to obtain a predicted water flow time series;

[0006] According to the predicted water flow time series, the corresponding predicted water consumption is obtained by matching it to the set time period.

[0007] Furthermore, the optimization steps for optimizing the least squares support vector machine are as follows:

[0008] Randomly generate multiple groups of model parameters as populations, each group of model parameters is an individual in the population, and the mean square error function is used as the fitness function;

[0009] According to the fitness value of each individual in the population, each individual is divided into elite individuals and ordinary individuals;

[0010] Determine whether to update the historical optimal solution to the current global optimal solution based on the distance between the historical optimal solution in the population and the current global optimal solution in the population;

[0011] Select the final seed from elite individuals or ordinary individuals, and generate new individuals in the population based on the final seed and the updated historical optimal solution;

[0012] Determine whether the fitness value of the new individual is less than the fitness value of the previous generation of individuals. If so, select the next generation of individuals according to the Nelder-Mead algorithm. Otherwise, the i-th counter count i If the value after adding 1 is greater than the threshold, the i-th individual based on adversarial learning is obtained; the updated population is obtained, and the global optimal solution is obtained based on the updated population;

[0013] Determine whether the termination condition is met. If not, return to the step of dividing elite individuals and ordinary individuals and continue to execute sequentially. Otherwise, output the global optimal solution, which is the optimal model parameter. The optimal model parameter is the parameter that minimizes the fitness function value.

[0014] The parameters of the least squares support vector machine are updated to the optimal model parameters to obtain a pre-optimized least squares support vector machine.

[0015] Furthermore, the specific steps of determining whether to update the historical optimal individual to the current generation global optimal solution based on the distance between the historical optimal solution in the population and the current generation global optimal solution in the population are as follows:

[0016] If the global optimal solution of the current generation is higher than the fitness value of the historical optimal individual, calculate the average Euclidean distance between the solutions other than the global optimal solution in the elite individuals of the current generation and the historical optimal solution. If the distance between the global optimal solution of the current generation and the historical optimal solution is greater than the average Euclidean distance, update the historical optimal solution to the global optimal solution of the current generation.

[0017] Furthermore, the update conditions for updating the historical optimal solution to the current global optimal solution are as follows:

[0018]

[0019] Where: function Dis is used to calculate the Euclidean distance between two points, X best and X gbest represent the current global optimal solution and the historical optimal solution respectively, elites represents the grouping of elite individuals, |elites| represents the size of the elite grouping, and when the above conditions are met, X gbest Update to X best .

[0020] Furthermore, the specific steps for selecting the final seed from elite individuals or ordinary individuals are as follows:

[0021] For each individual in the initial population, generate a random number rand;

[0022] If rand < pe%, randomly select an individual TY1 from the elite individuals as the final seed TY with a probability of pone%, otherwise randomly select two individuals YY1 and TY2 from the elite individuals as the preselected seeds;

[0023] Otherwise, randomly select an individual TY1 from the ordinary individuals as the final seed TY with a probability of pone%, otherwise randomly select two individuals TY1 and TY2 from the ordinary individuals as the preselected seeds;

[0024] If the final seed TY has been generated, skip this step; if two preselected seeds TY1 and TY2 are selected, the final seed TY is generated through the following formula:

[0025] TY = R × TY1 + (1 - R) × TY2

[0026] In the formula, TY1 and TY2 are the selected preselected seeds, and R is a random number.

[0027] Furthermore, the specific steps to generate new individuals in the initial population based on the final seed and the updated current-generation global optimal solution are as follows:

[0028] After selecting the final seed, new individuals in the initial population are generated through the following formula:

[0029]

[0030] In the formula: is the generated new individual, is the historical optimal solution, rand d is a random number, and are two individuals randomly selected from the population, is the final seed, and C is a parameter that increases with the number of generations.

[0031] Furthermore, the specific steps to select the next-generation individuals are as follows:

[0032] If f(Y i ) < f(X i ) : Perform the Nelder-Mead algorithm on the individuals of the previous generation. After the iteration is completed, generate the individual X NMA , if f(X NMA ) < f(Y i ), then replace X NMA with X i as the next-generation individual, otherwise replace X i with Y i as the next-generation individual.

[0033] Furthermore, the formula for opposition-based learning is as follows:

[0034]

[0035] Where: For individuals after adversarial learning, is the original individual, A d and B d denote the lower and upper bounds of the d-th dimension respectively.

[0036] The present invention also provides a system for a water consumption prediction method based on a time series, comprising a data acquisition module, a time series module and a water flow prediction module;

[0037] The data acquisition module is used to acquire historical water flow and establish an actual data set;

[0038] The time series module is used to process the actual data set through a pre-optimized least squares support vector machine to obtain a predicted water flow time series;

[0039] The water flow prediction module is used to match the predicted water flow time series to a set time period to obtain the corresponding predicted water consumption.

[0040] The present invention also provides a computing device, comprising:

[0041] One or more processors, a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for executing any of the methods described above.

[0042] Compared with the prior art, the present invention has at least the following beneficial effects:

[0043] The present invention provides a method for predicting water consumption based on time series. By establishing an actual data set through the acquisition of historical water flow, and then using an optimized least squares support vector machine to process the actual data, a predicted water flow time series can be obtained, wherein the water consumption presents a regularity to a certain extent, and this regularity is affected by time and environmental factors, especially the time factor. Therefore, we use time series to predict water consumption to more accurately represent this regularity and make the prediction more precise. Therefore, when solving problems in the actual engineering field, the present invention can be used to more accurately predict water consumption, so that the water plant maintains the liquid level balance of the reservoir, and at the same time can effectively reduce the occurrence of water hammer.

[0044] Furthermore, multiple groups of model parameters are used as populations, each group of model parameters is an individual in the population, and the mean square error function is used as the fitness function. After the population is divided into elite individuals and ordinary individuals, the distance between the historical optimal solution and the global optimal solution of the current generation is used to determine whether to update the historical optimal solution to the global optimal solution of the current generation. The traditional greedy selection strategy, that is, when the fitness of the new solution is better than the old solution, the old solution will be discarded. If the discarded old solution may have more potential, then the possibility of falling into the local optimum is increased. The new historical optimal solution archiving mechanism of the present invention enables individuals to learn from the optimal solution with a certain probability, which enhances the convergence of the algorithm. Moreover, after generating new individuals, after adding the Nelder-Mead method to the selection strategy, the neighborhood area of ​​the parent generation solution is fully developed. When the traditional population evolution tends to stagnate, the reinitialization strategy adopted is random reinitialization. The randomness of this method is too large and it is difficult to achieve the expected effect. The present invention selectively selects the next generation during the population update process to retain more potential solutions. At the same time, the stagnant individuals are reinitialized by using the learning strategy based on opposition. Compared with the original random reinitialization, the improper selection of the optimal solution in the process of traditional individuals learning to the optimal solution may lead to falling into the local optimum. The learning strategy based on opposition of the present invention is more targeted. It not only ensures diversity, but also avoids the big problem of individual randomness caused by the random reinitialization strategy. In summary, the present invention can effectively solve the single-mode problem and the combination problem, so as to obtain the optimal model parameters, and input the optimal model parameters and the water flow data set into the least squares support vector machine model. The model parameters are an important guarantee for the accuracy of time series prediction. The present invention substitutes the obtained optimal model parameters into the time series prediction model, so as to obtain more accurate prediction data. When solving problems in the actual engineering field, the algorithm proposed by the present invention can better develop potential solutions, so as to more effectively obtain better solutions in engineering fields such as machine learning model optimization and time series prediction, and can be used to more accurately predict water consumption, so that the water plant maintains the liquid level balance of the reservoir, and at the same time can effectively reduce the occurrence of water hammer.

[0045] Furthermore, the new historical optimal solution archiving mechanism enables individuals to learn from the optimal solution with a certain probability, thereby enhancing the convergence of the algorithm. The traditional method updates the historical optimal solution by direct comparison, which easily causes the solution to fall into the local optimum. The historical optimal solution archiving mechanism proposed in the present invention is based on Euclidean distance, and the historical optimal solution is updated only when the update conditions are met. This can ensure to a certain extent that the new historical optimal solution maintains a certain distance from the old historical optimal solution, thereby reducing the probability of falling into the local optimum.

[0046] Furthermore, the present invention generates new individuals in combination with the historical optimal solution on the one hand, which can increase the convergence of the population. On the other hand, it generates new individuals by using the final seeds, which ensures the diversity of the population. In addition, the parameter C is used to dynamically adjust the probability of the historical optimal solution to ensure global convergence.

[0047] Furthermore, the present invention selects the next generation of individuals based on the Nelder-Mead algorithm. In the traditional greedy selection strategy, if the offspring is better than the parent, a replacement will occur, which may cause those potential parents to be replaced prematurely, thus falling into a local optimum. The next generation of individuals selected based on the Nelder-Mead algorithm fully develops the parent individuals on the basis of greedy selection and discovers potential parent individuals.

[0048] Furthermore, the present invention also uses adversarial learning to update individuals in the population. The traditional random reinitialization strategy is too random and there is a high possibility that the generated solution is still poor. The reinitialization based on the adversarial learning strategy is guided rather than blind. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 These are the results of MLBSO and other optimization algorithms running on the single-mode function F1 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0050] Figure 2 These are the results of MLBSO and other optimization algorithms running on the single-mode function F2 in the CEC2014 test function. The dimension is 30 and the number of evaluations is 300,000.

[0051] Figure 3 These are the results of MLBSO and other optimization algorithms running on the single-mode function F3 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0052] Figure 4 These are the results of running MLBSO and other optimization algorithms on the combined function F23 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0053] Figure 5 These are the results of running MLBSO and other optimization algorithms on the combined function F24 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0054] Figure 6 These are the results of running MLBSO and other optimization algorithms on the combined function F25 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0055] Figure 7 These are the results of running MLBSO and other optimization algorithms on the combined function F26 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0056] Figure 8 These are the results of running MLBSO and other optimization algorithms on the combined function F27 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0057] Fig. 9 These are the results of running MLBSO and other optimization algorithms on the combined function F28 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0058] Fig.10 These are the results of running MLBSO and other optimization algorithms on the combined function F29 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0059] Fig.11 These are the results of running MLBSO and other optimization algorithms on the combined function F30 in the CEC2014 test function, with a dimension of 30 and 300,000 evaluations.

[0060] Fig.12 It is a schematic diagram of the process of the present invention;

[0061] Fig.13 It is a schematic diagram of the system structure of the present invention; DETAILED DESCRIPTION

[0062] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

[0063] The present invention provides a water consumption prediction method based on time series. The optimal solution of model parameters is selected through a new brainstorming optimization method (MLBSO). The algorithm introduces the Nelder-Mead method proposed by Caponio et al. into the selection strategy, fully develops the old solution, reduces the probability of falling into the local optimum, and increases the diversity. When individuals in the group tend to stagnate, MLBSO uses an opposition-based learning strategy to reinitialize the individuals, solving the problem of large randomness caused by the random initialization strategy. In addition, a new optimal solution archiving mechanism is proposed, so that individuals learn from the optimal solution with a certain probability, while improving the convergence of the algorithm and the accuracy of the output parameters. The selection of model parameters will have a greater impact on the prediction results. Correctly predicting water consumption can enable the water plant to maintain the liquid level balance of the reservoir, and can effectively reduce the occurrence of water hammer. In the stock market, accurate prediction of market changes can bring greater guiding significance to stockholders' stock selection. It is often difficult to dig out the optimal parameters based on people's experience alone. Therefore, an optimization algorithm is used to find the optimal parameters to better optimize the model, make the prediction of the time series more accurate, and reduce property or other losses.

[0064] like Fig.12 As shown, specifically, the present invention establishes an actual data set by acquiring historical water flow;

[0065] The actual data set is processed using a pre-optimized least squares support vector machine to obtain a predicted water flow time series;

[0066] According to the predicted water flow time series, it is matched to the set time period to obtain the corresponding predicted water consumption.

[0067] Among them, the historical water flow is divided into slices according to continuous fixed time periods, and each slice is used as an empirical data. The next time point of this slice is the data to be predicted. The entire empirical data constitutes the actual data set. The actual data set and a set of randomly initialized model parameters are input into the least squares support vector machine for training. The quality of the parameters is judged according to the training error, and then the parameters are iterated and optimized through MLBSO. Finally, a set of optimal model parameters can be found, and then the optimal model parameters are input into the least squares support vector machine to obtain the optimal model. Then all actual data sets are input into the optimal model to realize water consumption prediction based on time series.

[0068] Specifically, the purpose of optimizing the least squares support vector machine is to find the parameters corresponding to the minimum fitness function, so as to obtain a set of optimal parameters. Then, the optimal parameters and the established actual data are divided into a training set and a validation set and substituted into the support vector machine model for training. After a certain iterative process, time series optimization is performed to obtain more accurate water consumption prediction results.

[0069] Specifically, the present invention further comprises the following steps:

[0070] Step 1: Population initialization. The initial population is obtained by randomization. Specifically, a model is first selected for time series prediction, such as the least squares support vector machine model. Multiple groups of support vector machine model parameters are randomly generated within a given range as the population. Each group of model parameters is an individual in the population, and the mean square error function is used as the fitness function.

[0071] Randomly generate N individuals within a given range, where each individual has D dimensions. The resulting initial population is:

[0072] X={X1,X2,…,X N}

[0073] in, For an individual.

[0074] Step 2: Evaluate fitness.

[0075] For each individual X in the initial population i Calculate its fitness value f(X i ). And select the best individual as the initial historical optimal solution X gbest .

[0076] Step 3: Divide the population by fitness value. The individuals ranked in the top p% of fitness are divided into elite individuals, and the group consisting of elite individuals is recorded as elites. The rest of the individuals are ordinary individuals, and the group consisting of ordinary individuals is recorded as normal.

[0077] Step 4: Update the historical optimal solution. If the global optimal solution of the current generation has a higher fitness than the historical optimal solution, calculate the average Euclidean distance between the other solutions in the current generation of elite individuals except the global optimal solution and the historical optimal solution. If the distance between the global optimal solution of the current generation and the historical optimal solution is greater than the average Euclidean distance, update the historical optimal solution to the global optimal solution of the current generation. The update condition formula is described as follows:

[0078]

[0079] Among them, Dis(x,y) is used to calculate the Euclidean distance between two points x and y. best and X gbest represent the current global optimal solution and the historical optimal solution respectively, elites represents the grouping of elite individuals, and |elites| represents the size of the elite grouping. gbest Update to X best .

[0080] Step 5: Random perturbation. Randomly select an individual with a probability of p_replace%, and randomly replace a certain dimension of this individual.

[0081] Step 6: Generate new individuals. For each individual in the population, perform the following operations:

[0082] 6.1 Generate a random number rand.

[0083] 6.2 Select the seed TY for generating new individuals in the following way.

[0084] If rand < pe%, generate a new individual from the elite individuals.

[0085] Randomly select an individual TY1 from the elite individuals as the final seed TY with a probability of pone%, otherwise randomly select two individuals TY1, TY2 from the elite individuals as the preselected seeds.

[0086] Otherwise, generate a new individual from the ordinary individuals.

[0087] Randomly select an individual TY1 from the ordinary individuals as the final seed TY with a probability of pone%, otherwise randomly select two individuals TY1, TY2 from the ordinary individuals as the preselected seeds.

[0088] If two preselected seeds TY1, TY2 are selected, a linear combination of the two preselected seeds needs to be done, and the final seed TY is generated through the following formula:

[0089] TY = R × TY1+(1 - R) × TY2

[0090] In the formula, TY1, TY2 are the two selected preselected seeds, and R is a random number.

[0091] 6.3 Generate new individuals. After selecting the seed, generate new individuals through the following formula:

[0092]

[0093] In the formula, is the generated new individual, is the historical optimal solution, rand d is a random number, and are two individuals randomly selected from the population, is the final seed, and C is a parameter that increases with the number of generations. The parameter C is described by the following formula:

[0094]

[0095] In the formula, t and T represent the current generation number and the maximum generation number respectively, Cmin and C max The preset minimum and maximum values ​​respectively.

[0096] Step 7: Select. If f(Y i ) <f(X i ): for the individual X of the previous generation i Execute the Nelder-Mead algorithm and generate individual X after iteration. NMA , if f(X NMA ) <f(Y i ), then use X NMA Replace X i As the next generation individual, otherwise use Y i Replace X i As the next generation of individuals.

[0097] If the condition f(Y i ) <f(X i ) does not satisfy: for the i-th counter count i Add 1, if count i If it is greater than the threshold, the i-th individual is subjected to opposition-based learning. The updated population is obtained, and the global optimal solution is obtained based on the updated population.

[0098] Specifically, for each individual in the population, perform the following operations:

[0099] If the condition f(Y i ) <f(X i ), go to 7.1; otherwise, go to 7.2.

[0100] 7.1 vs. X i Execute the Nelder-Mead algorithm. The specific process is as follows:

[0101] (1) Select X i The n neighboring points of i Together as the input of the Nelder-Mead algorithm, there are n+1 points, described as:

[0102] {X i-(n / 2) , X i-(n / 2)+1 ,...,X i , ..., X i+(n / 2)-1 ,X i+(n / 2)}

[0103] The set of these n+1 points is denoted as P = {P1, P2, ..., P n+1}.

[0104] (2) Sort these points in ascending order according to their fitness values ​​so that f(P i) ≤ f(P i+1 )。Then calculate the centroid P through the following two formulas c and the reflection point P r :

[0105]

[0106] P r = P c + ρ(P c - P n+1 )

[0107] Evaluate the fitness value of P r to obtain f(P r ).

[0108] (3) If f(P r ) < f(P1), after executing this step, jump to (7); otherwise, jump to (4).

[0109] Calculate the outlier P e through the following formula and evaluate its fitness value to obtain f(P e ).

[0110] P e = P c + χ(P r - P c )

[0111] If f(P e ) < f(P r ), then replace P n+1 with P e ; otherwise, replace P n+1 with P r .

[0112] (4) If f(P r ) < f(P n ), then replace P n+1 with P r , and then jump to (7). Otherwise, judge whether the condition f(P r ) < f(P n+1 ) is satisfied. If it is satisfied, continue to execute this step; otherwise, jump to (5).

[0113] Calculate the outer shrinkage point P oc through the following formula and evaluate its fitness value to obtain f(P oc ).

[0114] P oc = P c + γ(P r - P c )

[0115] If f(P oc )≤f(P r ), then P n+1 Replace with P oc , then jump to (7); otherwise, jump to (6) and perform contraction.

[0116] (5) Calculate the internal contraction point P by the following formula ic , and evaluate its fitness value to obtain f(P ic ).

[0117] P ic =P c -γ(P c -P n+1 )

[0118] If f(P ic )≤f(P n+1 ), then P n+1 Replace with P ic , then jump to (7); otherwise, jump to (6) and perform contraction.

[0119] (6) The contraction is performed by the following formula to obtain the new point P i , and evaluate its fitness value to obtain f(P i ), where i = 2, ..., n + 1:

[0120] P i =P1+σ(P i -P1),i=2,...,n+1

[0121] (7) Determine whether the number of iterations of the Nelder-Mead algorithm reaches the termination condition. If not, continue to return to (2) to execute. Otherwise, output point P1, denoted by X NMA .

[0122] Parameter description: The parameters used in this step are all based on the values ​​recommended by the Nelder-Mead algorithm in the experiment, as follows:

[0123]

[0124] After the iteration is completed, individual X is generated NMA , if f(X NMA ) <f(Y i ), then use X NMA Replace X i As the next generation individual, otherwise use Y i Replace X i As the next generation of individuals.

[0125] 7.2 is the counter count for the i-th one i incremented by 1. If count i is greater than the threshold threshold, then for the i-th individual X i opposition-based learning is performed, calculated by the following formula:

[0126]

[0127] where is the individual after opposition-based learning, is the original individual, A d and B d represent the lower and upper bounds of the d-th dimension respectively.

[0128] Step 8: Determine whether the termination condition is satisfied. If the number of function evaluations FES < MAXFES, return to Step 3; otherwise, terminate the loop and output the global optimal solution. Here, MAXFES is the maximum number of function evaluations; the global optimal solution is the optimal model parameters, and the optimal model parameters are the parameters that minimize the fitness function value; update the parameters of the least squares support vector machine to the optimal model parameters to obtain the pre-optimized least squares support vector machine.

[0129] The effects of the present invention are further illustrated by the following simulation experiments.

[0130] First, given a test function, the test function used in this experiment is the CEC2014 test set. The benchmark functions of CEC2014 include 3 unimodal functions (F1 - F3), 13 simple multimodal functions (F4 - F16), 6 hybrid functions (F17 - F22), and 8 combined functions (F23 - F30).

[0131] Then, the present invention and ten comparison optimization algorithms and their parameters are given, and experiments are carried out under the same conditions. The parameters are all the parameters recommended by the proposers, as shown in the following table:

[0132] Table 1 Comparison algorithms and their parameter settings

[0133]

[0134]

[0135] Finally, initialize the algorithm parameters. In the experiment, we uniformly and randomly initialize 100 30-dimensional individuals in the search space as the initial population, that is, N = 100, D = 30, where the search range of each individual in each dimension is [-100, 100], and the maximum number of evaluations MaxFES = 10000 * D. Benchmark tests are carried out on 30 minimization problems of CEC2014, and each problem is run 30 times, that is, MaxRun = 30.

[0136] According to the specific process of MLBSO proposed above, simulation experiments are carried out on the test function to obtain the optimal solution corresponding to the test function. In order to better illustrate the effect of the present invention, ten other optimization algorithms are selected to carry out simulation experiments on the test function. The selected algorithms include the original BSO algorithm, 8 variants of the BSO algorithm (MBSO, BSO-OS, RPBSO, BSOLS, RGBSO, ALBSO, BSO-AL, IRGBSO) and PSO algorithm, and the algorithm effect of the MLBSO of the present invention is compared. Next, we conduct experiments according to different function types of the CEC2014 test function set.

[0137] The experimental results are shown in Tables 2 to 6. In the table, Mean represents the average fitness of the optimal solution obtained by running the algorithm 30 times. The smaller the value, the better the fitness of the solution and the closer it is to the global optimum. Rank is the ranking of the algorithm according to its fitness value. Total is the cumulative sum of the Rank values ​​of the algorithm on several test functions. The smaller the sum, the better the algorithm. Final Rank is the final ranking of the algorithm determined by the Total value.

[0138] In the test function set, F1-F3 are unimodal functions. The experimental results are shown in Table 2. It can be seen that the MLBSO proposed in this invention performs well on unimodal functions and ranks first in comparison with the other ten optimization algorithms. Figure 1-Figure 3 It can be seen that the MLBSO proposed in the present invention converges faster than other algorithms in the later stage and can accelerate its convergence.

[0139] Table 2 Experimental results of unimodal functions in CEC2014

[0140]

[0141] In the test function set, F4-F16 are simple multi-modal functions. The experimental results are shown in Table 3. It can be seen that the MLBSO proposed in the present invention is slightly inferior to BSO-OS and MBSO in simple multi-modal functions, but the overall results are good, the difference between the data is small, and it ranks third in the comparison with the other ten optimization algorithms.

[0142] Table 3 Experimental results of simple multi-peak functions in CEC2014

[0143]

[0144]

[0145] In the test function set, F17-F22 are hybrid functions. The experimental results are shown in Table 4. It can be seen that the MLBSO proposed in the present invention is slightly inferior to the MBSO in terms of hybrid functions, but the overall results are good, the difference between the data is small, and it ranks second in the comparison with the other ten optimization algorithms.

[0146] Table 4 Experimental results of hybrid functions in CEC2014

[0147]

[0148] In the test function set, F23-F30 are combination functions. The experimental results are shown in Table 5. It can be seen that the MLBSO proposed in the present invention performs well on the hybrid function and ranks first with IRGBSO in comparison with the other ten optimization algorithms. However, in terms of convergence speed, MLBSO converges faster than IRGBSO, which can be seen in Figure 4-Figure 11 It can be seen that if the speed factor is taken into comprehensive consideration, then it can be said that MLBSO is better than IRGBSO.

[0149] Table 5 Experimental results of combined functions in CEC2014

[0150]

[0151]

[0152] It can be seen from the above experimental results that the MLBSO proposed in the present invention can more effectively solve single-mode problems and combination problems than some existing algorithms, and also performs well in simple multi-modal problems and mixed problems. We combine the 30 test functions of CEC2014, accumulate the comprehensive rankings of the above four types of problems, and obtain the results in Table 6. It can be seen that the MLBSO proposed in the present invention has better effects than the other ten algorithms.

[0153] Table 6 Comprehensive ranking of test functions in CEC2014

[0154]

[0155] In summary, the present invention can effectively reduce the occurrence of water hammer when solving practical engineering problems, such as correctly predicting water consumption so that the water plant can maintain the liquid level balance in the reservoir; or in the stock market, accurately predicting market changes can provide greater guidance for stockholders in stock selection. The algorithm proposed in the present invention can better develop potential solutions, thereby more effectively obtaining better solutions in engineering fields such as machine learning model optimization and time series prediction.

[0156] like Fig.13As shown, in another embodiment of the present invention, a system for a water consumption prediction method based on a time series for implementing the above prediction method is provided, comprising a data acquisition module, a time series module and a water flow prediction module;

[0157] The data acquisition module is used to acquire historical water flow and establish an actual data set;

[0158] The time series module is used to process the actual data set through a pre-optimized least squares support vector machine to obtain a predicted water flow time series;

[0159] The water flow prediction module is used to match the predicted water flow time series to a set time period to obtain the corresponding predicted water consumption.

[0160] In another embodiment of the present invention, a terminal device is provided, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used to perform the operation of the water consumption prediction method based on time series, including:

[0161] Obtain historical water flows and build a realistic data set;

[0162] The actual data set is processed using a pre-optimized least squares support vector machine to obtain a predicted water flow time series;

[0163] According to the predicted water flow time series, it is matched to the set time period to obtain the corresponding predicted water consumption.

[0164] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope described in the claims.

Claims

1. A water consumption prediction method based on time series, characterized in that: including, obtaining historical water flow rates and establishing an actual data set; processing the actual data set using a pre-optimized least squares support vector machine to obtain a predicted water flow time series; matching the predicted water flow time series to a set time period to obtain a corresponding predicted water consumption; The optimization steps of the optimized least squares support vector machine are as follows: Randomly generate multiple groups of model parameters as a population. Each group of model parameters is an individual in the population, and the mean square error function is used as the fitness function; Divide each individual in the population into elite individuals and ordinary individuals according to the fitness value of each individual; Judge whether to update the historical optimal solution to the current generation's global optimal solution based on the distance between the historical optimal solution in the population and the current generation's global optimal solution in the population; Select the final seeds from the elite individuals or ordinary individuals, and generate new individuals in the population according to the final seeds and the updated historical optimal solution; Determine whether the fitness value of the new individual is less than the fitness value of the previous generation of individuals. If so, select the next generation of individuals according to the Nelder-Mead algorithm. Otherwise, the i-th counter count i If the value is greater than the threshold after adding 1, the i-th individual after adversarial learning is obtained; Obtain the updated population, and obtain the global optimal solution based on the updated population; Judge whether the termination condition is satisfied. If not, return to the step of dividing elite individuals and ordinary individuals and continue to execute sequentially. Otherwise, output the global optimal solution. The global optimal solution is the optimal model parameters, and the optimal model parameters are the parameters that minimize the fitness function value; Update the parameters of the least squares support vector machine to the optimal model parameters to obtain a pre-optimized least squares support vector machine; The specific steps of selecting the final seeds from the elite individuals or ordinary individuals are as follows: For each individual in the initial population, generate a random number rand; If rand < pe%, randomly select an individual TY1 from the elite individuals as the final seed TY with a probability of pone%, otherwise randomly select two individuals TY1 and TY2 from the elite individuals as the preselected seeds; Otherwise, randomly select an individual TY1 from the ordinary individuals as the final seed TY with a probability of pone%, otherwise randomly select two individuals TY1 and TY2 from the ordinary individuals as the preselected seeds; If the final seed TYTY has been generated, skip this step; if two preselected seeds TY1 and TY2 are selected, the final seed TY is generated through the following formula: TY = R × TY1 + (1 - R) × TY2 In the formula, TY1 and TY2 are the selected preselected seeds, and R is a random number; The specific steps of selecting the next generation of individuals are as follows: If f(Y i ) <f(X i ): Execute the Nelder-Mead algorithm on the individuals of the previous generation, and generate individuals X after the iteration is completed. NMA , if f(X NMA ) <f(Y i ), then use X NMA Replace X i As the next generation individual, otherwise use Y i Replace X i As the next generation of individuals; The formula for opposition-based learning is as follows: Where: For individuals after adversarial learning, is the original individual, A d and B d denote the lower and upper bounds of the d-th dimension respectively.

2. The water consumption prediction method based on time series according to claim 1 is characterized in that: The specific steps of judging whether to update the historical optimal individual to the current generation's global optimal solution based on the distance between the historical optimal solution in the population and the current generation's global optimal solution in the population are as follows: If the current generation's global optimal solution has a higher fitness value than the historical optimal individual, calculate the average Euclidean distance between the other solutions in the current generation's elite individuals except the global optimal solution and the historical optimal solution. If the distance between the current generation's global optimal solution and the historical optimal solution is greater than the average Euclidean distance, update the historical optimal solution to the current generation's global optimal solution.

3. The water consumption prediction method based on time series according to claim 1 is characterized in that: The update conditions for updating the historical optimal solution to the current global optimal solution are as follows: Where: function Dis is used to calculate the Euclidean distance between two points, X best and X gbest represent the current global optimal solution and the historical optimal solution respectively, elites represents the grouping of elite individuals, |elites| represents the size of the elite grouping, and when the above conditions are met, X gbest Update to X best .

4. The water consumption prediction method based on time series according to claim 1 is characterized in that: The specific steps of generating new individuals in the initial population according to the final seeds and the updated current generation's global optimal solution are as follows: After the final seed is selected, new individuals in the initial population are generated using the following formula: Where: For the new individuals generated, is the historical optimal solution, rand d is a random number, and are two individuals randomly selected from the population, is the final seed, and C is a parameter that increases algebraically.

5. A system for predicting water consumption based on time series according to any one of claims 1 to 4, characterized in that: It includes data acquisition module, time series module and water flow prediction module; The data acquisition module is used to acquire historical water flow and establish an actual data set; The time series module is used to process the actual data set through a pre-optimized least squares support vector machine to obtain a predicted water flow time series; The water flow prediction module is used to match the predicted water flow time series to a set time period to obtain the corresponding predicted water consumption.

6. A computing device, characterized in that include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for executing any one of the methods according to claims 1 to 4.