# An Improved Particle Swarm Optimization and Adaptive Neuro-Fuzzy Inference System for Predicting the Energy Consumption of University Residence

Authors: Stephen Oladipo; Yanxia Sun; Oluwatobi Adeleke
Journal: International Transactions on Electrical Energy Systems
 (2023)

---

## Abstract

Future energy planning relies on understanding how much energy is produced and consumed. In response, this study developed a multihybrid adaptive neuro-fuzzy inference system (ANFIS) for students’ residences, using the University of Johannesburg residence, South Africa as a case study. The model input variables are wind speed, temperature, and humidity, with the output being the equivalent energy consumption for the student housing. While the particle swarm optimization (PSO) technique is versatile and widely used, it falls short by exhibiting premature convergence. To address this problem, the velocity update equation of the original PSO algorithm is modified by incorporating a dynamic linear decreasing inertia weight, which improves the PSO algorithm’s convergence behaviour and aids both local and global search. Following that, the modified PSO (MPSO) is used to optimize the ANFIS parameters for the best model prediction. A comparative analysis is conducted between the MPSO, the original PSO, and six other hybrid models using a dataset division of 70% for training and 30% for testing. Performance evaluation was carried out using three well-known performance benchmarks: root mean square error (RMSE), mean absolute deviation (MAD), and coefficient of variation (RCoV). The experimental results show that the performance of the proposed MPSO-ANFIS outperformed other methods with the least values of the RMSE (1.8928 KWh), MAD (1.5051 KWh), and RCoV (0.1370), respectively. Furthermore, when compared to the PSO-ANFIS, the MPSO-ANFIS demonstrated improvements in RMSE, MAD, and RCoV with 1.58%, 2.11%, and 5.23%, respectively. Based on the results, it can be concluded that the MPSO-ANFIS provides better prediction accuracy which is vital for strategic energy planning.


---

## Body

## 1. Introduction

Modern society relies heavily on electricity as a source of energy, and as the economy and population grow, so does its use [1]. To meet this demand, electric utility companies strive to provide an uninterrupted supply of electricity to consumers through the process of generation, transmission, and distribution [2]. However, for the energy supply to remain stable and for end users to improve their operations, a realistic energy projection is required. Power companies can effectively minimize their operation costs, ensure the economic operation of the power grid, and improve social and economic benefits by predicting electricity consumption accurately [3]. Also, the emergence of pandemics, such as the coronavirus disease (COVID-19), has propelled societies toward a new normal, and adapting to it is inevitable. This has greatly impacted the operation of electric companies in terms of achieving a balance between energy produced and the rate of consumption. For instance, in South Africa, the total energy usage increased by 7% in 2021, following a 9% decline in 2020 as a result of the COVID-19 problem. It had previously climbed by 1.3% each year between 2017 and 2019 [4]. In many developing countries, the pandemic’s impacts, along with unfavourable energy conditions, exacerbate previously existing problems. The best course of action is to look into artificial intelligence technology, which is based on mathematical and statistical methodologies and has shown potential solutions for many problems by examining the past and present for potential answers to problems in the future. According to earlier research, machine learning (ML) has played a significant contribution in this aspect [5–10].Eskom, South Africa’s (SA) principal electric company, generates around 96% of the country’s energy, with the rest coming from independent power producers and imports. Eskom also transmits and distributes most of the power in the country [11, 12]. SA is the 5th largest coal producer in the world. The main power generation source in the country is coal [13]. Apart from emitting toxic pollutants, coal combustion also contributes to the nation’s substantial carbon emissions. Universities are one of the country’s largest energy consumers. SA provinces are said to have similar consumption patterns, with the more developed regions or provinces relying substantially on electricity [14]. Over the past decade, the university education sector has advanced rapidly, which has resulted in a rise in campus energy consumption in proportion to overall societal energy consumption [15]. Another factor driving the surge in energy usage is the huge demand for plug-load gadgets and buildings. Consequently, planning for adequate energy management becomes very important. Efforts to minimize energy use on university campuses are unquestionably necessary since this would cut campus greenhouse gas emissions and energy expenses [16, 17]. In response to high energy use, there are significant emissions of gasses, including carbon dioxide (CO2), methane (CH4), and nitrogen oxides (NO) [18]. Nevertheless, analysis of energy consumption and smart forecasting can be used to understand the potential for energy reduction on university campuses. Lowering energy usage in buildings is a primary mechanism for reducing energy consumption on university campuses, and it invariably results in energy conservation and reduced operating costs for institutions [16]. With the advent of the green campus concept, a worldwide trend has begun wherein several countries integrate the concept of sustainable development into their educational systems and actively engage in low-carbon activities on campus [15, 19].Having a reliable energy forecast is critical to ensuring energy supply stability and better operations for end-users [20]. As noted in [12], policies that enhance the development of tools which can forecast demand is key to maintaining energy stability. The exploration of such tools can lead to making accurate and informed decisions in the case of planning for the future. In terms of how long the forecasting period covered is, there are three distinct forecasting categories: short-term forecasting (STF), medium-term forecasting (MTF), and long-term forecasting (LTF). An STF normally covers 24 hours to one week; an MTF from one week up to one year; and an LTF covers a more extended period than both the aforementioned categories [21]. Over the years, forecasting techniques have seen a lot of advancements. As opposed to conventional linear models, nonlinear forecasting has received more attention. The reason for this is that real-world problems are nonlinear and only nonlinear forecasting techniques can provide accurate and reliable forecasting models [22]. For this reason, nonlinear prediction models are a fundamental part of ensuring robustness and model sensitivity to perturbation [23]. An example of a nonlinear forecasting model is the artificial neural network (ANN). The ANN model is a nonlinear mapping structure built on the framework of human neurons and has been efficaciously used to address a range of problems in various fields [24]. ANFIS is another modelling technique which amalgamates the ANN with a fuzzy inference system (FIS) to improve the speed, fault tolerance, and addictiveness of the modelling system [25]. Thus, ANFIS has recently gained a lot of acceptance in its application to time series prediction and problem forecasting. Its efficacy is demonstrated in its superior performance over other existing methods. This is because of its unique capabilities of utilizing both ANN and FIS. The ANFIS, on the other hand, may also not be precise in all cases because its parameters need to be determined and upgraded optimally. Otherwise, it may get stuck at a local point and not converge to its optimal value [26]. Hence, the parameters of the ANFIS can be optimized utilizing the evolutionary algorithms (EAs).The integration of EAs and ANFIS structures produces a powerful AI-based forecasting technique that utilizes both the learning aptitude of the conventional ANNs and the dynamic nature of fuzzy logic to produce accurate predictions [27]. On that account, past studies have looked into using ANFIS for energy load forecasting. For instance, in ref. [28], an evolutionary-based long-short-term memory (LSTM) neural network model (NN) was carried out to predict the energy consumption of two educational buildings. The authors employed the genetic algorithm (GA) to optimize the LSTM neural network model. The authors found that LSTM-based GAs performed better than LSTM models that used grid search, Bayesian optimization, and PSO for hyper-parameter determination. In another work, Yuan et al. [29] offered an ANN-based prediction model for seasonal hourly electricity consumption for three areas of a university campus using Japan as a case study. The proposed model generated optimal results with Correlation coefficients between 0.95 and 0.99 by using feed-forward ANN trained with Levenberg–Marquardt (LM) back-propagation algorithms. For predicting electrical load demand, Ghenai et al. [30] designed an STF model. Training data made up 80%, testing data 10%, and validation data 10% of the total data. The developed model was successful with the lowest values of the normalized mean squared error (nMSE) and the normalized mean absolute error (nMAE).Moon et al. [31] conducted a comparative study using diverse combinations of hyperparameters (activation function and number of hidden layers) of neural networks to identify the most efficient parameters for an ANN-based energy consumption model. The authors reported the optimal performance of the proposed model with five hidden layers and the scaled exponential linear unit (SELU) activation function.A comparison of the classical linear regression and the ANN model prediction for power usage in a campus building utilizing occupancy rates and weather components was performed in ref. [32]. The findings in the work show that the overall performance of the ANN model delivered a more precise model compared to the linear regression technique under different scenarios. Also, Machado et al. [33] developed a technique for studying the effects of using a feed-forward neural network (FFNN) to improve load demand forecasts. This method involves predicting the initial forecast errors from a second FFNN. Compared to other models in the study, the recommended technique greatly improved the quality of load demand estimations.An ANFIS-basedshort-term predictive model for an educational building was carried out in [30]. The suggested model produced accurate prediction under various statistical metrics using a data split of 80%, 10%, and 10% for training, testing, and validation, respectively. The authors in [34] developed four ANFIS-based models for energy consumption of multicampus using tertiary institutions in SA as a case study. Considering diverse climatic data, the proposed models explored the capability of two renowned clustering techniques, namely, fuzzy c-means (FCM) and grid partition (GP) for data clustering. The performance of the proposed model with FCM outshone other techniques with better forecast accuracy, minimal error, and computational time. That said, other works have been carried out using hybrid models.The authors in [35] proposed a hybrid genetic algorithm (GA)-based ANN for predicting the electricity load demand of the Delhi region. In their study, models comprising the standalone ANN, regression algorithm (RA), nonlinear autoregressive exogenous (NARX), and the proposed GA-ANN were examined. Results from the study showed that the proposed GA-ANN had a superior MAPE index value and did better in terms of regression value than standalone ANN, RA, and NARX models. Auto-regressive integrated moving average (ARIMA) was combined with ANFIS in ref. [36]. Under the diverse scenario, the proposed ARIMA-ANFIS overtook its counterparts with improved accuracy and minimal error. According to the simulation results, this model is more accurate than other linear models, including support vector machine (SVM) and ANN.Using India as a case study Kumaran and Ravi [37] investigated the application of a combined model which consists of ANN and biogeography optimization algorithm (BOA) for an LTF of electric power demand. Considering socio-economic factors like the population, the proposed model utilizes two ANNs tuned by BOA to obtain the best possible map between the input and output values in nonlinear space. Also, Ahmad et al. [21] examined diverse techniques of electrical load forecast in buildings using AI-based approaches such as SVM and NNs. They demonstrated that combining two forecasting methodologies yields better outcomes than using just one.Banda and Folly [38], evaluated the performance of a combination of PSO and ANN in predicting electrical load demand for periods ranging from one hour to a week. The PSO algorithm was utilized to tune the structure of the conventional ANN model to reduce the forecasting error and present an accurate model. Their findings showed that the hybridized PSO-ANN exceeded the standalone ANN. Among some of these works are the applications of EA to optimize the parameters of ANFIS. A hybrid model for forecasting ultrashort-term power loads was developed in [39]. The parameters of self-adaptive differential evolution (SaDE) were harnessed to fine-tune the two-layer NN for power load forecasting. The authors reported the best performance with the SaDE-based NN compared to other methods. ANN was combined with the PSO algorithm in forecasting the energy consumption for a multicampus university in ref. [40]. Their work employed a dataset division of 70% and 30% for training and testing, respectively. The results of their work showed that the ANFIS-based PSO delivered optimal results compared with the standalone ANFIS model. A merger model was proposed in [41] for a time series forecast.Whereas prior research investigated the application of SVM, ARIMA, AVN, ANN, ANFIS, and other machine learning (ML) techniques in electric load forecasting, current work has demonstrated that combining different ML techniques can bring a lot of benefits over a stand-alone approach. Because most ML methods are designed to handle a single job or dataset, combining different ML methods can greatly enhance the overall result by helping each other to tune, extend, or adapt to unfamiliar tasks [42]. The aptitude to overcome specific algorithm restrictions without sacrificing efficiency contributes to hybrid techniques outperforming stand-alone alternatives [2]. This present work explored the integration of ANFIS and evolutionary algorithms to enhance model performance by integrating ANN relational structures and learning abilities, fuzzy logic’s inherent dynamic characteristics in decision making, and evolutionary algorithms’ parameter-tuning capabilities. As well, many of the previous works applied the standard PSO to optimize the ANFIS model. However, in this work, an enhanced PSO algorithm is explored by introducing a modified linearly decreasing inertia weight for better performance. Furthermore, though the ANFIS has been applied in forecasting energy consumption on campuses, to the best of our knowledge only very few analyses are accessible which apply and compared several hybrid methods to determine a high-performance model. The purpose of this research is to conduct a comparative study to evaluate the performance of the proposed predictive modified PSO-ANFIS along with other hybridized models that include both old and new generational evolutionary algorithms such as the GA [43], DE [44], PSO [45], FA [46], IWO [47], BBO [48], and TLBO [49] for forecasting energy consumption of a student residence. This approach is used to evaluate the performance of the training process using real consumption data. Therefore, this present work aims to develop an artificial intelligence-based model which comprises improved particle swarm optimization and an adaptive neuro-fuzzy inference system for predicting the energy consumption of university residents. The student residence at the University of Johannesburg, Gauteng, SA is used as the case study.The main contributions of this paper are as follows:(1)
A new modified particle swarm optimization (MPSO) algorithm which integrates a modified linear decreasing inertia weight is proposed(2)
Develop a multihybrid medium-term forecast (MTF) for predicting the energy consumption of student residences, using the University of Johannesburg residence as a case study(3)
Compare the performance of the proposed MPSO-ANFIS with other developed hybrid models under some statistical metrics such as RMSE, MAD, and RCoVThe remainder of this study is described as follows. Section2 offers the material and method. Section 3 discusses the suggested model. The experiment’s findings and discussions are obtainable in Section 4. Section 5 concludes by presenting the results.


## 2. Materials and Methods

### 2.1. Case Study

Gauteng is South Africa’s smallest province (Figure1), with a total land area of around 18,170 km2, accounting for about 2% of the country’s total land area. Nevertheless, with a population of 15.5 million, Gauteng has the highest population density in SA and makes up 26.0% of the national population [50]. Geographically, Johannesburg is in Gauteng Province, near the tropics at latitude 26°120′ 08″ S, and longitude 28°02′ 37″E, with an elevation of about 1767 m and a surface of 1645 km2. Johannesburg is SA’s largest city and the country’s main industrial and financial metropolis. It is designated as a megacity [50]. Summers in Johannesburg are wet and slightly gloomy, while winters are relatively sunny, dry, and clear, but still cool. As well as summer, autumn, and spring are also important seasons in Johannesburg. Johannesburg typically has a maximum temperature of approximately 21°C in January and a minimum temperature of about 10°C in July [51]. Seasonal changes, especially with the levels of temperature and humidity, have a significant influence on people’s lifestyles and inevitably on energy consumption. Historically, summers have lasted longer than winters. Figure 1 shows the geospatial mapping information of SA, Gauteng Province, Johannesburg, and the University of Johannesburg, respectively. The student residence at the University of Johannesburg, SA is used in this study as a case study.Figure 1
Map showing the geographic location of the study area.


### 2.2. Data Collection

This paper examines several hybrids of ANFIS-based models for estimating the power usage of student residences at the University of Johannesburg in SA. The seasonal weather information used captured all the different seasons in line with the location of the study area. With respect to the campus’s geographic location, the climatic data (wind speed, temperature, and humidity) were gathered from the nearby weather stations of the South African weather service (SAWS). Furthermore, the hourly energy consumption of the student residence which covers the four major SA seasons, namely, autumn (1 March–31 May), winter (1 June–31 August), spring (1 September–30 November), and summer (1 December–28/29 February) were obtained for the year 2017. The energy consumption data for the student residents were obtained from the study of Masebinu et al. [52]. Located on campus, the student residence has 17 rooms (including a kitchen and a washing area) and 4 toilets and bathrooms. The data comprise real-time power consumption and are a time-series dataset acquired from real-time energy monitoring equipment from the student residence’s distribution panel [52]. Figure 2 shows the architectural design of the model under study.Figure 2
Architectural design of the hybrid model.


### 2.3. ANFIS Model

The adaptive neuro-fuzzy inference system (ANFIS) was presented by Jang [25] in 1993. It is a unique hybrid model which employs the pair features of neural networks and fuzzy logic in its design. The basic ANFIS model uses five layers and fuzzy IF-THEN rules to produce a nonlinear map between input and output, as illustrated in Figure 3. In the first layer, two inputs are received, x and y, and each node’s output is determined by the generalized Gaussian membership function (μ). These steps are depicted in the following equations (1)–(3)[25]:(1)O1i=μAix,i=1,2,(2)O1i=μBi−2y,i=3,4,(3)μx=e−x−ρi/αi2,where membership values of μ are designated as Ai and Bi; the premise parameter sets are ρi and αi.Figure 3
ANFIS model architecture.The output of each node in the second layer (the firing strength of a rule) is calculated in the next phase of ANFIS using the following equation:(4)O2i=μAix×μBi−2y.The output of the third layer node is described in equation (8), which is also known as the normalized firing strength:(5)O3i=wi¯=ωi∑i=12ωi,.The output is computed by the adaptive nodes at Layer 4 using the following equation:(6)O4,i=wi¯fi=wi¯pix+qiy+ri,where pi, qi , and ri are the consequent parameters of the node i. The ANFIS model’s final layer contains just one node, and its output is calculated as follows:(7)O5=∑iwi¯fi.Findings have shown that the application of ANFIS is met with sluggishness in the convergence of training leading to being easily stuck in local optima owing to the widened search space [53]. To overcome such a problem, employing a hybrid method is crucial.


#### 2.3.1. Fuzzy c-Means Clustering

Clustering plays a significant role in creating a FIS structure and grouping data points into membership functions (MFs) based on related fuzzy clusters. This is accomplished using popular clustering techniques, such as FCM, subtractive clustering (SC), and GP. Due to the fact that clustering approaches have a substantial impact on the precision of the model when approximating an output function, the choice of clustering approaches must be made carefully [54]. In addition to its speed-boosting capability, the FCM offers the advantage that it does not restrict cluster boundaries, which allows objects to belong to more than one group rather than to a single group exclusively [55]. The expression in equation (8) is utilized to minimize the distance center to each datum for each fuzzy group n and vector xi, i = 1, 2, … n(8)E=∑i=1N∑k=0nUijmxi−cj2,where Uijm is the degree of membership, Uijm∊ (0, 1), m is the weighting exponent which is any number concerning 1≤m≤∞, xi is the data points, cj is the centroid of clusters, and C is the number of clusters. Equation (9) indicates the Uij of the data point in the j cluster at any iteration.(9)Uij=∑k=1Cxi−cjxi−cj2/m−1−1.


#### 2.3.2. Particle Swarm Optimization (PSO)

Adapting from the social characteristics of fish schooling and bird flocking, the particle PSO is one of the most popular bio-inspired and population-driven evolutionary algorithms. PSOs are unique in that they do not require gradients or differential forms of the objective function; they simply need the objective function along with a few hyperparameters. PSO is known for its simplicity, stability, and superior computing abilities, particularly when it is applied to nonlinear, large dimensional, and multioptimal problems [56]. The initial step of the PSO consists of a collection of arbitrary coordinates of particles having random positions and velocities. The subsequent sets of coordinates are updated using PSO to determine the global optimal position or configuration. After keeping the local best configuration (pbest) in a little memory variable, an exploration strategy is used to find the global best configuration (gbest) within the set of the pbest. Consequently, the finest possible outcome which is the best optimal solution is realized. The following equations can be used to compute each particle’s new velocity and position:(10)vit+1=wvit+c1r1pbest−xit+c2r2gbest−xit,(11)xit+1=xit+vit+1,where r1 and r2 signify the random numbers in the interval [0, 1]; c1 and c2 are the cognitive and social constants, respectively. The term w is referred to as the weighting function.


#### 2.3.3. Modified Particle Swarm Optimization

Inertia weight is one of the key variables for determining the convergence and the equilibrium of the exploration-exploitation phase of the PSO algorithm. The conventional PSO algorithm has a fixed inertia weight factor. Findings have shown that due to the fixed inertia weights and learning factors of the conventional PSO algorithm, it is susceptible to hasty convergence and thereby deteriorating into local optima. Consequently, Shi and Eberhart [57] developed a unique enhancement of the previous PSO algorithm by incorporating an inertia weight to attain a proper balance between local and global search. The inertia weight measures the change in the particle velocity from the preceding iteration. As a result, a particle with superior performance has more capturing ability than others and it is easier to achieve the global optimum. Setting the appropriate inertia weight value is essential. With a large inertia weight, the convergence process slows down, and with a small value, it is quick to reach a local solution. The global exploration and local exploitation phases of the search process may be enhanced by the dynamic modification of the inertia weight during iteration. Shi and Eberhart developed the linear decreasing inertia weight particle swarm optimization (LDIWPSO) [58]. The inertia weight w decreases linearly over the iteration. The mathematical expression is represented in the following equation [59]:(12)w=wstart−wendTmax−tTmax+wend,where the initial and final values of the inertia weight are denoted as wstart and wend in sequence; Tmax is the maximum iteration number. An exponential component is incorporated into the standard LDIWPSO to mitigate the problem of premature convergence and improve the exploration-exploitation phase. The exponential component is added to enhance the position-updating equation of the PSO algorithm. The proposed modified LDIWPSO version is presented in the following equation:(13)w=wstart−wendTmax−tTmax+wend×e−t/Tmax/42,where wstart and wend are given as 0.6 and 0.1, respectively. The modified LDIWPSO can be considered an extended version of LDIW which incorporates the natural (base e) inertia weight strategy [60].


## 2.1. Case Study

Gauteng is South Africa’s smallest province (Figure1), with a total land area of around 18,170 km2, accounting for about 2% of the country’s total land area. Nevertheless, with a population of 15.5 million, Gauteng has the highest population density in SA and makes up 26.0% of the national population [50]. Geographically, Johannesburg is in Gauteng Province, near the tropics at latitude 26°120′ 08″ S, and longitude 28°02′ 37″E, with an elevation of about 1767 m and a surface of 1645 km2. Johannesburg is SA’s largest city and the country’s main industrial and financial metropolis. It is designated as a megacity [50]. Summers in Johannesburg are wet and slightly gloomy, while winters are relatively sunny, dry, and clear, but still cool. As well as summer, autumn, and spring are also important seasons in Johannesburg. Johannesburg typically has a maximum temperature of approximately 21°C in January and a minimum temperature of about 10°C in July [51]. Seasonal changes, especially with the levels of temperature and humidity, have a significant influence on people’s lifestyles and inevitably on energy consumption. Historically, summers have lasted longer than winters. Figure 1 shows the geospatial mapping information of SA, Gauteng Province, Johannesburg, and the University of Johannesburg, respectively. The student residence at the University of Johannesburg, SA is used in this study as a case study.Figure 1
Map showing the geographic location of the study area.


## 2.2. Data Collection

This paper examines several hybrids of ANFIS-based models for estimating the power usage of student residences at the University of Johannesburg in SA. The seasonal weather information used captured all the different seasons in line with the location of the study area. With respect to the campus’s geographic location, the climatic data (wind speed, temperature, and humidity) were gathered from the nearby weather stations of the South African weather service (SAWS). Furthermore, the hourly energy consumption of the student residence which covers the four major SA seasons, namely, autumn (1 March–31 May), winter (1 June–31 August), spring (1 September–30 November), and summer (1 December–28/29 February) were obtained for the year 2017. The energy consumption data for the student residents were obtained from the study of Masebinu et al. [52]. Located on campus, the student residence has 17 rooms (including a kitchen and a washing area) and 4 toilets and bathrooms. The data comprise real-time power consumption and are a time-series dataset acquired from real-time energy monitoring equipment from the student residence’s distribution panel [52]. Figure 2 shows the architectural design of the model under study.Figure 2
Architectural design of the hybrid model.


## 2.3. ANFIS Model

The adaptive neuro-fuzzy inference system (ANFIS) was presented by Jang [25] in 1993. It is a unique hybrid model which employs the pair features of neural networks and fuzzy logic in its design. The basic ANFIS model uses five layers and fuzzy IF-THEN rules to produce a nonlinear map between input and output, as illustrated in Figure 3. In the first layer, two inputs are received, x and y, and each node’s output is determined by the generalized Gaussian membership function (μ). These steps are depicted in the following equations (1)–(3)[25]:(1)O1i=μAix,i=1,2,(2)O1i=μBi−2y,i=3,4,(3)μx=e−x−ρi/αi2,where membership values of μ are designated as Ai and Bi; the premise parameter sets are ρi and αi.Figure 3
ANFIS model architecture.The output of each node in the second layer (the firing strength of a rule) is calculated in the next phase of ANFIS using the following equation:(4)O2i=μAix×μBi−2y.The output of the third layer node is described in equation (8), which is also known as the normalized firing strength:(5)O3i=wi¯=ωi∑i=12ωi,.The output is computed by the adaptive nodes at Layer 4 using the following equation:(6)O4,i=wi¯fi=wi¯pix+qiy+ri,where pi, qi , and ri are the consequent parameters of the node i. The ANFIS model’s final layer contains just one node, and its output is calculated as follows:(7)O5=∑iwi¯fi.Findings have shown that the application of ANFIS is met with sluggishness in the convergence of training leading to being easily stuck in local optima owing to the widened search space [53]. To overcome such a problem, employing a hybrid method is crucial.


### 2.3.1. Fuzzy c-Means Clustering

Clustering plays a significant role in creating a FIS structure and grouping data points into membership functions (MFs) based on related fuzzy clusters. This is accomplished using popular clustering techniques, such as FCM, subtractive clustering (SC), and GP. Due to the fact that clustering approaches have a substantial impact on the precision of the model when approximating an output function, the choice of clustering approaches must be made carefully [54]. In addition to its speed-boosting capability, the FCM offers the advantage that it does not restrict cluster boundaries, which allows objects to belong to more than one group rather than to a single group exclusively [55]. The expression in equation (8) is utilized to minimize the distance center to each datum for each fuzzy group n and vector xi, i = 1, 2, … n(8)E=∑i=1N∑k=0nUijmxi−cj2,where Uijm is the degree of membership, Uijm∊ (0, 1), m is the weighting exponent which is any number concerning 1≤m≤∞, xi is the data points, cj is the centroid of clusters, and C is the number of clusters. Equation (9) indicates the Uij of the data point in the j cluster at any iteration.(9)Uij=∑k=1Cxi−cjxi−cj2/m−1−1.


### 2.3.2. Particle Swarm Optimization (PSO)

Adapting from the social characteristics of fish schooling and bird flocking, the particle PSO is one of the most popular bio-inspired and population-driven evolutionary algorithms. PSOs are unique in that they do not require gradients or differential forms of the objective function; they simply need the objective function along with a few hyperparameters. PSO is known for its simplicity, stability, and superior computing abilities, particularly when it is applied to nonlinear, large dimensional, and multioptimal problems [56]. The initial step of the PSO consists of a collection of arbitrary coordinates of particles having random positions and velocities. The subsequent sets of coordinates are updated using PSO to determine the global optimal position or configuration. After keeping the local best configuration (pbest) in a little memory variable, an exploration strategy is used to find the global best configuration (gbest) within the set of the pbest. Consequently, the finest possible outcome which is the best optimal solution is realized. The following equations can be used to compute each particle’s new velocity and position:(10)vit+1=wvit+c1r1pbest−xit+c2r2gbest−xit,(11)xit+1=xit+vit+1,where r1 and r2 signify the random numbers in the interval [0, 1]; c1 and c2 are the cognitive and social constants, respectively. The term w is referred to as the weighting function.


### 2.3.3. Modified Particle Swarm Optimization

Inertia weight is one of the key variables for determining the convergence and the equilibrium of the exploration-exploitation phase of the PSO algorithm. The conventional PSO algorithm has a fixed inertia weight factor. Findings have shown that due to the fixed inertia weights and learning factors of the conventional PSO algorithm, it is susceptible to hasty convergence and thereby deteriorating into local optima. Consequently, Shi and Eberhart [57] developed a unique enhancement of the previous PSO algorithm by incorporating an inertia weight to attain a proper balance between local and global search. The inertia weight measures the change in the particle velocity from the preceding iteration. As a result, a particle with superior performance has more capturing ability than others and it is easier to achieve the global optimum. Setting the appropriate inertia weight value is essential. With a large inertia weight, the convergence process slows down, and with a small value, it is quick to reach a local solution. The global exploration and local exploitation phases of the search process may be enhanced by the dynamic modification of the inertia weight during iteration. Shi and Eberhart developed the linear decreasing inertia weight particle swarm optimization (LDIWPSO) [58]. The inertia weight w decreases linearly over the iteration. The mathematical expression is represented in the following equation [59]:(12)w=wstart−wendTmax−tTmax+wend,where the initial and final values of the inertia weight are denoted as wstart and wend in sequence; Tmax is the maximum iteration number. An exponential component is incorporated into the standard LDIWPSO to mitigate the problem of premature convergence and improve the exploration-exploitation phase. The exponential component is added to enhance the position-updating equation of the PSO algorithm. The proposed modified LDIWPSO version is presented in the following equation:(13)w=wstart−wendTmax−tTmax+wend×e−t/Tmax/42,where wstart and wend are given as 0.6 and 0.1, respectively. The modified LDIWPSO can be considered an extended version of LDIW which incorporates the natural (base e) inertia weight strategy [60].


## 2.3.1. Fuzzy c-Means Clustering

Clustering plays a significant role in creating a FIS structure and grouping data points into membership functions (MFs) based on related fuzzy clusters. This is accomplished using popular clustering techniques, such as FCM, subtractive clustering (SC), and GP. Due to the fact that clustering approaches have a substantial impact on the precision of the model when approximating an output function, the choice of clustering approaches must be made carefully [54]. In addition to its speed-boosting capability, the FCM offers the advantage that it does not restrict cluster boundaries, which allows objects to belong to more than one group rather than to a single group exclusively [55]. The expression in equation (8) is utilized to minimize the distance center to each datum for each fuzzy group n and vector xi, i = 1, 2, … n(8)E=∑i=1N∑k=0nUijmxi−cj2,where Uijm is the degree of membership, Uijm∊ (0, 1), m is the weighting exponent which is any number concerning 1≤m≤∞, xi is the data points, cj is the centroid of clusters, and C is the number of clusters. Equation (9) indicates the Uij of the data point in the j cluster at any iteration.(9)Uij=∑k=1Cxi−cjxi−cj2/m−1−1.


## 2.3.2. Particle Swarm Optimization (PSO)

Adapting from the social characteristics of fish schooling and bird flocking, the particle PSO is one of the most popular bio-inspired and population-driven evolutionary algorithms. PSOs are unique in that they do not require gradients or differential forms of the objective function; they simply need the objective function along with a few hyperparameters. PSO is known for its simplicity, stability, and superior computing abilities, particularly when it is applied to nonlinear, large dimensional, and multioptimal problems [56]. The initial step of the PSO consists of a collection of arbitrary coordinates of particles having random positions and velocities. The subsequent sets of coordinates are updated using PSO to determine the global optimal position or configuration. After keeping the local best configuration (pbest) in a little memory variable, an exploration strategy is used to find the global best configuration (gbest) within the set of the pbest. Consequently, the finest possible outcome which is the best optimal solution is realized. The following equations can be used to compute each particle’s new velocity and position:(10)vit+1=wvit+c1r1pbest−xit+c2r2gbest−xit,(11)xit+1=xit+vit+1,where r1 and r2 signify the random numbers in the interval [0, 1]; c1 and c2 are the cognitive and social constants, respectively. The term w is referred to as the weighting function.


## 2.3.3. Modified Particle Swarm Optimization

Inertia weight is one of the key variables for determining the convergence and the equilibrium of the exploration-exploitation phase of the PSO algorithm. The conventional PSO algorithm has a fixed inertia weight factor. Findings have shown that due to the fixed inertia weights and learning factors of the conventional PSO algorithm, it is susceptible to hasty convergence and thereby deteriorating into local optima. Consequently, Shi and Eberhart [57] developed a unique enhancement of the previous PSO algorithm by incorporating an inertia weight to attain a proper balance between local and global search. The inertia weight measures the change in the particle velocity from the preceding iteration. As a result, a particle with superior performance has more capturing ability than others and it is easier to achieve the global optimum. Setting the appropriate inertia weight value is essential. With a large inertia weight, the convergence process slows down, and with a small value, it is quick to reach a local solution. The global exploration and local exploitation phases of the search process may be enhanced by the dynamic modification of the inertia weight during iteration. Shi and Eberhart developed the linear decreasing inertia weight particle swarm optimization (LDIWPSO) [58]. The inertia weight w decreases linearly over the iteration. The mathematical expression is represented in the following equation [59]:(12)w=wstart−wendTmax−tTmax+wend,where the initial and final values of the inertia weight are denoted as wstart and wend in sequence; Tmax is the maximum iteration number. An exponential component is incorporated into the standard LDIWPSO to mitigate the problem of premature convergence and improve the exploration-exploitation phase. The exponential component is added to enhance the position-updating equation of the PSO algorithm. The proposed modified LDIWPSO version is presented in the following equation:(13)w=wstart−wendTmax−tTmax+wend×e−t/Tmax/42,where wstart and wend are given as 0.6 and 0.1, respectively. The modified LDIWPSO can be considered an extended version of LDIW which incorporates the natural (base e) inertia weight strategy [60].


## 3. MPSO-ANFIS Hybrid Model

This section presents a hybrid model combining the MPSO algorithm with ANFIS to forecast the energy consumption of students’university residences using time series data. An effective optimization method must strike a balance between local and global searches. This is achieved by introducing a modified linear decreasing inertia weight (equation (13)) into the PSO (equation (10)), thus enabling the search capability to be adjusted dynamically when the inertia weight changes. Consequently, the proposed MPSO can select the parameters of the ANFIS structure in the best manner for accurate prediction. The proposed MPSO-ANFIS consists of five layers comparable to the conventional ANFIS model (Figure 3). Nodes at Layer 1 represent input variables (wind speed, temperature, and humidity), while nodes at Layer 2 represent membership functions. Layer 3 represents the fuzzy logic rules. The output of layer 5 is energy consumption. During the learning phase, the MPSO is used to establish the ideal weight values between Layers 4 and 5.The proposed algorithm starts its operation by preparing the input variables (wind speed, temperature, and humidity). In this study, 70% of the data set was used for training the model while 30% was used for testing its accuracy and competency. The parameter settings for the ANFIS model are presented in Table1. The number of clusters is determined using the fuzzy c-mean (FCM). A fair comparison of hybrid models was conducted by applying the same FCM as the proposed MPSO-ANFIS. The next step is the formation of the ANFIS using the FCM. The MPSO was used to update the ANFIS parameters. The MPSO examines several areas of the search space that contain numerous local minima before narrowing the search scope to the region comprising the global solution. Parameters are updated according to the error information between the actual output and the predicted values during the training phase.Table 1
Model Parameters for ANFIS structure.
Model parameterValueNumber of clusters10Max. epoch100Max improvement1e − 5Err. goal0FIS structureSugeno-typeInitialstep0.001Number of exponents for matrix partitioning2The error between the actual power consumption and the predicted value is used as the fitness function. The MPSO initiates its operation by creating a population of solutions, after which each solution’s fitness function is calculated. The best solution is determined and utilized to update the other solutions. Once the optimal solution has been found, the updated procedure is carried out until the stop criteria are satisfied. The steps of the proposed model are described in Figure4.Figure 4
MPSO-ANFIS flowchart.


## 4. Results and Discussion

In this work, a total of eight hybrid models were developed. The algorithms used for developing the algorithms are GA [61], DE [44], FA [46], TLBO [62], BBO [48], IWO [47], and PSO [45]. The aforementioned algorithms have been widely used in literature and have proven to be effective in several applications. Each method was applied to optimize the ANFIS parameters, resulting in eight hybrid models along with the MPSO-ANFIS. The developed models were implemented under three performance measures to reveal the model’s correctness between the actual electricity usage and the predicted values. Generally, developed models are often evaluated by applying statistical metrics to determine their accuracy. The proposed approach is tested using three renowned performance measures: root mean square error (RMSE), mean absolute deviation (MAD), and coefficient of variation (RCoV). The model that has minimum RMSE, MAD, and RCoV values indicate better predictions. The descriptions of the performance metrics are as follows.Root mean square error:(14)RMSE=1Ns∑i=1Nsyk−y^k2.Mean absolute deviation:(15)MAD=1N∑k=1Nyk−y¯.Coefficient of variation (RCoV):(16)RCoV=mediany^k−y^k_mediany^k_median.For an unbiased evaluation, the same general parameter settings were utilized for the hybrid models. With a maximum of 100 iterations, the population size was set at 25. Upper and lower limits were −25 and 25, respectively. The model parameter for the ANFIS structure has been presented in Table1 while the parameter settings for the algorithms used for developing the hybrid models are presented in Table 2.Table 2
Parameters setup for the algorithms.
Hybrid modelsParameter settingGA [63]Pop = 25, max_it = 100,Pc = 0.4, Pm = 0.15,selection mechanism: roulette wheelIWOPop = 25, max_it = 100,Smin = 0, Smax = 5, σinitial = 0.5,σfinal = 0.001DEPop = 25, max_it = 100,Cr = 0.2, F = 0.8BBOPop = 25, max_it = 100, keep rate = 0.2, mutation probability = 0.1FAPop = 25, max_it = 100,βo = 2, α = 0.2, γ = 1, αd = 0.98PSO [63]Pop = 25, max_it = 100,c1=1, c2 = 2, ⍵damp = 0.99, ⍵ = 1MPSOPop = 25, max_it = 100,c1=1, c2 = 2, wstart = 0.6 wend = 0.1TLBOPop = 25, max_it = 100Figures5–12 provide a graphic comparison of the actual and predicted values during the testing phase of the hybrid models, as well as a chart of each sample’s error (i.e., the discrepancy between the actual and predicted values of the electricity consumption), and a histogram of the errors that shows the frequency of each error value. Figures 5(b)–12(b) show the MSE and RMSE values for the eight models compared in this study. Results showed that all designed models had successful outcomes. However, the performance of the proposed MPSO-ANFIS outscored other models under the RMSE performance metrics. According to Table 3, the proposed MPSO-ANFIS model had a lower RMSE value (1.8928 KWh), whereas the PSO-ANFIS (RMSE = 1.9227 KWh) model, which used the standard PSO, offered the second-best performance. The output of the model revealed the significance of the integration of the modified inertia weight into the standard PSO algorithm to adequately optimize the parameters of the ANFIS structure. Figures 5(a)–12(b) show the comparison plots of the models between the experimental and predicted electricity consumption.Figure 5
Plot of the FA-ANFIS model.
(a)(b)(c)Figure 6
Plot of TLBO-ANFIS model.
(a)(b)(c)Figure 7
Plot of IWO-ANFIS.
(a)(b)(c)Figure 8
Plot of GA-ANFIS model.
(a)(b)(c)Figure 9
Plot of the DE-ANFIS model.
(a)(b)(c)Figure 10
Plot of BBO-ANFIS model.
(a)(b)(c)Figure 11
Plot of PSO-ANFIS model.
(a)(b)(c)Figure 12
Plot of MPSO-ANFIS model.
(a)(b)(c)Table 3
Performance evaluation of the models using statistical performance evaluation metrics.
ModelRMSE (KWh)MAD (KWh)RCoVGA-ANFIS1.93271.54820.15294DE-ANFIS3.54862.66310.2830IWO-ANFIS2.75472.13340.1971BBO-ANFIS2.00251.59510.2070FA-ANFIS1.92611.54000.1404TLBO-ANFIS2.05601.58690.1825PSO-ANFIS1.92271.53680.1442MPSO-ANFIS1.89281.50510.1370A similar result was obtained for the MAD performance metrics. The MPSO-ANFIS delivered the minimum value of the RMSE (1.5051 KWh) compared with GA-ANFIS (MAD = 1.5482 KWh), DE-ANFIS (MAD = 2.6631 KWh), IWO-ANFIS (MAD = 2.1334 KWh), BBO-ANFIS (MAD = 1.5951 KWh), FA-ANFIS (MAD = 1.5400 KWh), TLBO-ANFIS (MAD = 1.5869 KWh), and PSO-ANFIS (MAD = 1.5368 KWh). The proposed MPSO-ANFIS maintained its optimal performance compared to other methods and indicated a more accurate model.In terms of the standard deviation (S.D), as shown in Figures5(c)–12(c), the proposed MPSO-ANFIS outshone other methods with the lowest value of the S.D (1.8916) compared with GA-ANFIS (S.D = 1.9324), DE-ANFIS (S.D = 3.3446), IWO-ANFIS (S.D = 2.7550), BBO-ANFIS (S.D = 2.0023), FA-ANFIS (S.D = 1.9265), TLBO-ANFIS (S.D = 1.9947), and PSO-ANFIS (S.D = 1.9225).Under the RCoV, the proposed MPSO-ANFIS demonstrated the best performance by having the minimum value which further demonstrated the robustness of the MPSO-ANFIS model to accurately predict the electricity consumption of the student residents. Figure13 shows the overall performance of the eight models under the three performance metrics. It may be seen that the proposed MPSO-ANFIS performed better than other models in the electricity consumption prediction, while the PSO-ANFIS model delivered the second-best. The optimal performance of the MPSO-ANFIS is attributable to improvement in the standard PSO by modifying the inertia weight strategy as discussed in Section 2.Figure 13
Comparison of different statistical indices for the hybrid models.The computational time for the PSO-ANFIS is 2769.3023 sec while that of MPSO-ANFIS is 3051.4317 sec. This depicts about a 10% increase in computational time with the modified algorithm. This thus implies that there is a tradeoff between computational complexity and the performance of the developed algorithm.


## 5. Conclusion

This study examined different ANFIS-based hybrid models for predicting the electricity consumption of a student residence, using the University of Johannesburg, South Africa, as a case study. In this study, 70% of the data set was used for training the model, while 30% was used for testing its accuracy and competency. Using the FCM clustering method, three key meteorological variables (windspeed, humidity, and temperature) were used as the input, and electricity consumption was the output. An enhanced PSO method consisting of a modified linear decreasing inertia weight was developed to improve the ANFIS parameters. A comparative study was carried out between the proposed MPSO-ANFIS and other hybrid models comprising the standard PSO-ANFIS, GA-ANFIS DE-ANFIS, IWO-ANFIS, BBO-ANFIS, FA-ANFIS, and TLBO-ANFIS. The fitness of the developed hybrid model and its variability between predicted and observed values are assessed using three well-known statistical metrics, namely RMSE, MAD, and RCoV.The overall results obtained showed that the best performance was delivered by the proposed MPSO-ANFIS, which had the lowest RMSE (1.8928 KWh), MAD (1.5051 KWh), and RCoV (0.1370) values. This study demonstrated that combining the improved PSO algorithm with the ANFIS model was capable of accurately predicting the electricity consumption of student residences at the University of Johannesburg. Due to its successful performance, it can be concluded that MPSO-ANFIS provides a higher prediction accuracy, which is critical for strategic energy planning. In addition, the proposed model may be employed for forecasting in related applications.The present study considered an MTF based on the data obtained. However, future studies may consider increasing the experimental data and input variables for a more robust model. Although the number of datasets used in this work is not much less than those of other researchers, working with more data would produce more precise results. Furthermore, the present study utilized only the FCM clustering technique; however, other clustering approaches may be used in the future to investigate the impacts of clustering of techniques on the proposed model.



---

*Source: 8508800-2023-03-18.xml*