A Novel Hybrid Approach Based on BAT Algorithm with Artificial Neural Network to Forecast Iran’s Oil Consumption

In this paper, we develop a function of population, GDP, import, and export by applying a hybrid bat algorithm (BAT) and artiﬁcial neural network (ANN). We apply these methods to forecast oil consumption in Iran. For this purpose, an improved artiﬁcial neural network (ANN) structure, which is optimized by the BATis proposed. The variables between 1980 and 2017 were used, partly for installing and testing the method. This method would be helpful in forecasting oil consumption and would provide a level playing ﬁeld for checking the energy policy authority impacts on the structure of the energy sector in an economy such as Iran with high economic interventionism by the government. The result of the model shows that the ﬁndings are in close agreement with the observed data, and the performance of the method was excellent. We demonstrate that its eﬃciency could be a helpful and reliable tool for monitoring oil consumption.


Introduction
e efficient application of energy is a factor which can considerably affect the sustainable development of countries. Energy is a foundation element of the modern industrial economy. Over the past few decades, energy has become a very critical element in industries and also a fundamental product and factor in the growth of the economy in different world regions.
e ever-increasing dependence of human life on energy has made this factor play a critically crucial role either potentially or actively in the functions of various economic sectors of countries [1]. Given the vital applications of energy in different economic sectors and also the rise of the population over past years, energy has turned the center of attention as one of the most significant factors of production [2]. Oil, natural gas, electric power, solar, wood, animal, and plant waste could be recognized as Iran's basic energy resource [3]. e oil industry is a fundamental factor in the economy of Iran and the government's annual budget. It affects foreign trade, the national capital, and developments in nonpetroleum exports [4]. erefore, recognizing the factors that affect the needed energy in a country is required in managing the energy supplement. Based on the reality that the energy demand procedure and factors that affect it go through vague and complicated patterns, determining efficient instruments for appropriate energy use is necessary. Due to the increasing demand for energy, the assessment of it is necessary. Different optimization techniques, e.g., birds, bats, and fireflies, are appropriate to forecast these models [1]. Different models are presented to determine the possible approach ever in modeling energy issues as a function of various indicators. Given the high dependency of the Iranian economy on oil incomes, acquiring data by employing precious and qualified methods in this field will result in more efficient planning. Hence, the studies in this field have a considerable degree of importance. We examine the relationship between oil consumption in Iran and diverse independent variables, based on socioeconomic factors, using the BANN (hybrid bat algorithm and artificial neural network) technique. Results arising from the present study provide important reference information for the utility companies in pursuing patterns of oil consumption and selecting a more accurate approach to estimate future oil demand.
A few studies that propose several models for energy demand policy management with different techniques are introduced. Pourdaryaei et al. [5,6] in two studies worked on short-run electricity price forecasting using hybrid algorithms. Using a hybrid method for electricity price forecasting via artificial neural network and artificial cooperative search algorithm and using the hybrid backtracking algorithm and the adaptive neuro-fuzzy inference system (ANFIS) approach have improved the accuracy and effectiveness. Kaboli and Alqallaf [7] conducted a study on solving the problem of sending nonconvex economic load via an artificial algorithm for cooperative research. us, they used a method that is to interfere and work with feasible solutions throughout the optimization. Hlal et al. [8] conducted an optimization study based on NSGA-II and MOPSO for sizing a hybrid PV/wind/battery energy storage system. Kıran et al. [9] applied artificial bee colony (ABC) and particle swarm optimization (PSO) techniques to forecast electricity energy demand in Turkey in two forms (linear and quadratic) by using selected socioeconomic and demographic variables that included gross domestic product (GDP), population, import, and export. Behrang et al. [4] presented GSA (gravitational search algorithm) oil demand estimation models to be used in the Iran context. In another study, Behrang et al. [10] predicted the total energy demand in Iran from 2006 to 2030, using the bees algorithm technique. Ceylan et al. [11] developed the harmony search (HS) technique to forecast Turkish transport energy demand in tree forms (linear, exponential, and quadratic) based on three factors including population, GDP, and vehicle kilometers. e energy consumption in Turkey is also determined by using the ant colony (ACO) by Toksari [12] with independent variables such as population, GDP, import, and export.
According to what has been presented, using nonclassic methods for the identification and prediction of complex systems-related problems has been expanded [13]. Hence, in this study, a novel approach for oil consumption forecasting is presented. Heuristic methods are used for the better optimal solutions and to overcome the complexity of the nonlinearities [14]. e authors' main goal, therefore, is to employ artificial methods, because of their accuracy, and present new methods, such as the proposed hybrid, in the field of oil and gas, to acquire more precise information and data. is paper is organized as follows. First, a brief introduction is presented. In the next section, we explain the specification of the BANN (hybrid bat algorithm and artificial neural network). Section 3 presents optimization and method validation. In Section 4, the model estimations are done, and finally, in the last section, the conclusion is given.
is algorithm is an evolutionary algorithm inspired by the behavior of natural bats in locating their foods. It is used to solve various problems. BA starts with an initial population of bats. It employs a homologous manner by performing an echolocation method for updating its position [16]. Bats send a signal with the loudness of frequency 20 kHz to 500 kHz. is signal is deflected back after striking the object to bat as an echo signal. e echo signal is used to calculate the bat's distance to any object which is the destination of the bat [17,18]. Bats fly towards the object or prey, and they reduce their pulse rate when they reach the closer object. Bats continue to do so till the distance becomes zero [18,19]. Also, they can distinguish between insects and obstacles to hunt prey based on the echo [20]. e BA is summarized in the following three main principal rules [15][16][17][18][19][20][21]: (1) Each bat utilizes echolocation characteristics to estimate the distance and to distinguish between prey and obstacles. In the simulations, each bat is associated with a velocity v t i and a location x t i with iteration t, in a d-dimensional search or solution space. erefore, the above three rules can be translated into the updating equations for x i t and velocities v t i : where βε[0, 1] is a random vector outcome from a uniform distribution. x * is the best current universal position, achieved after comparing the locations of all then bats. e frequency f during a range [f min , f max ] corresponds to a range of wavelengths [λ min , λ max ]. Indeed, the frequency just varies while the wavelength f is constant, and it is assumed that f ∈ [0, max] in implementation [22]. For the local search, a solution is selected among the best current solutions, and a new solution for each bat is produced using a random walk.
where εε[−1, 1] is a random number while L t is the average loudness of all bats. e loudness normally reduces when a bat finds its prey while the rate of the pulse emission increases. e loudness may be chosen as any value of convenience. It can be chosen as any value of convenience between L min and L max assuming L min � 0 which means that a bat has just found the prey and provisionally stops emitting sound. It is shown in the following:   where t is the iteration number during the optimization process. As time moves towards infinity, the loudnessL t i tends to be zero; then,r t i � r 0 i .

Artificial Neural Network (ANN).
Artificial neural network is a famous artificial intelligent method that simulates the work of the human mind mechanism. It is a method that handles information coming from different nodes in this model known as neurons. ese nodes are embedded in different layers which will work together to solve a complicated problem [23]. Artificial neural network is a mathematical approximation to the human nervous system that have been widely used to solve various nonlinear problems. e structure of ANN contains the elements of the input layer, hidden layer, and output layer. A network can contain multiple different hidden layers enabling the network to have computational and processing abilities. e number of layers is dependent on the problem complexity. In general, a neural network is a set of connected input and output units that each connection has an associated weight [13].
An artificial neural network (ANN) contains the elements of the input layer, hidden layer, and output layer. e ANN can contain multiple different hidden layers enabling the network to have computational and processing abilities. Figure 1 shows an artificial neural network (ANN) with a hidden layer, which contains some weights connecting between layers. e output values are going to be calculated through the subsequent steps.
First, the sum of weights is calculated as follows: where I i is the input variable, w ij is the weight between the input variable I i and neuron j, and β i is the input variable's bias term. Second, neurons' output values in the hidden layers are produced from the received values of weighted summation (equation (4)) by using an activation function. A popular choice of such a function is a sigmoid function as follows: where f j is the sigmoid function for neuron j and S j is the sum of weights. Finally, the output of neuron j is calculated as follows: where O j is the output of neuron j, w ij is the weight between the output variable O i and neuron j, f j is the activation function for neuron j, and β i is the output variable's bias term [24].

Proposed Method.
e goal of employing a bat algorithm and artificial neural network simultaneously is to present a higher performance estimation and forecast. When the bat algorithm is embedded into an ANN to optimize its initial weights and biases, it will play a well-suited role in addressing a number of the deficiencies caused by the randomness of the initial weights and biases of ANN. e main goal of using the BATalgorithm to optimize the ANN is to combine them, using the initial connection weights between ANN layers and the initial biases between neural nodes, to optimize the distribution, execute global searches within the solution space, and find the optimal initial weights and biases of the ANN at a rapid convergence rate. Subsequently, the initial weights and biases obtained by the ANN are often used for training and testing the sample set. e ANN with the optimal weights and biases is formed and trained to predict the output. e flowchart of the BANN algorithm is shown in Figure 2.

Optimization and Method Validation
Optimal tuning of PI controllers for load frequency controller design was proposed by Abd-Elazim and Ali     [25]. eir results of numerical simulation demonstrated the superiority of BA in comparison with simulated annealing in PI controller optimization. Bat algorithm which is a heuristic method is used for selecting features.
It is a metaheuristic algorithm. e process of optimization uses it. Function minimization or maximization is a major problem in optimization. Randomization is used for computing the best solution in the best optimum way

Empirical Results
To obtain oil consumption data, it is necessary to normalize in the first step. Equation (7) was used in this regard.
X N : normalized value, X R : the value to be normalized, X min : the minimum value in all the values for the related variable, and X max : the maximum value in all the values for the related variable. X min and X max values for each variable are selected between 1980 and 2012 and are shown in Table 1. e input parameters of the BANN included population, gross domestic product, import, and export, and the oil consumption was considered as the BANN output parameter [1]. e data on these parameters were divided into training, testing, and data validation. 70% of these data were used for training, 15% of data were used for validation, and the rest were used for testing. Figures 3-5 show the best validation performance graph and regression plot between actual and predicted data in the BANN method. Tables 2 and 3 and Figure 6 show the performance evaluation of BANN outputs. Figure 7 and Table 4 for the modeling and the testing data show the performance of the BANN method. Table 5 shows the comparison of different models introduced in the introduction and present study.

Conclusion
Demonstration of the significance of employing hybrid estimation strategies in the energy sector is the point of the present study. e relationship between economic development and energy consumption in developing countries is something essential, and it needs proper calculation for a wide variety of economic, social, and technological features. erefore, in this study, the BANN (hybrid bat algorithm and artificial neural network) has been successfully used to estimate Iran's oil consumption based on the structure of Iran's socioeconomic conditions. Oil consumption is estimated based on population, GDP, import, and export. e proposed method anticipated oil consumption in terms of relative errors and RMSE.
Given the high dependency of the Iranian economy on oil incomes, acquiring data by employing precious and qualified methods in this field will result in more efficient planning. According to Table 5, the empirical results of Iran's data exhibit that the accuracy of the BANN method was more precise than that of the other methods. Regarding the results, oil consumption is influenced by population, GDP, import, and export. Hence, the findings proved that the recommended model was an appropriate tool for effective oil consumption prediction in Iran. It will provide a level playing field for checking the energy policy authority impacts on the structure of Iran's energy with high economic interventionism by the government. e BANN success in such a study suggests that it could be applied as a practical instrument for energy-economic analysis in various areas, such as designing energy systems with more theoretical specifications complexity. Forecasting oil consumption can also be studied by other metaheuristics including harmony search and simulated annealing. e results of different methods could be put into analogy with the BANN method.

Data Availability
All data are available in the British Petroleum Company plc and BP Amoco plc [27].