A load prediction method based on adaptive improved mayfly and BP neural network
By optimizing the BP neural network through an adaptive improved mayfly algorithm, the problems of insufficient accuracy and adaptability in power load forecasting are solved, achieving higher accuracy and more adaptive load forecasting results.
Patent Information
- Application Number
- CN202210989752.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-18
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-08-18
AI Technical Summary
Existing power load forecasting methods are insufficient in terms of accuracy and adaptability, especially traditional methods and conventional artificial intelligence algorithms, which are ineffective in dealing with nonlinear power load changes.
An adaptive improved mayfly algorithm is used to optimize the BP neural network. By collecting and normalizing power load data, the weights and thresholds of the BP neural network are iteratively optimized using three-layer wavelet decomposition and the adaptive improved mayfly algorithm. Combined with Sin chaotic mapping, Tent chaotic mapping, Gaussian mutation, incomplete gamma function and random back-learning strategy, the global search ability and adaptability of the algorithm are improved.
It significantly improves the accuracy and adaptability of power load forecasting, avoids the problem of traditional methods and conventional algorithms getting trapped in local optima, and can more accurately predict power load changes in multiple scenarios.
Smart Images

Figure CN115438842B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of power load prediction, and particularly relates to a load prediction method based on adaptive improved mayfly and BP neural network. BACKGROUND
[0002] The load prediction problem is about predicting the power load required by a power enterprise at a certain future time, and is one of the core contents of power grid planning. The power enterprise will predict the variation and development trend of the power load in a future period of time according to the analysis of historical load data and the judgment of future development trend. An accurate load prediction is crucial for the short-term scheduling arrangement and long-term system planning of the power enterprise, and is the basis for formulating power supply planning, development planning, financial planning and the like.
[0003] The existing power load prediction methods can be roughly divided into two categories. One is the traditional prediction method represented by multivariate linear regression, time series analysis, grey prediction and the like. The other is the artificial intelligence algorithm represented by neural network, expert system and the like. Since the power load change is a highly complex nonlinear process, the prediction accuracy of the traditional prediction method and the conventional artificial intelligence algorithm needs to be improved. SUMMARY
[0004] In view of the problems in the background art, the application provides a load prediction method based on adaptive improved mayfly and BP neural network.
[0005] To solve the above technical problems, the application adopts the following technical scheme: a load prediction method based on adaptive improved mayfly and BP neural network, comprising the following steps:
[0006] Step 1, collecting six types of original data of power load, maximum temperature, minimum temperature, average temperature, relative humidity and rainfall of a target area, and forming an original data set after normalizing the maximum and minimum values respectively; normalizing the data:
[0007]
[0008] wherein x ij represents the original value of the jth parameter in the ith index, x ij * is the value after normalization, x imax , x imin are the maximum and minimum values of the parameters in the ith index respectively;
[0009] Step 2, decomposing the original data set into A3, D1, D2 and D3 four waves by three-layer wavelet decomposition;
[0010] Step 3, the structure of the BP neural network is constructed and determined, the learning efficiency, target accuracy and training times are determined, the population size, iteration times, search space upper and lower bounds, search speed upper and lower bounds of the self-adaptive improved mayfly algorithm are determined, and the mayfly population dimension is determined according to the number of BP neural network parameters;
[0011] Step 4, the BP neural network weight and threshold are iteratively optimized by using the self-adaptive improved mayfly algorithm, the prediction model based on the BP neural network is established, and the prediction model is used to predict four wavelets respectively, and the prediction data A3', D1', D2', D3' corresponding to the four wavelets in the prediction period are obtained.
[0012] Step 5, the prediction data A3', D1', D2', D3' are all superimposed to obtain the power load prediction value in the prediction period.
[0013] In the above load prediction method based on the self-adaptive improved mayfly and BP neural network, the construction of the BP neural network in step 3 includes the following formula:
[0014] The input quantity of the input layer is determined:
[0015] The input quantity of the hidden layer is: The output quantity of the hidden layer is: The Sigmoid function of the hidden layer is:
[0016] The input quantity of the output layer is: The output quantity of the output layer is:
[0017] The back propagation error function is:
[0018] Wherein, r(k) is the network model output value, y(k) is the actual output value;
[0019] The value calculated by the back propagation error function is used to correct the weight coefficient of the hidden layer and the output layer in the error back propagation stage, so that the increment of the weight coefficient from the hidden layer to the output layer is:
[0020]
[0021] Wherein, η is the learning efficiency, and α is the inertia coefficient;
[0022] The correction increment of the weight coefficient of the output layer is:
[0023]
[0024] Wherein,
[0025] The weighting coefficient adjustment increment for the hidden layer is:
[0026]
[0027] in,
[0028] In the above-mentioned load prediction method based on adaptive improved mayfly and BP neural network, step 4 of the adaptive improved mayfly algorithm includes the following steps:
[0029] Step 4.1: Initialize all parameters, initialize the male and female mayfly populations using Sin chaotic mapping, calculate the fitness of all individuals, and record the optimal individual and position of male and female mayflies respectively;
[0030] Let the mayfly population be x = {x1, x2, x3, ... x}. n}, where n is the total number of mayflies; for the i-th mayfly individual, x i =[x i,1 ,x i,2 ,x i,3 ...x i,j ], x i,j ∈[0,1], j is the total number of weight thresholds in the BP neural network, and any mayfly individual represents a combination of weight thresholds in the BP neural network; the initial population is generated using the Sin chaotic mapping, defined as follows:
[0031] x n+1 =μsin(πx) n ), x n ∈[0,1]
[0032] Where x represents the component of a mayfly individual in any dimension, and μ is a control parameter ranging from [0,1]; the initial population generated is uniformly distributed throughout the solution space through Sin chaotic mapping; after the Sin mapping is completed, the mayflies are linearly mapped to U[x]. min ,x max ], where x max x min Let x and y represent the upper and lower limits of the weight threshold, respectively; for the i-th mayfly individual x i =[x i,1 ,x i,2 ,x i,3 ...x i,j ] represents all value thresholds of the BP neural network;
[0033] Step 4.2, Movement of female mayflies; The behavioral characteristic of female mayflies is that they fly to male mayflies to reproduce. Let the total number of female mayflies be N.
[0034] set up is the current position of the i-th male mayfly in the search space U at time step t; for distinction from the male mayfly, let is the current position of the i-th female mayfly in the search space U at time step t, which is changed by adding the velocity to the current position:
[0035]
[0036] The position range of the male and female mayflies is U[x min ,x max ], and if the velocity exceeds the range U after being changed, it is limited back to the nearest boundary value;
[0037] The attraction process is set to be that the optimal male attracts the optimal female, and the second optimal male attracts the second optimal female; then the velocity of the female mayfly is:
[0038]
[0039] If the changed velocity exceeds the range [V min ,V max ], it is limited back to the nearest boundary value; where, is the velocity of the i-th mayfly in dimension j = 1,..., n at time step t, is the position of the i-th mayfly in dimension j at time step t; f represents the fitness function, that is, the difference between the predicted value and the actual value obtained by substituting each mayfly into the BP neural network; a3 represents the positive attraction constant; r mf is the Cartesian distance between the female mayfly and the corresponding male mayfly, and the calculation formula is as follows:
[0040]
[0041] where y i,j is the position of mayfly y i in dimension j, and x i,j is the position of mayfly x i in dimension j;
[0042] g' represents the adaptive gravity coefficient of the incomplete gamma function, fl is the random flight coefficient, which is used when the female is not attracted by the male, at which time the female randomly flies, and r is a random number between [-1, 1]; the iterative formula of fl is:
[0043] fl t+1 = fl t · fldamp
[0044] where fl t is the random flight coefficient at time step t, and fldamp is the random flight damping;
[0045] Step 4.3, the movement of male mayflies; let the total number of male mayflies be N;
[0046] Each male mayfly adjusts its own position according to its own experience and the experience of its neighbors; let be the current position of the ith mayfly in the search space U at time step t, the position is changed by adding a velocity to the current position:
[0047]
[0048] where the position of the male mayfly x i ∈ U[x min ,x max ], if the added velocity exceeds U, it is limited back to the nearest boundary value;
[0049] The velocity of the male mayfly is:
[0050]
[0051] If the changed velocity exceeds the range [V min ,V max ], it is limited back to the nearest boundary value; where denotes the velocity of the ith male mayfly in dimension j = 1,..., n at time step t, denotes the position of the ith mayfly in dimension j at time step t; g' denotes the adaptive gravity coefficient of the incomplete gamma function; a1 and a2 are positive attraction constants, respectively used to scale the contribution of the cognitive and social parts; β is a fixed visibility coefficient used to limit the visibility of the mayflies; and r p and r g are the Cartesian distances between x i and pbest i , x i and gbest, respectively, and are calculated as follows:
[0052]
[0053] where x i,j is the position of mayfly x i in dimension j, and X i corresponds to pbest i and gbest;
[0054] f denotes the fitness function, i.e. the absolute value of the difference between the predicted value obtained by substituting each mayfly into the BP neural network and the actual value, f minThe minimum fitness function value of the male mayfly; the optimal position of the male mayfly to perform the nuptial dance, change the speed, d is the nuptial dance coefficient, r is a random number between [-1, 1]; the iterative formula of d is:
[0055] d t+1 = d t ·ddamp
[0056] Wherein, d t is the nuptial dance coefficient at time step t, ddamp is the dance damping;
[0057] Step 4.4, mayfly crossover and variation, generate offspring;
[0058] Select the father from the male mayfly and the mother from the female mayfly, and the two have the same gender population fitness ranking; the optimal individual is obtained by breeding the male and female mayfly of the optimal individual, and the two offspring expressions are obtained by analogy:
[0059] child1 = L·m + (1-L)·f + σN1(0, 1)
[0060] child2 = L·f + (1-L)·m + σN2(0, 1)
[0061] Wherein, child1 is the male offspring, child2 is the female offspring; L is a random number in the range of [-1, 1] obeying Gaussian distribution, m is the father, f is the mother; σN(0, 1) represents a random number obeying Gaussian distribution with mean value 0 and variance 1;
[0062] Step 4.5, update the gravity coefficient, the nuptial dance coefficient and the random flight coefficient;
[0063] Update the nuptial dance coefficient d and the random flight coefficient fl;
[0064] The update formula of the adaptive gravity coefficient of the incomplete gamma function is as follows:
[0065]
[0066] Wherein, Γ(λ, μ) is the incomplete gamma function, λ is a random variable greater than 0, taking 0.1; α is the gravity coefficient control coefficient, taking α = 1.0;
[0067] Step 4.6, population adjustment by Tent chaotic mapping and Gaussian variation;
[0068] Let f(x i ) be the fitness function value of the i-th mayfly, f a be the average value of the population fitness function value, then judge as follows:
[0069] 1) If f(x i ) < f a , i.e. the "convergence" phenomenon occurs, Gaussian mutation is performed, and if the fitness value of the new position is lower than that of the old position, the position is replaced;
[0070] 2) If f(x i ) ≥ f a , i.e. the "divergence" phenomenon occurs, Tent chaotic mapping is performed, and the position is replaced according to the same principle;
[0071] The specific steps are as follows:
[0072] Step 4.6.1, record the mayfly before the change as x i ;
[0073] Step 4.6.2, judge the relative size of f(x i ) and f a : if the former is smaller, go to step 4.6.3; otherwise, go to step 4.6.4;
[0074] Step 4.6.3, linearly map the mayfly from U[x min , x max ] to the range of [0, 1], wherein x max , x min represent the upper and lower limits of the weight threshold, respectively;
[0075] On the basis of Tent chaotic mapping, a random variable is introduced, and improved Tent chaotic mapping is adopted, and the expression is as follows:
[0076]
[0077] Wherein x represents the component of the mayfly individual in any dimension, and N is the number of particles in the chaotic sequence; rand(0, 1) represents a random number in the range of [0, 1]; after Tent mapping is completed, the mapped mayfly is linearly mapped back to U[x min , x max ]; the mayfly at the new position is marked as x i '; go to step 4.6.5;
[0078] Step 4.6.4, Gaussian mutation is adopted, and the expression is as follows:
[0079] mutation(x) = x·[1+σN(0, 1)]
[0080] Wherein x represents the component of the mayfly individual in any dimension, and σN(0, 1) represents a random number subject to Gaussian distribution with mean value of 0 and variance of 1; mutation(x) represents the mutated value; the mayfly at the new position is marked as x i ';
[0081] Step 4.6.5, only when the mayfly fitness function value f(x i ') of the new position is lower than the mayfly fitness function value f(x i ) of the original position, the mayfly in the new position replaces the mayfly in the old position; the expression is as follows:
[0082]
[0083] Step 4.7, a random reverse learning strategy;
[0084] The random reverse learning strategy is as follows:
[0085] mutation(x)=x max +x min -r*x
[0086] Wherein, x represents the component of the mayfly individual in any dimension, x max , x min respectively represent the upper and lower limits of the weight threshold value, and r is a random number between 0 and 1;
[0087] Only when the mayfly fitness function value f(x i ') of the new position is lower than the mayfly fitness function value f(x i ) of the original position, the mayfly in the new position replaces the mayfly in the old position; the expression is as follows:
[0088]
[0089] Step 4.8, update the iteration number t, if the iteration number t is greater than the maximum iteration number T, then exit and output the best mayfly; otherwise, return to step 4.2.
[0090] Compared with the prior art, the beneficial effects of the present application are: based on the most basic mayfly algorithm, (1) using Sin chaotic mapping to initialize the mayfly population; (2) introducing Tent chaotic mapping and Gaussian mutation to adjust the population individuals; (3) introducing an incomplete gamma function to reconstruct the gravity coefficient of adaptive dynamic adjustment; (4) introducing a random reverse learning strategy (ROBL). The global search ability is enhanced, the adaptability of the search is improved, and the overall performance of the algorithm is greatly improved. The adaptive improved mayfly algorithm is used to optimize the weight threshold value of the BP neural network, which avoids the problem that the traditional BP neural network is easy to fall into local optimum during training, and can more accurately solve the multiple scene power load prediction problem, and has strong adaptive ability. BRIEF DESCRIPTION OF DRAWINGS
[0091] Figure 1 A BP neural network structure diagram provided for the embodiment of the present application;
[0092] Figure 2 A flow chart of an adaptive improved mayfly algorithm is provided for an embodiment of the present application.
[0093] Figure 3 A particle swarm optimization algorithm PSO, a basic mayfly algorithm MA, and an adaptive improved mayfly algorithm IMA load prediction curve diagram are provided for an embodiment of the present application. DETAILED DESCRIPTION
[0094] The technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0095] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0096] The present application will be further described in conjunction with specific embodiments, but is not limited to the present application.
[0097] In order to solve the problem of low accuracy and weak self-adaptive ability of the current prediction algorithm, the present embodiment provides a load prediction method based on an adaptive improved mayfly and a BP neural network. The power load, the maximum temperature, the minimum temperature, the average temperature, the relative humidity, and the rainfall of a target area in a time period are collected, and the corresponding weather feature data is collected. After normalization, the original data set is formed. The original data set is decomposed into A3, D1, D2, and D3 four waves by using three-layer wavelet decomposition. The structure, learning efficiency, target accuracy, and training times of the BP neural network are constructed and determined. The population size, iteration times, search space upper and lower bounds, and search speed upper and lower bounds of the adaptive improved mayfly algorithm are determined. The mayfly population dimension is determined according to the number of BP neural network parameters. The BP neural network parameters are iteratively optimized by using the adaptive improved mayfly algorithm. The four waves are predicted to obtain prediction data A3', D1', D2', and D3'. The final load prediction value is obtained by superimposing the prediction data.
[0098] The present embodiment is implemented by the following technical scheme. A load prediction method based on an adaptive improved mayfly and a BP neural network comprises the following steps:
[0099] S1, collecting six types of original data of power load, maximum temperature, minimum temperature, average temperature, relative humidity, and rainfall of a target area, and forming an original data set after normalization of the maximum and minimum values, as shown in FIG. 1. Figure 1 The normalization processing of the data is as follows:
[0100]
[0101] wherein x ij represents the jth parameter original value in the ith index, x ij * is the value after normalization processing thereof, x imax , x imin are the maximum and minimum values of the parameters in the ith index, respectively;
[0102] Step S2, decompose the original data set into A3, D1, D2, D3 four wavelets by using three-layer wavelet decomposition;
[0103] Step S3, construct and determine the structure, learning efficiency, target accuracy and training times of the BP neural network, determine the population size, iteration times, search space upper and lower bounds, search speed upper and lower bounds of the self-adaptive improved mayfly algorithm, and determine the mayfly population dimension according to the number of BP neural network parameters;
[0104] The BP neural network is established according to the following formula:
[0105] The input quantity of the input layer is determined:
[0106] wherein,
[0107] The input quantity of the hidden layer is:
[0108] The output quantity of the hidden layer is:
[0109] The Sigmoid function of the hidden layer is:
[0110] The input quantity of the output layer is:
[0111] The output quantity of the output layer is:
[0112] The back propagation error function is:
[0113] wherein r(k) is the network model output value, and y(k) is the actual output value;
[0114] In the error back propagation stage, the value calculated by the back propagation error function is used to modify the weight coefficient of the hidden layer and the output layer, so as to obtain the increment of the weight coefficient from the hidden layer to the output layer:
[0115]
[0116] wherein η is the learning efficiency, and α is the inertia coefficient;
[0117] The correction increment of the weight coefficient of the output layer is:
[0118]
[0119] wherein,
[0120] The weighting coefficient correction increment of the hidden layer is:
[0121]
[0122] wherein,
[0123] Step S4, iteratively optimizing the BP neural network weight and threshold value by using the adaptive improved mayfly algorithm, establishing a prediction model based on the BP neural network, and using the prediction model to respectively predict the four wavelets to obtain the prediction data A3', D1', D2', and D3' corresponding to the four wavelets in the prediction period;
[0124] As shown in Figure 2 , the adaptive improved mayfly algorithm comprises the following steps:
[0125] S41, initializing parameters and using Sin chaotic mapping to initialize the female and male mayfly population: let the mayfly population x = {x1, x2, x3...x n}, and n is the total number of mayflies. For the i-th mayfly individual, x i = [x i,1 , x i,2 , x i,3 ...x i,j ], x i,j ∈ [0, 1], j is the total number of BP neural network weight threshold values, and any mayfly individual represents a BP neural network weight threshold combination; the initial population is generated by Sin chaotic mapping, which is defined as follows:
[0126] x n+1 = μ sin (πx n ), x n ∈ [0, 1]
[0127] wherein, x represents the component of the mayfly individual in any dimension, and μ is a control parameter ranging from 0 to 1. The initial population generated by Sin chaotic mapping can be uniformly distributed in the entire solution space, thereby improving the quality of the initial population. After the Sin mapping is completed, the mayfly is linearly mapped to U[x min , x max ], wherein x max , x min represent the upper and lower limits of the weight threshold value. For the i-th mayfly individual x i = [x i,1 , x i,2 , xi,3 ...x i,j ], which represents all the threshold values of the BP neural network.
[0128] S42, the movement of female mayflies: the most significant behavior of female mayflies is to fly to male mayflies for reproduction. Let the total number of female mayflies be N.
[0129] Let be the current position of the i-th male mayfly in the search space U at time step t. To distinguish from the male mayfly, let be the current position of the i-th female mayfly in the search space U at time step t. The position is changed by adding the velocity to the current position:
[0130]
[0131] The position range of both male and female mayflies is U[x min ,x max ]. If the added velocity exceeds the range U, it is limited back to the nearest boundary value.
[0132] The attraction process is set to be that the optimal male attracts the optimal female, and the second optimal male attracts the second optimal female. Then the velocity of the female mayfly is:
[0133]
[0134] If the changed velocity exceeds the range [V min ,V max ], it is limited back to the nearest boundary value. Wherein, is the velocity of the i-th mayfly in dimension j = 1,..., n at time step t, is the position of the i-th mayfly in dimension j at time step t. f represents the fitness function, that is, the difference between the predicted value and the actual value obtained by substituting each mayfly into the BP neural network. The smaller the difference is, the more adaptive the mayfly is. a3 represents the positive attraction constant. r mf is the Cartesian distance between the female mayfly and the corresponding male mayfly, and the calculation formula is as follows:
[0135]
[0136] Wherein, y i,j is the position of mayfly y i in dimension j, and x i,j is the position of mayfly x i in dimension j.
[0137] g' is the adaptive gravity coefficient of incomplete gamma function, whose calculation formula is specified in S46. fl is the random flight coefficient, which is used when the female is not attracted by the male, at this time the female flies randomly, r is a random number between [-1, 1]; the iterative formula of fl is:
[0138] fl t+1 = fl t · fldamp
[0139] Where fl t is the random flight coefficient at time step t, and fldamp is the random flight damping.
[0140] S43, movement of male mayfly:
[0141] Let the total number of male mayflies be N. Each male mayfly adjusts its own position according to its own experience and the experience of its neighbors. Assume is the current position of the i-th mayfly in the search space U at time step t, the position is changed by adding a velocity to the current position:
[0142]
[0143] Where the position of the male mayfly x i ∈ U[x min ,x max ], if the added velocity exceeds U, it is limited back to the nearest boundary value. The velocity of the male mayfly is:
[0144]
[0145] If the changed velocity exceeds the range [V min ,V max ], it is limited back to the nearest boundary value. Where represents the velocity of the i-th male mayfly at time step t in dimension j = 1,..., n, represents the position of the i-th mayfly at time step t in dimension j. g' is the adaptive gravity coefficient of incomplete gamma function, whose calculation formula is specified in S46. a1, a2 are positive attraction constants, respectively used to scale the contribution of the cognitive and social parts. β is a fixed visibility coefficient used to limit the visibility of mayflies. And r p and r g are the Cartesian distances between x i and pbest i , x i and gbest, respectively, and the calculation formula is as follows:
[0146]
[0147] where x i,j is the mayfly x i The position in dimension j, X i corresponds to pbest i and gbest.
[0148] f represents the fitness function, that is, the absolute value of the difference between the predicted value obtained by substituting each mayfly into the BP neural network and the actual value, the smaller the value, the more adaptive the mayfly is, f min That is, the minimum fitness function value in the male mayfly. The optimal position male mayfly performs the wedding dance, changes the speed, d is the wedding dance coefficient, and r is a random number between [-1, 1]; the iterative formula of d is: d t+1 = d t · ddamp
[0149] where d t is the wedding dance coefficient at time step t, and ddamp is the dance damping.
[0150] S44, mayfly crossover and mutation, generate offspring:
[0151] Select the father from the male mayfly and the mother from the female mayfly, and the two have the same fitness ranking in the same gender population. The optimal individual is obtained by breeding the male and female mayflies, and the two offspring expressions are obtained by analogy:
[0152] child1 = L·m + (1-L)·f + σN1(0, 1)
[0153] child2 = L·f + (1-L)·m + σN2(0, 1)
[0154] Where child1 is the male offspring, child2 is the female offspring. L is a random number in the range [-1, 1] obeying Gaussian distribution, m is the father, f is the mother. σN(0, 1) represents a random number obeying Gaussian distribution with mean 0 and variance 1.
[0155] S45, update the gravity coefficient, the wedding dance coefficient, and the random flight coefficient:
[0156] The update formulas of the wedding dance coefficient d and the random flight coefficient fl have been stated in S43 and S42.
[0157] The larger gravity coefficient has good global search ability; the smaller inertia weight has better local development ability. A nonlinear decreasing adaptive gravity coefficient needs to be introduced to better balance the global search and local development ability. However, considering that the gravity coefficient with a deterministic mathematical expression will search according to a fixed rule, it is easy to fall into local optimization and cannot achieve a real adaptive mechanism. Therefore, the incomplete gamma function is introduced to achieve the above purpose.
[0158] The updating formula of the adaptive gravity coefficient of the incomplete gamma function is as follows:
[0159]
[0160] Wherein, Γ (λ, μ) is an incomplete gamma function, λ is a random variable greater than 0, and α is a gravity coefficient control coefficient. It is verified by experiments that the gravity coefficient control coefficient α has a certain influence on the optimization ability of the algorithm, and when α = 1.0, the adaptive improved mayfly algorithm has good search ability.
[0161] S46, population adjustment based on Tent chaotic mapping and Gaussian variation:
[0162] Let f (x i ) be the fitness function value of the ith mayfly, and f a be the average value of the population fitness function value, then the following is judged:
[0163] 1) If f (x i ) < f a , that is, the "aggregation" phenomenon occurs, Gaussian variation is carried out, and if the new position fitness function value is lower than the old position, the position is replaced;
[0164] 2) If f (x i ) ≥ f a , that is, the "divergence" phenomenon occurs, Tent chaotic mapping is carried out, and the position is replaced according to the same principle.
[0165] The specific steps are as follows:
[0166] S461, record the ith mayfly before change as x i .
[0167] S462, judge the relative size of f (x i ) and f a : if the former is smaller, go to step S463; otherwise, go to step S464.
[0168] S463, first, the mayfly is linearly mapped from U [x min , x max ] to the range of [0, 1], wherein x max , xmin respectively represent the upper and lower limits of the weight threshold value.
[0169] On the basis of Tent chaotic mapping, a random variable is introduced, and the improved Tent chaotic mapping is adopted, and the expression is as follows:
[0170]
[0171] wherein x represents the component of the mayfly individual in any dimension, and N is the number of particles in the chaotic sequence. rand(0, 1) represents a random number in the range of [0, 1]. After the Tent mapping is completed, the mapped mayfly is linearly mapped from [0, 1] back to U[x min ,x max ]. The mayfly at the new position is marked as x i '. Step S465 is performed.
[0172] S464, Gaussian mutation is adopted, and the expression is as follows:
[0173] mutation(x)=x·[1+σN(0,1)]
[0174] wherein x represents the component of the mayfly individual in any dimension, and σN(0, 1) represents a random number subject to Gaussian distribution with a mean value of 0 and a variance of 1; mutation(x) represents the value after mutation. The mayfly at the new position is marked as x i '.
[0175] S465, only when the fitness function value f(x i ' of the mayfly at the new position is lower than the fitness function value f(x i ) of the mayfly at the original position, the mayfly at the new position replaces the mayfly at the original position. The expression is as follows:
[0176]
[0177] S47, random reverse learning strategy:
[0178] In order to increase the population diversity and improve the ability of the algorithm to avoid falling into a local optimal solution, a random reverse learning strategy is adopted, and the formula is as follows:
[0179] mutation(x)=x max +x min -r*x
[0180] wherein x represents the component of the mayfly individual in any dimension, x max , and x min respectively represent the upper and lower limits of the weight threshold value, and r is a random number between [0, 1].
[0181] only when the fitness function value f(xi ) when the mayfly is replaced by a new position. The expression is as follows: i ) when the mayfly is replaced by a new position. The expression is as follows:
[0182]
[0183] S48, update the iteration number t, if the iteration number t is greater than the maximum iteration number T, then exit, and output the best mayfly; otherwise, return to S42.
[0184] S5, superimpose all the predicted data A3', D1', D2', D3', to obtain the predicted power load value of the prediction period.
[0185] Embodiment:
[0186] In this embodiment, for the power grid dataset 1, the following steps are included:
[0187] 1) Obtain the power load, maximum temperature, minimum temperature, average temperature, relative humidity, and rainfall six types of original data of the power grid dataset 1, and perform maximum and minimum value normalization respectively to obtain the original data set.
[0188] 2) Use three-layer wavelet decomposition to decompose the original data set into A3, D1, D2, and D3 four waves.
[0189] 3) The power load is taken as the output, and the other five indicators are taken as the input, the number of single hidden layer nodes is determined to be 12, and the BP neural network structure is 5-12-1; according to the network structure, each mayfly individual contains 85 dimensions, and according to general experience, the upper and lower limits can be set to [-5, 5], and the step is continuous; the individual is calculated by the fitness function to obtain the individual fitness value; according to the mayfly individual, the initial weight and threshold value of the BP neural network are obtained, and after training the BP neural network with the training data, the prediction system output, the error absolute value between the prediction output and the expected output is marked as the individual fitness value;
[0190] 4) Use the self-adaptive improved mayfly algorithm to iteratively optimize the BP neural network weight and threshold value, and after the maximum iteration number is reached, the optimal weight and threshold value combination is obtained. The optimal weight and threshold value obtained are substituted into the BP neural network, and the A3, D1, D2, and D3 four waves are predicted respectively to obtain the predicted data A3', D1', D2', and D3';
[0191] 5) Superimpose all the predicted data A3', D1', D2', and D3', to obtain the predicted power load value of the prediction period.
[0192] 6) Comparative verification was conducted using the power grid dataset 1 as the experimental object. The BP neural network was optimized using the Particle Swarm Optimization (PSO) algorithm, the Basic Mayfly Algorithm (MA) algorithm, and the Adaptive Improved Mayfly Algorithm (IMA) algorithm, respectively, and the load prediction errors were compared. See Table 1.
[0193] Table 1
[0194]
[0195] Based on the load prediction results of the BP neural network optimized by three optimization algorithms, the analysis of Table 1 shows that when performing load prediction for power grid dataset 1, the particle swarm optimization algorithm (PSO), the basic mayfly algorithm (MA), and the adaptive improved mayfly algorithm (IMA) can all make the load prediction results of the BP neural network more accurate. However, the adaptive improved mayfly algorithm (IMA) proposed in this invention has the best effect.
[0196] like Figure 3 As shown, the iteration count of the three optimization algorithms was set to 600. After 600 iterations, the basic mayfly algorithm MA and the adaptive improved mayfly algorithm IMA basically converged to the global optimum, while the particle swarm optimization algorithm PSO still had a certain gap. In the early stage of iteration, the adaptive improved mayfly algorithm IMA could converge to the global optimum within 50 iterations, while the basic mayfly algorithm MA required about 550 iterations. Although the particle swarm optimization algorithm PSO had a convergence speed close to MA and IMA in the early stage of iteration, it was difficult to escape the local optimum due to its small population diversity. The adaptive improved mayfly algorithm IMA improved the mayfly algorithm through the following four improvements: (1) using Sin chaotic mapping to initialize the mayfly population; (2) introducing Tent chaotic mapping and Gaussian mutation to regulate the individuals in the population; (3) introducing an incomplete gamma function to reconstruct the adaptively dynamically adjusted gravity coefficient; and (4) introducing a stochastic backward learning strategy (ROBL). By enhancing global search capabilities and improving search adaptability, the MA algorithm's global search capability and ability to escape local optima are significantly improved, resulting in performance superior to the other two algorithms.
[0197] The above are merely preferred embodiments of the present invention and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should recognize that any equivalent substitutions and obvious changes made based on the content of this specification should be included within the protection scope of the present invention.
Claims
1. A load forecasting method based on adaptive improvement of mayfly and BP neural network, characterized in that: The method comprises the following steps: Step 1, collecting six types of original data of the target area, including power load, maximum temperature, minimum temperature, average temperature, relative humidity and rainfall, and normalizing the maximum and minimum values to form an original data set; normalizing the data: wherein, denotes the class indicator, original value of the parameter in the , maximum and minimum value of the parameter in the class indicator, respectively; Step 2, decompose the original dataset into , , , four wavelets using three-level wavelet decomposition; Step 3, constructing and determining the structure, learning efficiency, target accuracy and training times of the BP neural network, determining the population size, iteration times, search space upper and lower bounds, and search speed upper and lower bounds of the self-adaptive improved mayfly algorithm, and determining the mayfly population dimension according to the number of BP neural network parameters; Step 4, the weights and thresholds of BP neural network are iteratively optimized by using the self-adaptive improved mayfly algorithm, a prediction model based on BP neural network is established, and the prediction model is used to respectively predict the four wavelets to obtain the predicted data corresponding to the four wavelets in the prediction period , , , ; Step 4.1, initializing parameters, initializing female and male mayfly populations using Sin chaotic mapping, calculating the fitness of all individuals, and recording the optimal individual and position of female and male mayflies respectively; Step 4.2, movement of female mayfly; the behavior of the female mayfly is characterized by flying to the male mayfly to reproduce, assuming the total number of female mayflies is ; Step 4.3, movement of male mayfly; let the total number of male mayflies be ; Step 4.4, mayfly crossing and mutation, generating offspring; Step 4.5, updating the gravity coefficient, wedding dance coefficient and random flight coefficient; updating the wedding dance factor and a random flight factor ; The updating formula of the adaptive gravity coefficient of the incomplete gamma function is as follows: wherein, is an incomplete gamma function, is a random variable greater than 0, taken as 0.1; is a gravity coefficient control coefficient, taken as ; Step 4.6, population adjustment by Tent chaotic mapping and Gaussian mutation; set up For the first The fitness function value of a mayfly. If the fitness function value is the average value of the population, then it is determined as follows: 1) if i.e. the "clustering" phenomenon occurs, a Gaussian variation is performed, and if the new position fitness function value is lower than the old one, the position is replaced. 2) if i.e. the "divergence" phenomenon occurs, the Tent chaotic mapping is performed, and the position replacement is performed according to the same principle; The specific steps are as follows: Step 4.6.1, before the change the mayfly is ; Step 4.6.2, judging the relative magnitude of the values of and : if the former is smaller, go to step 4.6.3; otherwise go to step 4.6.
4. Step 4.6.3, the mayfly is mapped from to a linear mapping to the range [0, 1] where, , respectively represent the upper and lower limits of the weight threshold. On the basis of Tent chaotic mapping, a random variable is introduced, and improved Tent chaotic mapping is used, and the expression is as follows: wherein, represents a component of a mayfly individual in any dimension, is the number of particles within the chaotic sequence; represents a random number in the range [0, 1]; after the Tent mapping is completed, the mapped mayfly is linearly mapped back to from [0, 1]; the mayfly at the new position is marked as ; go to step 4.6.5; Step 4.6.4, Gaussian mutation is used, and the expression is as follows: wherein, represents a component of a mayfly individual in any dimension, represents a random number subject to a Gaussian distribution with a mean of 0 and a variance of 1; represents a value after variation; a mayfly label of a new position is ; Step 4.6.
5. Replace the old position of the mayfly with the new position of the mayfly if the value of the mayfly fitness function at the new position is lower than the value of the mayfly fitness function at the old position ; the expression is as follows: ; Step 4.7, random backpropagation strategy; The formula of the random backpropagation strategy is as follows: wherein, represents a component of a mayfly individual in any dimension, , respectively represent upper and lower limits of a weight threshold value, is a random number between [0, 1]; The mayfly at the new position is replaced by the mayfly at the old position only if the mayfly fitness function value at the new position is lower than the mayfly fitness function value at the old position The mayfly at the new position is replaced by the mayfly at the old position only if the mayfly fitness function value at the new position is lower than the mayfly fitness function value at the old position ; Step 4.8, update the iteration number , if the iteration number is greater than the maximum iteration number , exit, output the best mayfly; otherwise, return to step 4.2; Step 5, predicting data , , , All superimposed, the predicted power load value of the prediction period is obtained.
2. The load forecasting method based on adaptive improvement of mayfly and BP neural network according to claim 1, characterized in that: The construction of the BP neural network in step 3 comprises the following formulae: Determining the input quantity of the input layer: ; wherein the input quantity of the hidden layer is: , the output quantity of the hidden layer is: , and the Sigmoid function of the hidden layer is: ; The input quantity of the output layer is: The output quantity of the output layer is: ; The backpropagation error function is: ; wherein, is the network model output value, is the actual output value; In the error backpropagation phase, the weight coefficients of the hidden layer and the output layer are corrected by the value calculated by the backpropagation error function, so that the increment of the weighting coefficients from the hidden layer to the output layer is: ; wherein, for learning efficiency, is the inertia coefficient; The correction increment of the weighting coefficients of the output layer is: ; wherein ; The correction increment of the weighting coefficients of the hidden layer is: ; wherein .
3. The load forecasting method based on adaptive improvement of mayfly and BP neural network according to claim 1, characterized in that: The self-adaptive improved mayfly algorithm in step 4 further comprises the following steps: mayfly population , is the total number of mayflies; the first mayfly individual has , , is the total number of BP neural network weight threshold values, and any mayfly individual represents a BP neural network weight threshold combination; the initial population is generated by using the Sin chaotic mapping, and is defined as follows: , wherein, represents the component of the mayfly individual in any dimension, is a control parameter ranging from [0, 1]; the generated initial population is uniformly filled throughout the solution space by Sin chaotic mapping; after the completion of Sin mapping, the mayfly is linearly mapped to wherein, , respectively represent the upper and lower limits of the weight threshold; the weight threshold of the first mayfly individual represents all weight thresholds of the BP neural network; set up It is the first A male mayfly in time step In search space The current position in the text; to distinguish it from male mayflies, let... It is the first A female mayfly at time step In search space The current position in the data is determined by adding velocity to the current position. To change the position: The range of male and female mayfly positions is both If the added velocity Exceeds the range It is limited back to the nearest boundary value; The attraction process is set to be that the optimal male attracts the optimal female, and the second optimal male attracts the second optimal female; then the female mayfly speed is: If the changed speed exceeds the range If so, then it is restricted back to the nearest boundary value; where, For the first A mayfly in time step In dimensions The speed on, For the first A mayfly in time step In dimensions The position above; This represents the fitness function, which is the difference between the predicted value and the actual value obtained by substituting each mayfly into the BP neural network; Indicates the positive attraction constant; This is the Cartesian distance between the female mayfly and the corresponding male mayfly, calculated using the following formula: wherein, is a mayfly in a dimension on a position, is a mayfly in a dimension on a position; adaptive gravity coefficient representing an incomplete gamma function, is a random flight coefficient, used when the female is not attracted to the male, in which case the female flies randomly, is a random number between [-1, 1]; The iterative formula for is: wherein is the time step is the random flight coefficient at time t, is the random flight damping; Each male adjusts its position based on its own experience and the experience of its neighbors; set is the thmayfly at time step with current position in search space , changes its position by adding a velocity to its current position: wherein the male mayfly position if the addition speed exceeds the limit is set back to the nearest boundary value; Speed of male mayflies Is: If the changed speed exceeds the range , then limit it back to the nearest boundary value; where, denotes the speed of the th male mayfly at time step in dimension , denotes the position of the th mayfly at time step in dimension ; denotes the adaptive gravity coefficient of the incomplete gamma function; , are positive attraction constants, respectively used to scale the contribution of the cognitive and social parts; is a fixed visibility coefficient used to limit the visibility of mayflies; while and are the Cartesian distances between and , and , respectively, calculated as follows: wherein, is a mayfly in a dimension on a position, corresponds with ; represents the fitness function, that is, the absolute value of the difference between the predicted value and the actual value of each mayfly by putting the mayfly into the BP neural network, is the minimum fitness function value in the male mayfly; the optimal position male mayfly performs the nuptial dance to change the speed, is the nuptial dance coefficient, is a random number between [-1, 1]; The iteration formula of is: wherein, is the time step is the wedding dance coefficient at time t, is the dance damping; The father is selected from the male mayfly, and the mother is selected from the female mayfly, and the two have the same gender population fitness ranking; the optimal individual is obtained by breeding the male and female mayflies, and the two offspring expressions are obtained by analogy: The method comprises the following steps: Step 1, collecting six types of original data of the target area, including power load, maximum temperature, minimum temperature, average temperature, relative humidity and rainfall, and normalizing the maximum and minimum values to form an original data set; normalizing the data: Step 3, constructing and determining the structure, learning efficiency, target accuracy and training times of the BP neural network, determining the population size, iteration times, search space upper and lower bounds, and search speed upper and lower bounds of the self-adaptive improved mayfly algorithm, and determining the mayfly population dimension according to the number of BP neural network parameters; Step 4.1, initializing parameters, initializing female and male mayfly populations using Sin chaotic mapping, calculating the fitness of all individuals, and recording the optimal individual and position of female and male mayflies respectively; Step 4.4, mayfly crossing and mutation, generating offspring; Step 4.5, updating the gravity coefficient, wedding dance coefficient and random flight coefficient; The updating formula of the adaptive gravity coefficient of the incomplete gamma function is as follows: Step 4.6, population adjustment by Tent chaotic mapping and Gaussian mutation; The specific steps are as follows: On the basis of Tent chaotic mapping, a random variable is introduced, and improved Tent chaotic mapping is used, and the expression is as follows: Step 4.6.4, Gaussian mutation is used, and the expression is as follows: Step 4.7, random backpropagation strategy; The formula of the random backpropagation strategy is as follows: The construction of the BP neural network in step 3 comprises the following formulae: In the error backpropagation phase, the weight coefficients of the hidden layer and the output layer are corrected by the value calculated by the backpropagation error function, so that the increment of the weighting coefficients from the hidden layer to the output layer is: The correction increment of the weighting coefficients of the output layer is: The correction increment of the weighting coefficients of the hidden layer is: The self-adaptive improved mayfly algorithm in step 4 further comprises the following steps: The attraction process is set to be that the optimal male attracts the optimal female, and the second optimal male attracts the second optimal female; then the female mayfly speed is: The father is selected from the male mayfly, and the mother is selected from the female mayfly, and the two have the same gender population fitness ranking; the optimal individual is obtained by breeding the male and female mayflies, and the two offspring expressions are obtained by analogy: wherein, is a male offspring, is a female offspring; is a random number obeying a Gaussian distribution in the range [-1, 1], is a father, is a mother; denotes a random number obeying a Gaussian distribution with mean 0 and variance 1.
Citation Information
Patent Citations
Multi-strategy improved mayfly naiad algorithm based on memory mechanism
CN118133875A
Full-working-condition urban underground pipe culvert detection method and system based on intelligent robot
CN118365969A