Electric vehicle energy consumption prediction method and device based on NRBO optimization model
By using a CNN-LSTM-MHA structure based on the NRBO optimization model and combining it with a Newton-Raphson optimizer to optimize parameters, the complexity of energy consumption prediction for pure electric vehicles is solved, achieving high-precision energy consumption prediction and improving the accuracy of vehicle range prediction and energy utilization efficiency.
Patent Information
- Application Number
- CN202511068905.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-10-17
AI Technical Summary
Existing models struggle to effectively handle complex time-series multivariate energy consumption data for pure electric vehicles, resulting in large energy consumption prediction errors. This affects the accuracy of vehicle range prediction and energy utilization efficiency, increasing operating and consumer costs.
The CNN-LSTM-MHA structure based on the NRBO optimization model is adopted, and the model parameters are optimized by Newton-Raphson optimizer. CNN is used to capture local features, LSTM is used to memorize long-term dependencies, and MHA is used to mine variable associations to improve prediction accuracy.
It significantly improves the accuracy and efficiency of electric vehicle energy consumption prediction, adapts to different types of complex energy consumption data, and supports energy management in multiple industries.
Smart Images

Figure CN120804668A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of new energy and energy-saving technology, in particular to an electric vehicle energy consumption prediction method and device based on an NRBO optimization model. BACKGROUND
[0002] In the field of pure electric vehicles, for complex time series multivariate energy consumption data such as current, voltage, temperature under different working conditions in the battery charging and discharging process, and vehicle speed, road conditions and other data, the existing model is difficult to fully mine the spatio-temporal characteristics. At the same time, the traditional optimization algorithm: genetic algorithm or single machine learning model, has the problem of slow convergence speed, and it is difficult to quickly optimize in high-dimensional parameter space.
[0003] Taking the prediction of pure electric vehicle driving energy consumption as an example, the performance of the battery is affected by the interaction of multiple variables such as different driving modes (such as urban congestion, high-speed driving, etc.), environmental temperature, and battery remaining power during vehicle driving. However, the existing model cannot effectively handle the complex relationship between these variables, resulting in large energy consumption prediction error. This makes the remaining driving range of the vehicle not accurate enough, making it difficult for the driver to plan the trip in advance, increasing the risk of the vehicle running out of power halfway; At the same time, it also brings difficulties to the vehicle enterprises in vehicle energy consumption management and range calibration, resulting in low energy utilization efficiency, increasing the operating cost and the use cost of consumers, making consumers have charging anxiety, and reducing the trust of consumers for pure electric vehicles.
[0004] The current common time series prediction model has a simple statistical model and a basic neural network model. The statistical model, such as ARIMA, has a certain effect when dealing with linear relationships, but when facing complex nonlinear and multivariate time series data, the prediction accuracy is limited. The traditional neural network model, the existing method mainly relies on traditional physical models (such as MOBILE, COPERT) or single machine learning models (such as LSTM, CNN), which has the following problems: 1. Single model is difficult to capture long-term dependencies and complex features in data; 2. Model limitations, traditional models cannot capture the nonlinear coupling relationship of multivariate time series data; 3. Low optimization efficiency, gradient descent method is easy to fall into local optimum, and hyperparameter adjustment depends on experience. SUMMARY
[0005] The purpose of the present application is to provide an electric vehicle energy consumption prediction method and device based on an NRBO optimization model to overcome the shortcomings of the prior art.
[0006] In order to achieve the above purpose, the present application provides the following technical solutions: In a first aspect, the present application provides an electric vehicle energy consumption prediction method based on an NRBO optimization model, comprising the following steps: The energy consumption prediction data is collected and preprocessed to obtain a data set for training; The data set is divided into a training set and a validation set; A CNN-LSTM-MHA model is constructed; The parameters of the CNN-LSTM-MHA model are optimized using the Newton-Raphson optimizer NRBO to obtain an NRBO-CNN-LSTM-MHA model; The training set is input into the NRBO-CNN-LSTM-MHA model for training; After multiple rounds of iterative training, the prediction accuracy of the NRBO-CNN-LSTM-MHA model is verified using the validation set; The data set to be predicted is preprocessed and imported into the NRBO-CNN-LSTM-MHA model for energy consumption prediction to obtain the prediction result.
[0007] Further, the process of constructing the CNN-LSTM-MHA model is as follows: Set the initial parameters, determine the convolution kernel size, feature dimension, and output channel number, and initialize the model weights; Build a CNN module to extract local temporal features, build an LSTM module to process time series data, and integrate an MHA module to capture global dependency relationships; Split the LSTM output sequence into multiple heads, each head independently performs attention calculation, then splices and performs linear transformation; Add a global average pooling layer after the MHA layer to reduce dimensionality, then build a fully connected layer to map the pooled features to the output space; The construction of the CNN-LSTM-MHA model is completed.
[0008] Further, the process of optimizing the parameters of the CNN-LSTM-MHA model using the Newton-Raphson optimizer NRBO to obtain the NRBO-CNN-LSTM-MHA model is as follows: Initialize the particle swarm, each particle represents a set of candidate parameters, calculate the fitness of each set of candidate parameters, and update the dynamic decay coefficient to control the search step; Select a reference particle from the particle swarm to calculate the disturbance term, update the particle parameters based on the Newton method principle, and when the trigger condition is met, perturb the particle parameters to obtain new parameters; Boundary constraints are applied to the new parameters, and the loss value corresponding to the new parameters is calculated; Iterate continuously, and when the number of iterations reaches the set threshold, the optimization is completed, and the NRBO-CNN-LSTM-MHA model is obtained.
[0009] Further, the optimization process includes the following steps: Assume that the objective function to be optimized is ,in is the model parameter, solve ; Initialize the particle swarm, each particle Represents a set of candidate parameters, each set of candidate parameters includes CNN convolution kernel weights , LSTM gate weight matrix , MHA multi-head attention weight and the fully connected layer weights , the candidate parameters follow a uniform distribution ,in The parameter value range; Calculating particles Loss value and select the particle with the smallest loss value As an initial reference point ; In each iteration, according to the number of iterations and the maximum number of iterations , calculate each candidate parameter Dynamic attenuation coefficient; In the initialization particle swarm, select two particles that are different from The reference particles a1 and a2; Calculate candidate parameters The disturbance term , ,in obey ; According to the disturbance term Combined with Newton's method to update the candidate parameters, the updated parameters are obtained , the calculation formula is: ;in, is the gradient of the objective function; Update parameters Process and get new parameters , the processing includes introducing a trap avoidance operator TAO; For new parameters Perform boundary constraints, the specific formula is: ; Calculate each new parameter The corresponding loss value ; like , then update the current new parameters And the corresponding loss value At the same time, if , then update the initial reference point ; Iterate continuously, and the number of iterations reaches a set threshold, i.e. the maximum number of iteration rounds , obtain the parameter combination that minimizes the loss, complete the optimization, and obtain the NRBO-CNN-LSTM-MHA model.
[0010] Further, the disturbance term is used to update the candidate parameters according to the Newton method, and the updated parameters are obtained. .
[0011] Further, the trap avoidance operator TAO is introduced, and the specific process is as follows: Random numbers r3 and r4 are generated, and r3 and r4 are subject to . Calculate θ1=-1+2r3, θ2=-0.5+r4, generate random variables u1 and u2, and calculate the population mean W̅. When the value of the random variable u1 is less than 0.5, the disturbance operation on the particle parameters is triggered, and the new parameters are obtained.
[0012] Further, the calculation formula of the new parameters is as follows: .
[0013] Secondly, the application provides an electric vehicle energy consumption prediction device based on an NRBO optimization model, comprising: A collection unit: collecting energy consumption prediction data for preprocessing, and processing the energy consumption prediction data into a data set for training; A data set division unit: dividing the data set into a training set and a validation set; A first model construction unit: constructing a CNN-LSTM-MHA model; A second model construction unit: optimizing the parameters of the CNN-LSTM-MHA model using a Newton-Raphson optimizer NRBO to obtain an NRBO-CNN-LSTM-MHA model; A training unit: inputting the training set into the NRBO-CNN-LSTM-MHA model for training; A verification unit: after multiple rounds of iteration training, verifying the prediction accuracy of the NRBO-CNN-LSTM-MHA model using the validation set; A prediction unit: preprocessing the data set to be predicted, and importing it into the NRBO-CNN-LSTM-MHA model for energy consumption prediction to obtain a prediction result.
[0014] In a third aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0015] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, wherein the computer program implements the steps of the above method when executed by a processor.
[0016] Compared with the prior art, the present application has the following beneficial technical effects: The present application provides an electric vehicle energy consumption prediction method based on an NRBO optimization model, which optimizes the CNN-LSTM-MHA model parameters through a Newton-Raphson optimizer NRBO, captures local features through CNN, remembers long-term dependencies through LSTM, and excavates variable correlations through MHA. The multiple modules work together to more comprehensively and accurately learn the energy consumption data features, greatly improving the prediction accuracy compared with traditional models. The method provided by the present application can adapt to different types of complex energy consumption data, whether it is industrial production, building energy consumption, or energy consumption prediction in the transportation field, it can effectively handle the multivariate and complex relationships therein, and provide strong support for energy management in different industries. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 The figure is a flowchart of the electric vehicle energy consumption prediction method based on the NRBO optimization model in the embodiment of the present application.
[0018] Figure 2 The figure is a process diagram of optimizing the CNN-LSTM-MHA model parameters in the embodiment of the present application.
[0019] Figure 3 The figure is a schematic diagram of the CNN-LSTM-MHA model in the embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to enable the persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by the persons skilled in the art without creative labor should fall within the scope of protection of the present application.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and in the above drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0022] As Figures 1 to 3 The present application provides a method for predicting the energy consumption of an electric vehicle based on an NRBO optimization model, comprising the following steps: Collecting energy consumption prediction data for preprocessing to obtain a data set for training; The preprocessing procedure includes data cleaning (removing outliers and filling missing values), normalization processing, and mapping the data to the [0, 1] interval to eliminate the influence of different variable data dimensions.
[0023] Divide the data set into a training set and a validation set; Build a CNN-LSTM-MHA model; The process of building the CNN-LSTM-MHA model is as follows: Set the initial parameters, determine the convolution kernel size, feature dimension, and output channel number, and initialize the model weights; the convolution kernel size determines the range of local features extracted by CNN, the feature dimension is the number of features of the input data, and the output channel number is the number of feature maps of each layer of CNN, which affects the representation ability of the model to local patterns.
[0024] Build a CNN module to extract local temporal features, build an LSTM module to process time series data, and integrate an MHA module to capture global dependency relationships; split the LSTM output sequence into multiple heads, perform attention calculation on each head independently, then concatenate and perform linear transformation; add a global average pooling layer after the MHA layer to reduce dimensionality, then build a fully connected layer to map the pooled features to the output space; complete the construction of the CNN-LSTM-MHA model.
[0025] CNN module, Convolutional Neural Network (CNN), is responsible for extracting spatial features of data. It slides convolution kernels of different sizes over time series data, such as using 16x1 and 32x1 convolution kernels to perform convolution operations on data. In the context of pure electric vehicle energy consumption prediction, this operation can capture the fluctuation characteristics of energy consumption data in a short period of time, such as local features such as sudden acceleration, instantaneous changes in battery voltage and current, etc. Then, the obtained feature map is processed by pooling, which reduces the data dimension while preserving important features, reduces the model calculation amount while avoiding the loss of key information, so that the subsequent model can more efficiently process data.
[0026] LSTM module, Long Short-Term Memory Network (LSTM), is used to capture long-term dependencies of data. It controls the transmission of information through gating mechanisms (input gate, forget gate, output gate). In the driving process of pure electric vehicles, there are long-term associations between time series characteristics such as driving behavior and battery state, for example, the battery decay process after sudden acceleration is a long-term change. LSTM can remember energy consumption data features over a long period of time, solving the gradient vanishing problem of traditional recurrent neural networks, enabling the model to effectively process time series data and learn long-term dependency patterns in the data, providing long-term dimensional information support for accurate energy consumption prediction.
[0027] MHA module, Multi-Head Attention Mechanism (MHA), further explores the correlation between different variables in the data. It maps input data to multiple low-dimensional spaces, calculates attention weights in each space, and then concatenates the results of multiple spaces. In energy consumption prediction, MHA focuses on analyzing the cross-dimensional parameter interaction locally extracted by the CNN layer, such as the relationship between driving mileage and battery temperature. By focusing on data features from different angles, MHA can discover hidden complex correlations in the data and improve prediction accuracy.
[0028] In the pure electric vehicle energy consumption prediction model, each module plays a synergistic role. The CNN module is responsible for extracting local features such as sudden acceleration, battery voltage, and current changes. LSTM uses its gating units to effectively process time series data and capture long-term associations between time series characteristics such as driving behavior and battery state, such as the battery decay process after sudden acceleration. Multi-Head Attention Mechanism (MHA) focuses on analyzing the cross-dimensional parameter interaction locally extracted by the CNN layer, such as the relationship between driving mileage and battery temperature.
[0029] Referring to Figure 2 , the CNN-LSTM-MHA model parameters are optimized using the Newton-Raphson optimizer NRBO, obtaining the NRBO-CNN-LSTM-MHA model, initializing the particle swarm, each particle representing a set of candidate parameters, and calculating the fitness of each set of candidate parameters, and updating the dynamic decay factor to control the search step. The reference particle is selected from the particle swarm to calculate the disturbance term, the particle parameters are updated based on the principle of Newton method, the particle parameters are disturbed when the trigger condition is met, and new parameters are obtained; The new parameters are subjected to boundary constraints, and the loss value corresponding to the new parameters is calculated; Iterate continuously, and complete optimization when the number of iterations reaches the set threshold to obtain the NRBO-CNN-LSTM-MHA model.
[0030] Preferably, the target function to be optimized is , wherein is the model parameter, and the target is to solve the following optimization problem: ; All trainable parameters in the CNN-LSTM-MHA model are defined as: CNN convolution kernel weight , LSTM gate weight matrix , MHA multi-head attention weight , and fully connected layer weight ; Initialize the particle swarm, and each particle represents a set of candidate parameters, including CNN convolution kernel weight , LSTM gate weight matrix , MHA multi-head attention weight , and fully connected layer weight ; the candidate parameters are subject to uniform distribution , wherein is the parameter value range; in the neural network weight initialization scene, the value range is often set to [-0.1, 0.1]. Through this random initialization method, search seeds can be widely scattered in the search space, providing diverse starting points for the subsequent optimization process.
[0031] The loss value of each particle is calculated, as shown in the following formula, ; , wherein is the L2 regularization coefficient, which acts to prevent overfitting by constraining the norm of the parameter , and improve the generalization ability; this loss value considers the target function and the regularization term, and is used to measure the performance of each particle under the current model.
[0032] After completing the loss value calculation of all particles, the particle with the smallest loss is selected from the calculation results as the initial reference point , and the initial reference point As an important reference point in the subsequent iteration optimization process, it guides the entire search process to a better direction.
[0033] In each iteration, according to the iteration number And the maximum number of iterations , the dynamic attenuation coefficient of each candidate parameter is calculated; the dynamic attenuation coefficient The calculation formula is as follows: ; The dynamic attenuation coefficient Can effectively control the search step, in the early stage of iteration, The value is larger, so that the search process can explore in a larger space range, which is beneficial to find the potential initial reference point With the increase of iteration number , The value gradually decreases, and the search step also becomes smaller, so as to realize the fine tuning of local area and improve the accuracy of optimization results.
[0034] In order to avoid the single search direction, two reference particles a1 and a2 different from are selected in the initialization particle group, This random selection mechanism can fully utilize the information of different particles in the particle group, enrich the search direction and enhance the global search ability of the algorithm.
[0035] The disturbance term of candidate parameter is calculated as follows: , where obeys , by combining the difference between the initial reference point and the two randomly selected particles, the disturbance term Can play an important role in balancing global exploration and local development. It makes the particle not only move towards the direction of global optimal solution in the search process, but also fully explore the local area, avoiding falling into local optimal trap.
[0036] According to the disturbance term , the candidate parameter is updated by Newton method, and the second order derivative information is used to accelerate the convergence, and the updated parameter is obtained, and the calculation formula is: ; Where, is the gradient of the objective function; in actual calculation, since the gradient The Newton method can utilize the second-order information of the objective function during the optimization process, and can converge to the optimal solution faster than methods that only use the first-order derivative.
[0037] Update parameters Process and get new parameters The processing includes introducing the trap avoidance operator TAO. The specific process of introducing the trap avoidance operator TAO is as follows: Generate random numbers r3 and r4, r3 and r4 obey ; Calculate θ1=-1+2r3, θ2=-0.5+r4, generate random variables u1 and u2, and calculate the population mean W̅; When the value of random variable u1 is less than 0.5, the perturbation operation on particle parameters is triggered to obtain new parameters .
[0038] The specific formula is as follows: ; ; in, is a random variable, is the group mean. Through this random weight offset and group mean perturbation method, TAO can make particles search in different directions, increasing the probability of particles escaping the local optimal solution.
[0039] To ensure that the particle parameters are always within a reasonable range, the new parameters Perform boundary constraints, the specific formula is: ; This operation can ensure the physical meaning and stability of the model parameters and avoid the degradation or instability of model performance due to parameter values exceeding the reasonable range.
[0040] Finally calculate the new parameters The corresponding loss , adopting the greedy update strategy, if , then update the current new parameters And the corresponding loss value ;Right now ; At the same time if , then update the initial reference point ; Continue to iterate until the number of iterations reaches the set threshold, that is, the maximum number of iterations , obtain the parameter combination that minimizes the loss, complete the optimization, and obtain the NRBO-CNN-LSTM-MHA model.
[0041] The application provides an electric vehicle energy consumption prediction device based on an NRBO optimization model, comprising: A collection unit collects energy consumption prediction data for preprocessing, and processes the energy consumption prediction data into a data set for training; A data set division unit divides the data set into a training set and a verification set; A first model construction unit constructs a CNN-LSTM-MHA model; A second model construction unit optimizes the parameters of the CNN-LSTM-MHA model by using a Newton-Raphson optimizer (NRBO) to obtain an NRBO-CNN-LSTM-MHA model; A training unit inputs the training set into the NRBO-CNN-LSTM-MHA model for training; A verification unit verifies the prediction accuracy of the NRBO-CNN-LSTM-MHA model by using the verification set after multiple rounds of iterative training; A prediction unit pre-processes a data set to be predicted, imports the model for energy consumption prediction, and obtains a prediction result.
[0042] In an embodiment, the application provides a computer device including a processor and a memory, 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 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), ready-to-program 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 in the computer storage medium to implement a corresponding method process or a corresponding function. The processor of the embodiment of the application can be used for the operation of the electric vehicle energy consumption prediction method.
[0043] The present application further provides a storage medium, specifically a computer readable storage medium (Memory), which is a memory device in a computer device, used for storing programs and data. It can be understood that the computer readable storage medium herein can include an internal storage medium in the computer device, and of course can also include an extended storage medium supported by the computer device. The computer readable storage medium provides a storage space, which stores an operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and the instructions can be one or more computer programs (including program codes). It should be noted that the computer readable storage medium herein can be a high-speed RAM memory, or a non-volatile memory, for example, at least one disk memory. One or more instructions stored in the computer readable storage medium can be loaded and executed by the processor to realize the corresponding steps of the electric vehicle energy consumption prediction method in the above embodiments.
[0044] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0045] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device implemented in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flow(s) or block(s).
[0046] These computer program instructions can also be stored in a computer readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including instruction apparatus, which realizes the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1the function specified in the one or more blocks.
[0047] These computer program instructions can also be loaded into computer or other programmable data processing devices, so that a series of operation steps are performed on the computer or other programmable data processing devices to generate computer-implemented processes, so that the instructions executed on the computer or other programmable devices provide processes for implementing the flowcharts Figure 1 one or more flows and / or blocks Figure 1 the steps of the function specified in the one or more blocks.
[0048] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, but not to limit it, although the above embodiments of the present application have been described in detail, those skilled in the art should understand: the specific embodiments of the present application can be modified or replaced by the same, without departing from the spirit and scope of the present application, any modification or equivalent replacement, which should be covered in the protection scope of the claims of the present application.
Claims
1. The electric vehicle energy consumption prediction method based on the NRBO optimization model is characterized by: The following steps are involved: Collect energy consumption prediction data and preprocess them to obtain a data set for training; Divide the dataset into training and validation sets; Build a CNN-LSTM-MHA model; The Newton-Raphson optimizer NRBO is used to optimize the parameters of the CNN-LSTM-MHA model to obtain the NRBO-CNN-LSTM-MHA model; Input the training set into the NRBO-CNN-LSTM-MHA model for training; After multiple rounds of iterative training, the prediction accuracy of the NRBO-CNN-LSTM-MHA model was verified using the validation set; After preprocessing the data set to be predicted, it is imported into the NRBO-CNN-LSTM-MHA model for energy consumption prediction to obtain the prediction results.
2. The electric vehicle energy consumption prediction method based on the NRBO optimization model according to claim 1 is characterized in that: The specific process of building the CNN-LSTM-MHA model is as follows: Set initial parameters, determine the convolution kernel size, feature dimension, number of output channels and initialize model weights; Build a CNN module to extract local time features, build an LSTM module to process time series data, and integrate an MHA module to capture global dependencies; The LSTM output sequence is split into multiple heads, each of which performs attention calculation independently, then concatenates and performs linear transformation; A global average pooling layer is added after the MHA layer to reduce the dimension, and then a fully connected layer is constructed to map the pooled features to the output space; Complete the construction of the CNN-LSTM-MHA model.
3. The electric vehicle energy consumption prediction method based on the NRBO optimization model according to claim 2 is characterized in that: The process of optimizing the CNN-LSTM-MHA model parameters using the Newton-Raphson optimizer NRBO to obtain the NRBO-CNN-LSTM-MHA model is as follows: Initialize the particle swarm, where each particle represents a set of candidate parameters, calculate the fitness corresponding to each set of candidate parameters, and update the dynamic attenuation coefficient to control the search step size; Select a reference particle from the particle swarm to calculate the perturbation term, and update the particle parameters based on the Newton method. When the trigger condition is met, the particle parameters are perturbed to obtain new parameters. Apply boundary constraints to the new parameters and calculate the loss value corresponding to the new parameters; Continue to iterate until the number of iterations reaches the set threshold, the optimization is completed, and the NRBO-CNN-LSTM-MHA model is obtained.
4. The electric vehicle energy consumption prediction method based on the NRBO optimization model according to claim 3 is characterized in that: The specific steps of the optimization process are: Assume that the objective function to be optimized is ,in is the model parameter, solve ; Initialize the particle swarm, each particle Represents a set of candidate parameters, each set of candidate parameters includes CNN convolution kernel weights , LSTM gate weight matrix , MHA multi-head attention weight and the fully connected layer weights , the candidate parameters follow a uniform distribution ,in The parameter value range; Calculating particles Loss value and select the particle with the smallest loss value As an initial reference point ; In each iteration, according to the number of iterations and the maximum number of iterations , calculate each candidate parameter Dynamic attenuation coefficient; In the initialization particle swarm, select two particles that are different from The reference particles a1 and a2; Calculate candidate parameters The disturbance term , ,in obey ; According to the disturbance term Combined with Newton's method to update the candidate parameters, the updated parameters are obtained , the calculation formula is: ;in, is the gradient of the objective function; Update parameters Process and get new parameters , the processing includes introducing a trap avoidance operator TAO; For new parameters Perform boundary constraints, the specific formula is: ; Calculate each new parameter The corresponding loss value ; like , then update the current new parameters And the corresponding loss value At the same time, if , then update the initial reference point ; Continue to iterate until the number of iterations reaches the set threshold, that is, the maximum number of iterations , obtain the parameter combination that minimizes the loss, complete the optimization, and obtain the NRBO-CNN-LSTM-MHA model.
5. The electric vehicle energy consumption prediction method based on the NRBO optimization model according to claim 4 is characterized in that: According to the disturbance term Combined with Newton's method to update the candidate parameters, the updated parameters are obtained In the process, the finite difference method is used to approximate the gradient .
6. The electric vehicle energy consumption prediction method based on the NRBO optimization model according to claim 4 is characterized in that: The specific process of introducing the trap avoidance operator TAO is as follows: Generate random numbers r3 and r4, r3 and r4 obey ; Calculate θ1=-1+2r3, θ2=-0.5+r4, generate random variables u1 and u2, and calculate the population mean W̅; When the value of random variable u1 is less than 0.5, the perturbation operation on particle parameters is triggered to obtain new parameters .
7. The electric vehicle energy consumption prediction method based on the NRBO optimization model according to claim 6 is characterized in that: The new parameters The calculation formula is: 。 8. An electric vehicle energy consumption prediction device based on the NRBO optimization model is characterized in that: include: Acquisition unit: collects energy consumption prediction data for preprocessing and converts the energy consumption prediction data into a data set for training; Dataset division unit: divide the dataset into training set and validation set; First, build the model: build the CNN-LSTM-MHA model; Second, build the model: use the Newton-Raphson optimizer NRBO to optimize the CNN-LSTM-MHA model parameters to obtain the NRBO-CNN-LSTM-MHA model; Training unit: input the training set into the NRBO-CNN-LSTM-MHA model for training; Verification unit: After multiple rounds of iterative training, the prediction accuracy of the NRBO-CNN-LSTM-MHA model is verified using the validation set; Prediction unit: After preprocessing the data set to be predicted, it is imported into the NRBO-CNN-LSTM-MHA model for energy consumption prediction to obtain the prediction results.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.