Modeling of Energy Consumption Forecast with Economic Indicators Using Particle Swarm Optimization and Genetic Algorithm: An Application in Turkey between 1979 and 2050

Particle swarm optimization (PSO) and genetic algorithm (GA) are the most important optimization techniques among various modern heuristic optimization techniques. The study aims to forecast the energy consumption in Turkey until the year 2050 using PSO and GA models. The annual data provided by the Ministry of Energy and Natural Resources, International Energy Agency (IEA), OECD, Turkish Statistical Institute were used in the study. PSO and GA energy demand forecasting models are developed using population, import, export and gross domestic product (GDP). All models are proposed in linear and quadratic forms. Turkey's energy consumption is projected according to four different scenarios. According the analysis results, the study found for the PSO analysis the R values in the linear model was 91.72%, in the quadratic model was 94.06% at the same time for the GA analysis R values in the linear model was 91.71%, in the quadratic model was 93.97%. Additionally, the mean absolute percent error rates were 11.58% for PSO and 11.69% for GA in the quadratic model. According to Lewis, these values showed that models could be used for energy consumption estimation purposes. The study determined that the statistical performance criteria of PSO models were more successful than the statistical performance criteria of GA models.


Introduction
Energy is of great importance in the economic and social development of a country. Therefore, determining the energy issues, analysis and development of energy policy options are of primary importance. Energy demand forecast is one of the most important political tools used by the decision makers of a developing country. Energy is quite important for every strategy that will be formed to increase economic growth and human quality of life (Toksarı, 2007, pp.3984). The importance of the energy sector greatly affects the development, growth and economic situation of every country. A very comprehensive type of energy, electric energy plays an important role in economic growth and development. Every country may encounter economic crises and performance decrease due to the effect of the energy sector (Song et al., 2017;Rehman and Deyuan, 2018). To prevent these situations, energy production must meet energy consumption. Accurate and reliable electric consumption and production forecasts are important in the development and economic growth of the country. Turkey has been one of the fastest growing energy markets in the world with young and growing population, rapid urbanization and economic growth. Accordingly, the energy demand in Turkey is rapidly increasing (Kıran et al., 2012, pp. 93). There is a significant correlation between energy consumption and socioeconomic and demographic indicators. There are various parameters used to obtain accurate and reliable results on the energy consumption forecasts, and this study used gross domestic product (GDP), population, import and export parameters to forecast the energy consumption in Turkey.
The study aimed to model the energy consumption in Turkey with the data obtained between 1979 and 2017 using the particle swarm optimization (PSO) and genetic algorithm (GA) methods, and predicted the energy consumption values in Turkey between 2018 and 2020 using the linear and quadratic models formed. Additionally, the study determined which optimization method-related model performed better by comparing the statistical performance indicators and accuracy criteria of linear and quadratic models created with PSO and GA. Accordingly, this study has five sections; the first section is introduction, the second section mentions the literature review, the third section tries to explain the general lines of PSO and GA under the title of methodology, the fourth section mentions the analyses and findings, and the last section deals with the conclusion and discussion.

Literature
Studies on the energy consumption forecast were tried to be summarized below. Yuan et al. (2017) reached the conclusion that the future energy consumption in China will be equal to 4.97/5.25 billion tons of standard coal in the low/high growth scenario using the Bayesian approach to realize China's energy consumption forecast by 2030. Barak and Sadegh (2016) used ANFIS and ARIMA models to forecast the energy consumption in Iran and found that the analysis result of MASE which was one of the statistical performance criteria varied between 0.058% and 0.026%. Alphanumeric Journal Volume 8, Issue 1, 2020 Xie et al. (2015) used grey forecasting model and Markov model in their study on China's energy consumption forecast by 2020. The study found that crude oil would reach 40.6% in 2015 and 35.9% in 2020 according to made forecast results.
To forecast the energy demand in Turkey, Kiran et al. (2015) compared the artificial bee algorithm, particle swarm optimization and ant colony algorithm, and found that the artificial bee algorithm was superior than the other methods. Cao et al. (2014) hybridized the support vector regression and quantum behavior particle swarm optimization to forecast the energy demand in China and found that this model was superior than the other models. Assareh et al. (2012) used PSO and GA to realize Iran's energy consumption forecast and foresaw the energy consumption forecast by 2030. Feng et al. (2012) used grey forecasting model for China's energy consumption forecast and stated that consumption of clean energy resources will increase in the future. Yu and Zhu (2012) used PSO and GA methods to realize China's energy consumption forecast and revealed that the energy consumption would reach the equivalent of 4.70 billion tons coal in 2015.  developed a hybrid method by combining the bee colony algorithm and PSO for the energy consumption forecast in Turkey and compared these optimization methods.  applied the ant colony and PSO methods to realize Turkey's energy consumption forecast, compared the optimization methods and found that the error of estimation of the ant colony optimization were low and quadratic model provided better results. Avami and Boroushaki (2011) applied artificial neural networks method to determine Iran's energy consumption forecast and revealed that the established model was at an acceptable level for energy consumption estimation. Behrang et al. (2011) used the bee colony algorithm with socio-economic factors to determine Iran's energy consumption forecast and predicted the energy demand in Iran by 2030. Huang et al. (2011) used LEAP method to estimate the energy demand in Thailand and determined that nuclear energy plants had important and positive effects. Lee and Tong (2011) used grey analysis method to determine China's energy consumption forecast and found that the error rates were low; thus, the model that they determined could be used for estimation purposes. Kumar and Jain (2010) used Grey-Markov model, singular spectrum analysis and grey model methods to realized India's energy consumption forecast and stated that the MAPE values of the models formed in relation to these methods and these methods could be used for energy forecasts.  Ekonomou (2010) used and compared the artificial neural networks and linear regression methods to forecast the energy consumption in Greece and stated that the artificial neural networks method provided better results. Mucuk and Uysal (2009) applied Box-Jeckins method to realize Turkey's energy consumption forecast by 2015 and estimated that the energy demand would be 119.472 tons of oil equivalent (TOE) in 2015. Geem and Roper (2009) used the artificial neural networks method to forecast the energy demand in South Korea and revealed that this method provided better results than the linear regression method. Ünler (2008) applied PSO method to forecast the energy consumption in Turkey and estimated the amount of energy consumption by 2025. Ediger and Akar (2007) forecasted the energy consumption in Turkey by 202 using the autoregressive integrated moving average (ARIMA) model and found that the total energy demand would decrease due to the deceleration of economic growth. Ceylan et al. (2005) developed a model with the GA method to realize Turkey's energy consumption forecast, and applied correlation analysis for the validity of the model in 2000-2020 period. Haldenbilen and Ceylan (2005) revealed that the quadratic model among the models developed with the GA method to determine the energy demand in Turkey by 2020 provided better results than linear model, and that this model could be used for energy forecasts due to its high correlation coefficient. Ceylan and Öztürk (2004) estimated the energy demand between 2020 and 2025 in Turkey with the models they developed using the GA method to realize Turkey's energy consumption forecast.

Particle Swarm Optimization
Swarm intelligence is a branch of artificial intelligence that investigates the emergence of features of complex, self-organizing and decentralized social systems with collective behavior (Parsopoulos and Vrahatis, 2010, pp.16). Swarm intelligence deals with collective behaviors resulting from the local interaction of individual components with each other and with their environment. The examples are nestling, foraging, substance separation in insects, and swarm and learning behaviors in vertebrates (Sun et al., 2011, pp.15).
The PSO is a population based heuristic optimization method that Electrical Engineer Dr. Russell C. Eberhart and Social Psychologist Dr. James Kennedy developed in 1995 inspired by the foraging, sheltering and avoiding danger behaviors of insects, coveys and shoals (Özdemir and Öztürk, 2016, pp. 60;Parsopoulos and Vrahatis, 2010, pp.18;Omran, 2006, pp. 23;Sun et al., 2011, pp.17;Couceiro and Ghamisi, 2016, pp.1 In PSO, each individual is called a particle and the community of these particles is called a swarm. Swarm particles spread randomly into the seek area. The purpose of every particle in the swarm is to reach an optimum solution. Every particle in the swarm use three elements to decide its next move. These are its current speed, its best position so far, and the best position of the informers (Clerc, 2010, pp. 36). The speed and position of the particle are updated in every iteration based on personal and social experiences. The update continues until the particles in the swarm reach their best position and goal (Eberhart et al., 2001, pp. 90;Wang et al., 2007;Özsağlam et al., 2008, pp. 300;, pp.1;Özyön et al., 2012, pp. 176).
The below steps are followed for each particle to reach their best position (Lazinica, 2009, pp. 366):  Step 1: The starting swarm is formed with randomly selected N number of particles.


Step 2: The new velocity vector is calculated based on the features of every particle.


Step 3: The old and new positions are compared for every particle, and a new position is generated.


Step 4: If the termination condition is fulfilled, it is stopped, and if it does not meet the condition then it is returned to step 2.
Velocity and position vector equations form the basis of PSO. The movement of the particle is based on its velocity at that moment, and the new velocity vector of the n particle is calculated according to equation 1. Shi and Eberhart (1998) formed the following mathematical equation of PSO using the equilibrium coefficient (w, inertia weight) (Shi and Eberhart, 1998, pp.70;Alireza, 2011, pp. 542;Lazinica, 2009, pp. 52;Sun et al., 2011, pp. 78).
Cognitive component Social component Experiential information in other words the cognitive component enables the particles to be in the best position according to their past performances. Social component (socially changed information) enables the particle to be in the best position in its neighborhood (Olsson, 2010, pp. 34;Kiranyaz et al., 2014, pp. 45). To calculate the new position vector the velocity of the particle is added to the old position vector as seen in the equation 2.
The equation of new velocity vector (2) and the equation of new position vector (2) may not be in the updated position combinational seek area. Therefore, the basic PSO algorithm is less effective than other heuristic combinational optimization problems (Olsson, 2010, pp. 121).
Since every particle has its own specific velocity in PSO, the velocity of this particle reaches the optimum with the information obtained from other particles. This Alphanumeric Journal Volume 8, Issue 1, 2020 velocity is re-calculated in every cycle based on previous best results. The swarm gets in a better position in every cycle (Özsağlam, 2009, pp. 14).
The required procedure for PSO algorithm is as follows (Olsson, 2010, pp. 35): BEGIN Adjust starting parameters For all particles, get initial conditionings End Do For all particles, calculate the conformity value If the conformity value is better than the local best value, Set the current value as the new local best value End Set the best of the local best values of all particles as the global best value of all particles For all particles, (1) calculate the particle velocity according to the equation (2) update the particle position according to the equation End While maximum iteration number or minimum error condition is provided, proceed END Algorithm 1. PSO Algorithm

Genetic Algorithms
GA is an optimization and a search method associated with the genetic and natural selection principles (Baluja, 1994, pp. 4;Değertekin et al., 2006, pp. 3921;Özçakar et al., 2012, pp. 128). GA aims to maximize "fitness" of a population consisting of many people under the specified selection rules (Çolak, 2010, pp. 426).
GAs are numerical optimization algorithms inspired by natural selection and genetic (Bodenhofer, 2003, pp. 1). Chromosome, gene, population and coding are the fundamental terms of GA. Chromosome: Chromosome is the structure that determines how to form the organism in a biological organism. One or more chromosomes might be needed to form an organism. All chromosomes are called genotypes, and the organism formed is called a phenotype (Coley, 1999, pp. 17). Gene: Chromosomes consist of separate units named genes. The smallest structures that transfer information are called genes (Emel et al., 2002, pp. 26). Population: It is the total of chromosomes. Population is normally started randomly. The possible solutions include the whole range. Coding: It is the match mechanism between solution domain and chromosome.
Step: A population of randomly selected N number of chromosomes is formed (proposed solutions of the problem).

2.
Step: The conformity value is calculated for every chromosome in the population.

3.
Step: Chromosomes are randomly selected according to the determined probability values.

4.
Step: New individuals are formed with crossing and mutation.
Step: The current population is replaced with the new population.

7.
Step: It ends when the iteration ending criteria are met. The best solution is selected according to the objective function.
The general structure of the GAs are as follows (Gen and Cheng, 2000, pp. 2): begin t = 0; Form the P ( t ) starting population; Calculate the conformity values of P ( t ) chromosomes; while (if the ending criteria are not met) do begin Replace P ( t ) = C ( t ) with the operators. Calculate the conformity values of C ( t ) chromosomes; P ( t+1) (new population) = C ( t ) and P ( t ) choose the suitable ones t = t + 1; end end Algorithm 2. Genetic Algorithm P (t) = t. refers to the t generation population. C (t) = t. refers to the chromosomes in the t generation.
Each GA component has parameters. These parameters are as follows (Deb, 1999, pp. 206

Statistical Performance Criteria
Four separate statistical performance criteria were used and compared to associate Turkey's electricity energy consumption values estimated with PSO and GA methods with the actual consumption values. The designated performance criteria are as follows: specificity coefficient (R2), mean square error (MSE), mean absolute percent error (MAPE), relative root mean square error (RRMSE) (Kişi, 2014;Kaytez et al., 2015;Shamshirband et al., 2015;Yakut and Süzülmüş, 2020).

Analyses and Findings
This study used two methods to determine the energy demand forecast. These methods were the PSO and GA. The study aimed to determine which method gives the best results by comparing these two methods. The study used the following variables in the analysis: GDP, import, export and population variables (Ceylan and Öztürk, 2004;Ceylan et al., 2005;Toksarı, 2007;Ünler, 2008;Toksarı, 2009 The study used linear and quadratic equations to forecast the energy consumption amount in Turkey and formed energy consumption models. The objective function for the energy consumption model is given below. Matlab 2017 software was used for PSO and GA methods. Four different scenarios were tried to estimate Turkey's energy demand between 2018 and 2050. The first three scenarios which were used in the studies by Ünler (2008) and  were analyzed. The scenarios used are as follows:  Scenario 1: Gross domestic average growth rate is assumed to be 3.5%, population growth rate is estimated to be 0.1%, import growth rate is estimated to be 7% and export growth rate is estimated to be 5%.
 Scenario 2: Gross domestic average growth rate is assumed to be 7%, population growth rate is estimated to be 0.12%, import growth rate is estimated to be 3.5% and export growth rate is estimated to be 2.5%.
Alphanumeric Journal Volume 8, Issue 1, 2020  Scenario 3: Gross domestic average growth rate is assumed to be 5%, population growth rate is estimated to be 0.8%, import growth rate is estimated to be 3.5% and export growth rate is estimated to be 4%.
 Scenario 4: Time-series analysis was applied to data between 1979 and 2017. Figure  1 shows the conceptual structure of the study.  Figure 1 showed the conceptual structure of the models used for PSO and GA methods. The linear and quadratic models were formed using the energy consumption, population, import, export and GDP data between 1979 and 2017, then the forecast of Turkey's energy consumption by 2050 was realized with the help of these models. Additionally, the results of linear and quadratic models of PSO and GA were compared based on the statistical performance criteria.

Analysis of Energy Consumption Forecast with Particle Swarm Optimization
The parameters for PSO application to form the energy consumption model in linear and quadratic forms are as follows:   The actual energy consumption values were compared to the estimated energy consumption amounts related to linear and quadratic models that were formed using PSO model in Figure 2. The study found that the quadratic model formed with PSO provided more successful results than the linear model and that the quadratic model provides estimation values closer to the actual energy consumption values. The forecast results of the scenarios according to PSO linear model were compared in Figure 3.  Turkey's energy consumption forecast values were calculated according to four different scenarios using the PSO quadratic model. While the scenario 2 of the PSO quadratic model foresaw lower energy consumption amounts than the other scenarios, this situation is thought to be explained by the fact that the import growth rate stated in the scenario 2 is higher than the export growth rate, and that the

Analysis of Energy Consumption Forecast with Genetic Algorithm
The parameters related to the application of GA to form the GA and energy consumption model in linear and quadratic forms are as follows: The abovementioned GA parameters were activated for linear and quadratic energy consumption models, and the following coefficient values of the energy consumption models were obtained. Accordingly, R 2 values of the energy consumption models formed using GA were 91.71% for linear model and 93.97% for quadratic model.    1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 Figure 7 shows the forecast values of the scenarios according to GA quadratic model.

Comparison of Statistical Performance Criteria of PSO and GA Models
The study used R 2 , MSE, MAPE and RRMSE statistical performance criteria to measure the performances of PSO and GA linear and quadratic models.    97% in the quadratic model. Accordingly, the study revealed that PSO and GA quadratic models are good models because their MAPE and RRMSE values were below 20%, and that the linear models are reasonable models because they were realized below 50% (Lewis, 1982;Kaytez et al., 2015;Shamshirband et al., 2015). Additionally, the study found that the statistical performance indicator values of PSO linear and quadratic models provided better performance than values of GA linear and quadratic models. The statistical performance indicator values of PSO quadratic model used for Turkey's energy consumption forecast were more successful than other three models.

Conclusion and Discussion
Energy consumption forecast is very important for the development of accurate forecasting models due to the fact that it is affected from rapid economic development, government decisions, technology and other factors. Reliable and realistic energy demand forecasts help to finance and develop the necessary measures for sustainable economic growth in Turkey (Kıran et al., 2012, pp. 102).
This study aimed to forecast the energy consumption in Turkey by forming PSO and GA linear and quadratic models using socio-economic factors such as GDP, population, import and export. The study used the data between 1979 and 2017 to form the linear and quadratic equations, calculated the forecast values between 2018 and 2050 by determining four different scenarios to estimate the energy consumption in Turkey, and found that the scenario 4 provided higher energy consumption forecasts than other three scenarios.
The findings of the study showed that the 2 values of PSO and GA linear and quadratic models were between 0.9171 and 0.9406, that the 2 value of the PSO quadratic model was more successful on the energy consumption forecast with 94.06% explanatory power compared to other models. Similarly, the study showed that PSO and GA quadratic models can be included in the category of good models for the purpose of estimation due to the fact that MAPE values were below 20% with PSO's MAPE value as 11.58% and GA's MAPE value as 11.69% in regard to quadratic models. According to the results of MSE, MAPE and RRMSE which were among the statistical performance criteria, PSO had lower values than GA, and that PSO provided better forecasts than GA according to these criteria. Table 3 shows the relevant studies on energy consumption predictions.