Prediction of electricity consumption and hydropower production in the smart power grid based on the gated recurrent unit neural network and modified future search algorithm Authors: Hao Tang, Yuening Wang, Xinping Yuan, Navid Razmjooy Published: 2025 ABSTRACT AbstractPrecise prediction of electricity usage and hydroelectric power production can enhance energy distribution efficiency, minimize waste, and enhance general grid performance. Moreover, utilizing the Gated Recurrent Unit (GRU) Neural Network and Modified Future Search Algorithm (MFSA) can offer more accurate analysis and forecasts, and facilitates improved decision-making and allocation of resources. This investigation aims to develop an improved model based on GRU and MFSA for examining and forecasting energy generation and electricity usage in a smart power grid. This study employs economic and social data to predict patterns of long-term electricity usage, while climatic data is employed as input for the optimum model for simulation of electricity generation, which concentrates particularly on hydropower production. The developed optimized model has been compared to original deep learning and optimized methods to demonstrate its enhanced efficacy and superiority. According to the investigation, the obtained results show how effective the optimal method is in accurately forecasting electricity usage and hydropower generation.Keywords: Electricity consumption, Hydropower generation, Modified future search algorithm (MFSA), Gated recurrent unit (GRU) neural network, Economic-social data, Climatic dataSubject terms: Energy science and technology, Engineering Introduction Background In the current dynamic energy environment, the combination of renewable energy sources and the rise of intelligent power grids have highlighted the crucial need for precise and effective energy management1. While there is a global push towards sustainable energy solutions, developing countries face unique challenges in meeting increasing electric energy demand due to factors such as infrastructure limitations and economic constraints2. The world is moving towards a more sustainable future, and enhancing energy distribution, reducing waste to the least, and improving general grid performance are central to this change. Recently, there have been noteworthy technological improvements in the power grid, especially in the production, transmission, and distribution sectors, in order to maintain with the dynamic energy needs3. The social and industrial sectors have experienced advancements that lead to a significant rise in electricity usage, and emphasize the necessity to investigate sustainable and renewable energy sources. Hydropower is crucial in addressing this rising demand, and is a reliable and clean energy source4. Generating hydropower is one of the oldest methods of generating electrical and mechanical energy, with a long history as an essential source of renewable energy. It captures the moving water power in streams and rivers to produce electricity, and provides low-carbon electricity5. Facilities of hydropower can quickly increase output from zero to maximum capacity, provide electricity to the grid through main outages or disruptions6.This adaptability completes other renewable energy sources like wind and solar7. Pumped storage hydropower plants have the capacity to discharge energy through water when there is high demand or when other renewable energy sources are not producing sufficient power. Hydropower is crucial in facilitating the integration of alternative renewable energy technologies by offering a reliable and steady baseload and by supporting the wind and solar energy’s intermittent nature8. The long hydropower infrastructure lifespan and its capability to ensure energy security both contribute to its significance in the energy mix9. The implementation of smart grid technologies highlights the importance of effective management of energy and precise prediction of energy generation and usage10. Smart grids, which utilize digital technology and two-way communication, provide an opportunity to transform the management way of electricity supply11. Through smart grids, the management of the fluctuating nature of renewable energy sources (like hydropower) can be improved, and can result in an enhancement of general grid reliability12. Utilizing analysis of real-time data and advanced prediction techniques enables optimization of energy distribution, minimize waste, and improve resilience of grid13. The smart power grid is a digitally linked system that allows for smooth communication and data flow among different parts of the power system, from power production sources to consumer devices14. Incorporating digital technology provides exceptional opportunities to transform energy management15. One of the main benefits of the smart grid is its capacity to utilize innovative data analysis methods, such as deep learning algorithms16. Deep learning, a type of artificial intelligence, allows the grid to acquire knowledge and make well-informed decisions using extensive data produced by different meters, sensors, and devices linked to the grid17. By examining trends, patterns, and current data, the smart grid can enhance its operations, enhance effectiveness, and improve general efficiency18. Utilizing advanced data analysis techniques, the smart grid can make accurate predictions about electricity usage patterns and predict peak demand periods19. This enables the improvement of power production and distribution to guarantee a more effective allocation of resources, reduce waste and minimize the risk of power outages. Furthermore, the smart grid has the ability to enhance the use of renewable energy sources, including hydropower, by forecasting water levels, predicting fluctuations in hydropower output, and maintaining a stable power supply20. The smart power grid’s two-way communication ability enables consumers to actively participate in energy management. Through smart meters and connected devices, consumers can monitor their energy use, modify patterns of consumption, even supply excess energy back into the grid, and foster a more efficient and sustainable energy ecosystem21. The energy sector often acts poorly when employ traditional forecasting methods to handling the intricate and ever-changing nature of electricity usage and hydropower production22. Here, deep learning, a robust kind of machine learning, becomes useful. Deep learning models, with multi-layered neural networks, can effectively capture nonlinear patterns and associations in data, and make them highly suitable for energy prediction23. Related works Emin Sahin et al.24 employed meteorological data from the area of the Hirfanlı Dam to develop a hybrid Genetic Grey Wolf Optimizer (GGWO)-based Convolutional Neural Network/Recurrent Neural Network (CNN/RNN) regression method for predicting hydropower production (PP). The study explored various machine learning techniques and introduced GGWO and CNN/RNN model combined with Long Short-Term Memory (LSTM) regression technique. In Method I, the ELM algorithm outperformed other ML models with a correlation coefficient of 0.977 and a mean absolute error of 0.4. In Method II, the proposed CNN/RNN hybrid model achieved even better results with a correlation coefficient of 0.9802 and a mean absolute error of 0.314. The study’s findings could benefit decision-making in renewable energy forecasting and resource management for electricity generation. Pan et al.25 introduced an approach for hydropower station operation using an enhanced LSTM neural network and the Random Forest algorithm. The LSTM model was enhanced using particle swarm optimization, and the Random Forest algorithm was used for load-distribution modeling. Historical data was clustered using K-means, and the parameters of the Random Forest model were optimized. The approach was illustrated using a case study of a hydropower station in China. The research demonstrated that the I-LSTM approach accurately represented the operational characteristics of hydraulic turbines, and ensured their proximity to the actual operating state. When compared with other methods, I-LSTM resulted in reduced prediction errors and contributes to optimized unit operation and reduced water consumption in hydropower applications. Shivashankaraiah et al.26 introduced an approach to forecast the output power of photovoltaic systems by using a Hybrid Deep Neural Network (HDNN) framework, which represented a significant advancement in the application of deep learning to prediction problems in transmission systems. The HDNN framework combined CNN and LSTM. Conventional deep learning techniques were utilized in the primary phase, and the evaluation of their effectiveness was presented in more detail after conducting training using firefly optimization techniques. The most reliable method among those used in previous studies was selected. The combination of deep learning and power efficiency seemed to hold promise, particularly in enhancing sustainable management and the electrical industry digitalization. Almashnowi et al.27 suggested a hybrid deep learning-based power management strategy that used a combination of a convolutional neural network (CNN) and a deep Q-learning Network (DQN). The strategy was implemented using the matrix laboratory (MATLAB) language. Experimental results confirmed that this algorithm achieved a computational time of 0.2 s and an energy loss of 0.01 megawatts, which was lower compared to traditional models. Additionally, the proposed strategy demonstrated a high accuracy rate of 0.99, and represented its effectiveness in managing various load power and solar profiles. The adoption of this hybrid approach had the potential to significantly reduce operational costs and promote sustainability in freshwater generation, which contributed to optimized future for the desalination sector. Li et al.28 aimed to improve electricity load forecasting in Turkey using machine learning techniques, specifically CatBoost and Extreme Gradient Boosting (XGBoost), combined with optimization algorithms including Phasor Particle Swarm Optimization (PPSO), Sparrow Search Algorithm (SSA), and Hybrid Grey Wolf Optimization (GWO). The analysis focused on assessing the performance of combined models using accuracy measures and runtime efficacy. The XGBoost-SSA model outperformed others, and indicated increased accuracy and better results in forecasting electricity usage. This model had the highest coefficient of determination (R2) value and exhibited lower errors during testing, and made it a promising approach for predicting electricity consumption in Turkey. Contribution Indeed, all individual building blocks, such as GRU networks and optimization algorithms, are established components in the domain; the main novelty of the present work lies in its synthesis and application, which aim to close an important gap in the forecasting of smart grids. All studies have either separated the forecasting of energy demand and the generation of renewables or minimized the influencing factors that they employed in their forecasting efforts. Our main contribution is the formulation of a unified hybrid model (GRU-MFSA) that can predict electricity consumption and hydropower production using economic, social, and climatic parameters within a single framework, thereby integrating disparate data domains to predict with both uncertainty and accuracy. This is not trivial because it requires a model that takes into consideration the complex nonlinear interactions between all these domains across time. Similarly, it constitutes a methodological novelty in applying the Future Search Algorithm to principles from PSO, particularly for hyperparameter tuning of the GRU network, thereby ensuring an optimal balance between accuracy and computational efficiency for the model. Therefore, the importance of this study lies not only in the application of existing tools, but also in demonstrating their synergistic mix to address a larger, more practically relevant energy forecasting problem; thus, providing a tool that is much more powerful in the hands of grid operators and policymakers. The framework and design principle generated in this work includes the integration of a Gated Recurrent Unit (GRU) Neural Network with a Modified Future Search Algorithm (MFSA) to create an optimized model, in order to predict the electricity consumption and hydropower production in smart power grids. The simplified version of Recurrent Neural Network (RNN) for short time series prediction, with reset and update gates captured, known as Gated Recurrent Unit or GRU, is trained to learn both short and long temporal relationships and is suitable for time series prediction problems. On the contrary, the MFSA is an advanced optimization method that improves the accuracy of GRU by optimizing some hyperparameters like learning rate, number of neurons, and epochs. This leads to the model being able to learn very complicated relations in data that would still be computationally efficient. Specifically, the design principle pertains to developing a flexible and powerful model that can manage the complexities in the datasets of electricity consumption and hydropower. The proposed prediction model combines economic, social, and climate information. The following reasons demonstrate the significance of our study. Integrated Hybrid Model We propose a new hybrid model in our work by integrating the GRU Neural Network and Modified Future Search Algorithm (MFSA). Its particular integration is much more relevant than the juxtaposition of modules in a standard integrated spatial (as level, delivered power) and temporal (as time allows it) model. Moreover, with the GRU component, temporal dependencies are intelligently processed and controlled through hyperparameter optimization using MFSA, making it a powerful framework against other conventional models. Integrated Hybrid Model We propose a new hybrid model in our work by integrating the GRU Neural Network and Modified Future Search Algorithm (MFSA). Its particular integration is much more relevant than the juxtaposition of modules in a standard integrated spatial (as level, delivered power) and temporal (as time allows it) model. Moreover, with the GRU component, temporal dependencies are intelligently processed and controlled through hyperparameter optimization using MFSA, making it a powerful framework against other conventional models. Comprehensive Framework Our novel framework synthesizes previously disparate techniques into a cohesive whole. By strategically combining the expressiveness of gated units with the exploration of metaheuristics, we enable a balanced consideration of economic, social, and climatic influences. Where past works have segmented short and long-term outlooks, our integrated system accommodates both transient and enduring forecasting necessities. While individual tools such as GRUs and metaheuristic algorithms have proven useful alone, we demonstrate that their synchronized application composes a thorough treatment, advancing beyond regular methodologies that often concentrate too narrowly on either perspective in isolation. Comprehensive Framework Our novel framework synthesizes previously disparate techniques into a cohesive whole. By strategically combining the expressiveness of gated units with the exploration of metaheuristics, we enable a balanced consideration of economic, social, and climatic influences. Where past works have segmented short and long-term outlooks, our integrated system accommodates both transient and enduring forecasting necessities. While individual tools such as GRUs and metaheuristic algorithms have proven useful alone, we demonstrate that their synchronized application composes a thorough treatment, advancing beyond regular methodologies that often concentrate too narrowly on either perspective in isolation. Optimization The hyperparameters of the GRU network are optimized through MFSA, leading to a substantial enhancement in model performance. Key hyperparameters, including learning rate, number of neurons, and training epochs, are prioritized, resulting in accuracy and reliability that surpass conventional modules. The optimization procedure is innovative, ensuring that the model received thorough fine-tuning for unparalleled accuracy and performance. Optimization The hyperparameters of the GRU network are optimized through MFSA, leading to a substantial enhancement in model performance. Key hyperparameters, including learning rate, number of neurons, and training epochs, are prioritized, resulting in accuracy and reliability that surpass conventional modules. The optimization procedure is innovative, ensuring that the model received thorough fine-tuning for unparalleled accuracy and performance. Validation To ensure our model’s effectiveness, we thoroughly tested it against standard benchmarks and compared it with leading algorithms. The results show that our hybrid model performs exceptionally well, achieving lower errors (with training MSE stabilizing at 125) and strong reliability (correlation scores of 0.94, 0.85, and 0.81 for training, validation, and testing, respectively). These results demonstrate that our model is both highly effective and innovative. Validation To ensure our model’s effectiveness, we thoroughly tested it against standard benchmarks and compared it with leading algorithms. The results show that our hybrid model performs exceptionally well, achieving lower errors (with training MSE stabilizing at 125) and strong reliability (correlation scores of 0.94, 0.85, and 0.81 for training, validation, and testing, respectively). These results demonstrate that our model is both highly effective and innovative. Practical Implications and Future Applications The practical consequences of our research also go above mere theoretical progress. By effectively forecasting trends in electricity usage and hydropower production, our model facilitates informed decision-making in energy policy, infrastructure planning, and the integration of renewable energy sources. The consistent rise in household electricity consumption projected from 2023 to 2040, along with the gradual decrease in hydropower generation indicated by our simulations, offers valuable insights for sustainable energy management. Practical Implications and Future Applications The practical consequences of our research also go above mere theoretical progress. By effectively forecasting trends in electricity usage and hydropower production, our model facilitates informed decision-making in energy policy, infrastructure planning, and the integration of renewable energy sources. The consistent rise in household electricity consumption projected from 2023 to 2040, along with the gradual decrease in hydropower generation indicated by our simulations, offers valuable insights for sustainable energy management. In conclusion, the uniqueness of our research lies in the creative amalgamation and enhancement of traditional modules into a cohesive, high-efficiency framework. This strategy not only improves predictive precision and dependability but also provides viable solutions to practical energy management issues. Therefore, the focus on optimizing and integrating these modules is warranted due to the substantial advancements they contribute to the overall structure and reasoning of our predictive model. The organization of the document is structured as follows: Section “Method and the experimental setup” details the methodology and experimental framework, encompassing a case study of the Qinshitan Dam, the procedures for data collection, the Gated Recurrent Unit (GRU) Neural Network, the Modified Future Search Algorithm (MFSA), and the amalgamation of these components into a refined predictive model. Section “The results” discusses the results, providing details on the validation of the MFSA algorithm, the training and testing procedures of the GRU-MFSA model for forecasting electricity consumption and hydropower production, as well as simulation results that illustrate long-term trends in energy usage and generation. Lastly, Section “Conclusion” wraps up the study by summarizing the principal findings, highlighting the model’s enhanced performance relative to traditional approaches, and suggesting its potential to improve energy management practices while proposing avenues for future research. Method and the experimental setup Case study The Qinshitan Dam, situated in the charming karst scenery of Guilin, is a major hydraulic facility in the Lijiang River basin in southwest China. It serves as both a power generator and a water source for the city. It has a reservoir capacity of 0.8 billion cubic meters and can generate 300 megawatts of power. Annually, it produces around 1.2 billion kilowatt-hours of electricity. The dam encounters distinctive hydrological difficulties because of its karst watershed location. These difficulties consist of unpredictable streamflow patterns, leakage of groundwater, and restricted water storage capacity. With the looming threat of climate change, these challenges grow in significance, and potentially impact water accessibility and reliability for Guilin. The dam experiences considerable temperature changes, with an average low of 8.6 °C in January and a high of 28.5 °C in July. The annual average temperature is 19.1 °C. Likewise, the patterns of rainfall varies, with December getting about 48.9 mm and June experiencing 356.7 mm. Generally, the Qinshitan Dam receives 1929.4 mm of precipitation each year, which leads to an average yearly streamflow of 1055.9 mm. For every 1 °C temperature increase, the average yearly evaporation increases by 9.3 mm. Data collection and methodology steps Dataset for prediction of electricity consumption The amount of used electricity depends on a variety of factors, including climate, as well as social and economic factors. Short-term forecasts are based on climate, while long-term forecasts are based on social and economic factors. The main goal of this study is to make long-term forecasts. To achieve this, this investigation’s dataset will contain data on electricity consumption as the output variable, with input variables, like population, GDP, unemployment rate, income level, and the price per kilowatt of electricity. Dataset for photovoltaic power production predictions To forecast the electricity generation of the power plant, this study utilizes relevant data related electricity generation as input. This data involves various factors, such as climatic conditions that impact the inflow into the reservoir, and ultimately influence electricity generation by the generator. Factors taken into account include precipitation, temperature, evaporation, and transpiration of the reservoir surface, as well as the relative humidity of the area. The climatic data is attained from a station of meteorology. The stages of the methodology are represented in Fig. 1. The stages of the methodology. Gated recurrent unit neural network GRUs are a simplified type of Recurrent Neural Networks and have a shared origin with LSTM networks, as they have been created to tackle the same issue of vanishing gradients that RNNs face. GRUs simplify the structure found in LSTMs, and often results in improved calculational effectiveness and similar outcomes. Unlike LSTMs, GRUs use a single hidden state that effectively handles both immediate and long-term temporal dependencies, and eliminates the need for a separate cell state as in LSTMs. GRUs are distinguished by a more compact deep neural network structure, consisting of only two gates: the reset gate () and the update gate ()29. The operation of these gates is determined by particular equations as follows: The first step is to represent data from the former hidden states by using a reset gate, which operates similarly to the LSTM forget gate. Then, the update gate determines the amount of data from previous time steps that should be passed on to the subsequent state. The reset gate, in combination with a hyperbolic tangent layer, introduces a novel memory content referred to as the hidden state candidate. Lastly, the update gate helps form the new hidden state. Just like LSTMs, GRUs are widely utilized in time series predicting problems. The following formulas outline the calculation of the current memory content and the ultimate memory at the present time step: here, the current memory content is illustrated by . The vector contains the data relevant to the present element. A graphical structure of a GRU has been represented in Fig. 2. A graphical structure of a GRU. Modified future search algorithm (MFSA) Future search (FS) algorithm The universal desire for an enhanced quality of life motivates individuals to simulate the lifestyle of exceptional figures in order to enhance their well-being. This fundamental concept forms the basis of the improved exploration algorithm, which aims to find the best solutions. The exploration procedure is described using a statistical framework, where initial values are stochastically produced, and both local and global searches are carried out among candidates to improve solutions. Generally, metaheuristic algorithms begin with stochastic initialization and then proceed by iterating based on the optimal initial solution. If the best solution differs considerably from the global best solution, additional iterations are conducted to converge to the optimal solution. The FS algorithm deals with this issue by modifying stochastic initial values during every iteration. While the majority of metaheuristic algorithms distinguish the optimal local solution from numerous elements and a global solution through iterations, the updating solutions approach differs. Some algorithms only depend on the optimal local solution for updates, while others give priority to the optimal global solution. The selection of updating strategy can influence the quantity of iterations needed to achieve the best solution. The FS algorithm employs both the optimal local and global solutions to reveal the best results. Many metaheuristic algorithms involve complex statistical equations that can result in extended and increased iterations to attain the optimal solution. The suggested FSA, however, is on the basis of the simple statistical formulas. In this algorithm, the search space is associated to exploring candidates in different corners of the universe with the aim of reaching the highest quality of life. A candidate who achieves the most efficient function in a country is the best local solution. Every year, there is a possibility that this solution can be enhanced by someone from another country. The better international solution is identified by the individual who consistently secures the most efficient function in a nation over multiple years. If individuals’ function results in a given year fail to match or surpass the quality of the former year, it will lead to a change in their main positions. This procedure of optimization begins with stochastic solutions on the basis of the following equation, and the statistical representation of the algorithm is defined using the following formula: here, the array of the solutions is indicated by . The present solution in the whole population size is demonstrated by . Upper boundary is indicated by , and the lower boundary is demonstrated by . The uniformly distributed stochastic variables are indicated by . The problem’s dimensionality is depicted by . Each potential solution in the searching process for solutions is known as a local solution (LS). The best LS is then identified as the global solution (GS). This marks the start of a sequence of iterations intended to find the best possible choice. The LS directs the initial phase of exploration in each area, and determines how the proposed algorithm will conduct the search. The computation for this can be carried out using the equation below: Then, the global exploration is controlled by the GS, which enables the investigation feature of the algorithm in consideration. This can be defined as follows: here, the algorithm updates both the Local Solution (LS) and the Global Solution (GS) by finding new LS, GS, and other solutions during the present iteration, which results in the initial stochastic values. This improvement adds an exploration ability to the algorithm. Finally, the algorithm assesses the Local Search (LS) and Global Search (GS) following the modification of the initial value, but only if their effectiveness surpasses that of the LS and GS in the initial iteration. The successive phases of the Future Search algorithm are represented in Fig. 3. The successive phases of the Future Search algorithm. Future search algorithm based on PSO Former investigation has revealed that the primary Future Search algorithm is a powerful and advanced approach that can be employed for solving numerous optimizing issues. Although, some conditions exist in this approach that add many challenges and need additional enhancement. This investigation improves the Future Search Algorithm’s exploratory aspect by integrating the Particle Swarm Optimization (PSO) technique’s collective behavior. The PSO is widely regarded and a known optimization method among many techniques. When constructing the PSO update formula, it’s crucial to consider both the velocity and position of the individuals. The velocity is calculated utilizing the equation below: here, the best position in the global scopes is indicated by , and the best position in the local scopes is represented by . The previous velocity is indicated by , and the present velocity is demonstrated by . The variables and represent adjustable coefficients that affect the best positions’ significance in the local and global scopes. The nest position is calculated utilizing the following equation: here, equals 0.6 and equals 0.4. Algorithm validation To achieve an accurate assessment of the novel algorithm, it is essential to conduct thorough testing utilizing well-established benchmark functions that are widely accepted. Therefore, the algorithm has been evaluated utilizing four well-established benchmarks in optimization, including the Rosenbrock, Rastrigin, Sphere, and Ackley functions. They are commonly employed to evaluate an algorithm’s performance in various optimization conditions. This testing offers a reliable evaluation of the algorithm’s suitability for real-world implementation. Table 1 illustrates the characteristics of the test functions used in this investigation. Table 1Characteristics of the benchmark function application in the current investigation30.Benchmark functionsEquationLimitationRosenbrock[ −2.982, 2.982]Rastrigin[ −608, 608]Sphere[ −608, 608]Ackley[ −11.50, 11.50] Characteristics of the benchmark function application in the current investigation30. Furthermore, the proposed algorithm’s efficacy is compared to several modern methods to illustrate its effectiveness, including Butterfly Optimization Algorithm (BOA)31, Gaining-Sharing Knowledge-based algorithm (GSK)32, Manta Ray Foraging Optimization (MRFO)33, Harris Hawks Optimization (HHO)34, and Artificial Ecosystem-based Optimization (AEO)35. Improved GRU (IGRU) network In the design of deep neural networks, various hyperparameters, including the learning rate, number of neurons, and epochs are extremely important36. These factors impact how well the neural network fits the data, and also its performance during training37. Choosing the best values for these hyperparameters is crucial for improving the network’s performance38. The Modified Future Search Algorithm (MFSA) is an advanced optimization technique inspired by innovative predictive models39. It is known for its simplicity, easy implementation, and profound intelligent foundation. Appropriate for both academic research and industrial use, MFSA requires minimum adjustments40. Utilizing MFSA’s outstanding global optimization ability along with neural networks can improve the networks’ capacity for learning and generalization, ultimately optimizing the general operational effectiveness of the neural network. In this investigation, MFSA is employed to identify the optimal hyperparameter values, and establish the most efficient structure for the network model. In MFSA, each specific hyperparameter configuration represents a distinct scenario. A scenario in this study includes an array containing (Neuron Count, Iterations, and Learning Rate). The MFSA procedure evaluates the performance index of each hyperparameter array in order to find the most suitable structure. The performance index that has been chosen for the MFSA in this study is responsible for assessing the fitness of each individual by summing up the variances between the predicted and actual values. The specified best performance index is represented as follows: here, the entire quantity of data points is indicated by . The predicted value is indicated by , and the actual value is demonstrated by . The purpose of the performance index is to discover the hyperparameter collection that reduces this function to the least, which demonstrates an improved fit of the model with the data. Therefore, the justification for integrating MFSA into the GRU network lies in its capability to enhance the network’s predictive efficacy through hyperparameter optimization. The Fig. 4 illustrates the proposed hybrid model of this investigation. The proposed hybrid model of this investigation. Test of performance The network’s accuracy has been evaluated by employing the subsequent coefficients: (i)MSE: This coefficient evaluates the mean square error, which is calculated in the following way:12 MSE: This coefficient evaluates the mean square error, which is calculated in the following way:12 (ii)RMSE: This coefficient evaluates the square root of the mean of the squared distinctions that exist between the witnessed and the forecasted data. This procedure has been computed in the following way:13 RMSE: This coefficient evaluates the square root of the mean of the squared distinctions that exist between the witnessed and the forecasted data. This procedure has been computed in the following way:13 (iii)MAE: This coefficient evaluates the Mean Absolute Error and is the complete value of the distinction between the witnessed and forecasted data. This procedure has been computed subsequently:14 MAE: This coefficient evaluates the Mean Absolute Error and is the complete value of the distinction between the witnessed and forecasted data. This procedure has been computed subsequently:14 (iv)MAPE: This coefficient assesses the Mean Absolute Percentage Error. It has been considered mean of the complete percentage errors of the forecasting. This procedure has been computed in the subsequent manner:15 MAPE: This coefficient assesses the Mean Absolute Percentage Error. It has been considered mean of the complete percentage errors of the forecasting. This procedure has been computed in the subsequent manner:15 (v)R2: This coefficient assesses Coefficient of determination. This procedure has been computed in the subsequent manner:16 R2: This coefficient assesses Coefficient of determination. This procedure has been computed in the subsequent manner:16 The results The validation optimization The algorithm that is under consideration and its counterparts have been evaluated with uniformity in key parameters to ensure an accurate and equitable comparison. All algorithms have been assessed with a consistent population size of 150 entities and an iteration of 200 to prevent any bias in the results. By matching the group size and iteration number for each algorithm, their individual strengths can be better evaluated in terms of processing speed, operational efficiency, and accuracy. It’s essential to note that this uniform approach ensures an equal number of assessments for each algorithm, which leads to a total of 32,000 assessments. Table 2 contains a thorough evaluation of the MFS Algorithm’s capabilities compared to other algorithms. The evaluation includes the use of standard test functions and involves a comparative study using the average (AVE), standard deviation (STD), and Friedman test scores derived from each algorithm’s outcomes. Table 2Comparative analysis of MFSA efficacy in comparison to other advanced algorithms.BenchmarkIndexMFSABOAGSKMRFOHHOAEOF1AVEValue1.1933.5633.2014.9893.2103.567Rank6.2239.99417.78416.06921.06218.297STDValue0.8881.4812.4101.4552.1031.930Rank12.90410.52718.18529.61021.20925.922Friedman testValue3.8616.3326.7937.6738.5146.401Rank14.14919.05321.87620.10629.34530.098F2AVEValue0.0424.2576.5186.4698.3927.024Rank4.7056.03212.31311.02517.34218.503STDValue0.0645.0798.1717.0735.5547.548Rank6.5449.9039.00516.88925.46716.501Friedman testValue4.8687.0985.4268.1705.6989.311Rank6.6076.31415.88715.11415.82515.555F3AVEValue0.0170.0540.0000.0000.0000.000Rank14.60314.36422.61014.76722.65628.740STDValue0.0000.0160.0000.0320.0000.000Rank10.13716.53818.39626.80716.50336.002Fried man testValue8.54329.3848.8236.0576.3635.716Rank7.4987.68313.1389.62514.16122.545F4AVEValue0.0000.0000.0000.0000.0000.000Rank20.06112.47126.08929.64223.15038.123STDValue0.0000.0000.0000.0000.0000.000Rank20.42618.47328.33921.54438.00742.119Fried man testValue9.1088.17310.4607.83011.33112.341Rank18.60533.07124.83531.27242.11352.230 Comparative analysis of MFSA efficacy in comparison to other advanced algorithms. An assessment has been conducted to evaluate the capability and efficiency of the suggested algorithm in addressing optimization challenges, compared to other advanced algorithms. The data in Table 2 indicates that the MFS Algorithm performs better than many competitors in comparison to all evaluated criteria. The findings reveal that the MFS Algorithm has noteworthy abilities as an effective approach for dealing with complicated optimization issues. Based on the results, the recently introduced MFS Algorithm has the smallest Average Variance Error (AVE) and Standard Deviation (STD) values for the evaluated benchmark functions. These results reveal that the MFS Algorithm demonstrates greater accuracy compared to its alternatives. Furthermore, when comparing the MFS Algorithm to the other algorithms under consideration, it is evident that the MFS Algorithm achieves the lowest standard deviation (STD) value, which demonstrates a more reliable approach than the others. Therefore, this optimization process has been utilized to optimize the GRU model. Training and testing process In this section, training, testing, and validation of the GRU-MFSA model used for electricity consumption simulation are shown in Fig. 5. An evolution of the MSE The GRU-MFSA model in 3 periods. The MSE values for the training, test, and validation data show a notable evolution over 30 epochs. During the initial 0 to 10 epochs, the MSE decreases from 5 × 105 to 125, 4.85 × 105 to 2350, and 4.80 × 105 to 3985 for training, validation, and test data, respectively. Following this, the MSE stabilizes. Specifically, it stabilizes at around 125, 2350, and 3985 for training, validation, and testing data. The GRU-MFSA model demonstrates promise in electricity consumption simulation, as indicated by the low final MSE values across all three datasets. Furthermore, the relationship between the dataset and simulation GRU-MFSA model was assessed during the training, validation, and testing phases as depicted in Figs. 6, 7 and 8. It is evident from this visualization that the modified data closely aligns with the original data. The training steps simulation model. The validation steps simulation model. The testing steps simulation model. The training phase of the model resulted in a robust positive correlation (R) of 0.94, demonstrating the successful acquisition of underlying patterns in the training data. In the validation stage, a slightly lower 'R' of 0.85 was achieved, showcasing effective generalization to new scenarios. Finally, during the test phase, a strong positive correlation of 0.81 was obtained, highlighting a strong relationship between the simulated and actual electricity consumption data. These results underscore the model’s ability to perform well on fresh and independent data, affirming its reliability and generalization to real-world datasets. The GRU-MFSA model demonstrates a high level of effectiveness in replicating electricity consumption patterns and precisely capturing the fundamental trends within the data. Its robust correlation during the testing phase guarantees precise forecasts on unfamiliar data, a critical aspect for real-world applications. This exceptional performance underscores the model’s capability for electricity consumption prediction. The model’s outstanding correlation between actual data and simulations further solidifies its dependability and precision in electricity consumption forecasting. The results of the simulation conducted using the proposed optimization model are displayed in Fig. 9. This graph illustrates the electricity consumption (in billion kWh) of a single household over a span of 20 years, ranging from 2003 to 2023. The electrical consumption simulation by hybrid model. The graph depicted in Fig. 9 illustrates a strong correlation between the simulated and actual electricity usage of a household spanning two decades. This suggests that the optimization model successfully takes into account the crucial factors that impact consumption. The precision of the optimization model is confirmed by the near match between the simulated and actual data, enabling well-informed choices regarding energy policies, infrastructure development, and forthcoming efforts to decrease electricity usage. These findings underscore the efficacy of employing optimization models to comprehend and forecast energy consumption patterns. Figure 10 show the forecasting electrical consumption from 2023 to 2040. The electrical consumption prediction from 2024 to 2030. The graph shows a steady increase in electrical consumption over the next 17 years, likely driven by population growth, technological advancements, and an increasingly digitized world. The growth rate appears relatively gradual, suggesting a manageable growth rate that could not strain resources and infrastructure. Comparing the forecasted trend with historical data up to 2023, the rate of increase is similar, suggesting consistency in factors influencing consumption. The forecast highlights the ongoing challenge of meeting rising energy demands while transitioning to sustainable and renewable energy sources. The advancement of the ongoing research is characterized by a novel combination of the Gated Recurrent Unit (GRU) Neural Network and the Modified Future Search Algorithm (MFSA), effectively overcoming significant limitations found in current energy forecasting models. For reference, Table 3 provides a comparison of the proposed GRU-MFSA model with five recent studies. Sahin et al.24, Pan et al.25, Shivashankaraiah et al.26, Almashnowi et al.27, and Li et al.28. These studies employ traditional machine learning, deep learning, or hybrid optimization techniques; however, they face limitations due to constrained datasets, a narrow scope, or insufficient performance. In contrast, the GRU-MFSA model stands out by incorporating economic, social, and climatic data for thorough forecasting, leading to improved accuracy and reliability. Table 3Comparative Analysis of GRU-MFSA with Existing Research.StudyMethodologyDatasetPrediction scopePerformance metricsLimitationsCurrent StudyGRU + MFSAEconomic, social, climatic dataElectricity consumption & hydropowerMSE: 125 (Training), 2350 (Validation), 3985 (Testing); R: 0.94, 0.85, 0.81None reportedSahin et al.41GGWO-CNN/RNNMeteorological dataHydropower productionCorrelation: 0.9802; MAE: 0.314Limited to hydropower; no socioeconomic factorsPan et al.25Improved LSTM + Random ForestHistorical operational dataHydropower station operationReduced prediction errorsNarrow scope; no electricity consumption trendsShivashankaraiah26HDNN (CNN + LSTM) + Firefly OptimizationSolar photovoltaic dataSolar power outputEnhanced power efficiency (no metrics provided)Limited to solar systems; no grid integrationAlmashnowi et al.42CNN + Deep Q-Learning (DQN)Load/solar profilesDesalination plant managementAccuracy: 0.99; Energy loss: 0.01 MWApplication-specific; no renewable energy focusLi et al.28CatBoost + XGBoost + OptimizationTurkey electricity load dataNet electricity consumptionHigh R2; low error rates (no metrics provided)Region-specific; no hydropower generation Comparative Analysis of GRU-MFSA with Existing Research. The GRU-MFSA model demonstrates significant progress over earlier research. Unlike the study conducted by Sahin et al.24, which utilized meteorological data in conjunction with a hybrid Genetic Grey Wolf Optimizer (GGWO)-CNN/RNN model for predicting hydropower generation, the current study integrates socioeconomic and climatic factors to assess both electricity demand and hydropower production. While Sahin et al. achieved a correlation coefficient of 0.9802, their model’s applicability is restricted to hydropower. Similarly, Pan et al.25 did not address more general patterns in energy consumption; instead, they concentrated on optimizing hydropower stations using Random Forest and Improved LSTM. Shivashankaraiah et al.26 proposed an integrated Deep Neural Network (HDNN) for solar power generation; however, their dependence on firefly optimization and a limited dataset restricts its applicability to smart grids. Almashnowi et al.27 attained a high accuracy of 0.99 in managing desalination plants using CNN-DQN, yet they did not consider the integration of renewable energy. Li et al.28 employed CatBoost-XGBoost for load forecasting specific to Turkey, but their model lacks the flexibility to adapt to other regions or energy sources. In contrast, the GRU-MFSA model exhibits mean squared error (MSE) values of 125 in training, 2350 in validation, and 3985 in testing, along with correlation coefficients of 0.94, 0.85, and 0.81, respectively, when forecasting long-term trends in electricity consumption and hydropower generation. Utilizing MFSA for hyperparameter optimization enables the model to effectively tackle the scalability and accuracy issues prevalent in conventional methods. These improvements highlight the adaptability and effectiveness of the GRU-MFSA in managing intricate energy management challenges. The power generation forecasting The relationship between the actual dataset and simulation GRU-MFSA model is assessed during the training, validation, and testing phases as depicted in Figs. 11, 12 and 13. The training steps simulation model. The training steps simulation model. The training steps simulation model. The GRU-MFSA model has displayed encouraging outcomes in capturing fundamental patterns and reproducing power generation trends. Throughout the training phase, the model achieved a positive correlation coefficient of 0.93, indicating a strong relationship between predicted and actual values. In the validation phase, the model sustained a robust performance with an 'R' value of 0.89, showcasing its capacity to generalize to new situations. During the testing phase, a significant positive correlation of 0.85 was achieved, highlighting the model’s reliability and accuracy when applied to fresh and independent data. Simulation power generation of the GRU-MFSA model has been shown in Fig. 14. The power generation simulation with actual value. This consistent performance illustrates the model’s stability and adaptability, showcasing its potential for practical applications in power generation forecasting and optimization. The model’s high level of effectiveness is credited to its innovative architecture, which merges the capabilities of Gated Recurrent Units (GRUs) and a Multi-Factor Sentiment Analysis (MFSA) mechanism. This fusion allows the model to manage intricate data and capture subtle patterns, resulting in accurate predictions and a deeper comprehension of underlying dynamics. The GRU-MFSA model has exhibited exceptional performance and dependability in replicating power generation patterns. It indicates its potential to transform power generation forecasting and enhance more efficient and sustainable energy management practices. Finally, the forecasting power generation has been shown in Fig. 15. The power generation forecasting from 2023 to 2040. These data show a steady downward trend in electricity generation over time, which highlights the increasing need for electricity and the necessity of increasing capacity to meet future needs. Various factors, such as economic conditions, seasonal changes, and the integration of renewable energy options, may affect production fluctuations from year to year. Forecasts indicate a pattern of relatively steady decline in electricity production, which requires improved planning and infrastructure improvements. The integration of renewable energy sources such as solar and wind energy is expected to play an important role in shaping the electricity generation landscape and ensuring stability. Policy and infrastructure considerations require sustained investment in electricity generation infrastructure and the development of sustainable energy alternatives. Comparative analysis with advanced methods To provide for a more rigorous and statistically supported validation of our proposed GRU-MFSA model, an extensive comparative analysis was conducted against several advanced and state-of-the-art forecasting methods. Such a comparison would enable us to answer two pivotal questions: (1) Does the MFSA optimization give some benefit over the base GRU model? (2) Does our hybrid model surpass other competitive deep learning and optimized architectures? To this end, the competitor models considered were the standard GRU43, standard LSTM44, GRU model optimized with canonical Particle Swarm Optimization (GRU-PSO)45, and the Transformer model46. A fair competition was ensured by training, validating, and testing all models on the same dataset under the same conditions. A set of evaluation metrics encompassing various statistical measures was then deployed: MSE, RMSE, MAE, MAPE, and R2. The detailed results for electric consumption prediction are recorded in Table 4. Table 4Presents a comparison of the forecasting performance of different models in electrical energy consumption.ModelMSERMSEMAEMAPE (%)R2GRU-MFSA (Proposed)125.0011.188.912.150.940GRU (Standard)385.5019.6315.823.850.815LSTM (Standard)450.2021.2217.054.120.784GRU-PSO195.7513.9911.232.720.898Transformer320.8017.9114.503.510.832 Presents a comparison of the forecasting performance of different models in electrical energy consumption. The analysis of results clearly demonstrates the superiority of the proposed GRU-MFSA model, which presented optimal performance according to all the evaluation metrics, having attained the lowest error rates (MSE: 125.00, MAE: 8.91, MAPE: 2.15%) and the highest value of R2, indicating the amount of variation explained by the model (R2: 0.940). This performance demonstrates a significant improvement over the original GRU model, achieving a 68 percent reduction in MSE, which highlights the crucial importance of MFSA hyperparameter optimization in maximizing the GRU’s predictive capability. The model performed 36 percent better in MSE than the GRU-PSO benchmark, thus validating the enhanced search capability of our new MFSA over the conventional PSO algorithm. Furthermore, its superior accuracy suggests that GRU-MFSA is remarkably data-efficient and well-suited for the architecture of the forecasting task at hand, outperforming the LSTM and Transformer architectures. The extremely low MAPE of 2.15% ultimately confirms the practical reliability of the model, thus establishing GRU-MFSA as a credible and contemporary contender in accurate electricity consumption forecasting. Conclusion This study developed an improved model that combined the Gated Recurrent Unit (GRU) Neural Network and the Modified Future Search Algorithm (MFSA) to enhance the efficiency of energy distribution and grid performance in smart power grids. GRU-MFSA outperformed traditional approaches with reduced error measures as Mean Squared Error (MSE) at training was 125, at validation was 2350, and at testing was 3985, whereas the correlation coefficients were 0.94, 0.85, and 0.81, respectively. The simulated results showed a steady increase in residential electricity demand from 2023 to 2040 as a result of population increase and technological progress, while the hydropower generation reduced steadily, indicating the need for better planning and integration of renewable resources. These results hold considerable practical significance, as they can assist policymakers in formulating sustainable energy strategies, enhancing grid infrastructure investments, and incorporating renewable energy sources to address increasing demands while minimizing environmental effects. Further research could improve the model’s applicability to diverse renewable energy sources, including wind and solar, incorporate real-time data for agile decision-making, and explore its potential uses in microgrid management or decentralized energy systems. Such advancements may contribute to the creation of more robust, flexible, and sustainable energy ecosystems globally. Author contributions Hao Tang, Yuening Wang, Xinping Yuan and Navid Razmjooy wrote the main manuscript text and prepared figures. All authors reviewed the manuscript. Data availability All data generated or analysed during this study are included in this published article. Declarations Competing interests The authors declare no competing interests. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Contributor Information Hao Tang, Email: tangtonight@163.com. Navid Razmjooy, Email: nrazmjooy@gmail.com. References Associated Data Data Availability Statement All data generated or analysed during this study are included in this published article.