Energy Efficiency in Smart Buildings through Prediction modeling and Optimization Using a Modified Whale Optimization Algorithm
Energy Efficiency in Smart Buildings through Prediction modeling and Optimization Using a Modified Whale Optimization Algorithm
1051/itmconf/20246901009
MAIH2024
Nasima EL ASSRI1*, Mohammed ENNEJJAR1, Mohammed Ali JALLAL1, 3, Samira CHABAA1,2, Abdelouhab
ZEROUAL1
1I2SP Research Team, Physics department, Faculty of Sciences Semlalia, Cadi Ayyad University, Marrakesh, Morocco
2
Industrial Engineering Department, National School of Applied Sciences, Ibn Zohr University, Agadir, Morocco
3Univ. Grenoble Alpes, CEA, Liten, Campus Ines, 73375, Le Bourget du Lac, France
Abstract. This paper presents a comparative study on the prediction of energy consumption in buildings
using machine learning techniques. The dataset encompasses a diverse range of buildings with 8 input
features and one output variable, representing the energy consumption. The primary focus is on evaluating
the performance of two prominent and widely-used machine learning algorithms: Artificial Neural Networks
(ANN) and Random Forest (RF). The results indicate a promising predictive capacity of both models,
showcasing their effectiveness in capturing intricate patterns within the dataset. In the case of ANN, the
Root Mean Squared Error (RMSE) is reported at 3.806, demonstrating the model's ability to approximate
the true energy consumption values. Furthermore, the Random Forest model exhibits enhanced predictive
accuracy, as reflected by a lower RMSE of 1.392. In addition to predictive analysis, this study utilizes a
Modified Whale Optimization Algorithm (MWOA) to optimize energy consumption. The MWOA helps to
identify the associated input values that lead to the lowest possible energy consumption, providing valuable
insights for energy-efficient building design. The implications of this research extend to the broader field of
sustainable architecture and urban planning, paving the way for more informed decisions aimed at reducing
energy consumption and fostering environmental sustainability.
2 Methodology
ANNs stand as dynamic computational structures Where, N represents the number of trees in the
inspired by the human brain's neural networks[10]. forest, and 𝑓𝑓𝑖𝑖 (𝑋𝑋) denotes the prediction of the ith
These models comprise layers with interconnected decision tree based on the input features X.
nodes, or neurons, which collectively process and learn The versatility and efficiency of Random Forest lie
complex patterns from input data[11]. In the context of in its ability to handle complex, high-dimensional
building energy consumption prediction, we harness the datasets, making it well-suited for modeling the
formidable capabilities of ANN to decipher intricate multifaceted relationships inherent in building energy
relationships among various building parameters. The consumption.
ANN is particularly adept at capturing nonlinear
dependencies between inputs, making it well-suited for 2.4 Modified Whale Optimization Algorithm
the multifaceted nature of building energy systems. The (MWOA)
predictive power of the network is expressed
mathematically through the following equation [12], The Modified Whale Optimization Algorithm (MWOA)
where 𝐵𝐵𝐵𝐵𝐵𝐵𝑖𝑖 represents the output of the ith neuron: is a nature-inspired optimization technique that
enhances the original Whale Optimization Algorithm
𝐵𝐵𝐵𝐵𝐵𝐵𝑖𝑖 = 𝑓𝑓(∑𝑛𝑛𝑗𝑗=1 𝑤𝑤𝑖𝑖𝑖𝑖 ∗ 𝑥𝑥𝑗𝑗 + 𝑏𝑏𝑖𝑖 ) (1) (WOA) by improving its exploration and exploitation
capabilities[15], [16]. MWOA mimics the hunting
Where, 𝑤𝑤𝑖𝑖𝑖𝑖 denotes the weight between the ith neuron behavior of humpback whales and operates as follows
and the jth input, 𝑥𝑥𝑗𝑗 is the jth input, 𝑏𝑏𝑖𝑖 is the bias term, [17]:
and 𝑓𝑓 is the activation function. Figure 1 illustrates the
configuration of a multi-layered feedforward 1. Initialization: A population of candidate
backpropagation network employed in this study. solutions 𝑋𝑋𝑖𝑖 (where i=1,2,…,N) is randomly
2
ITM Web of Conferences 69, 01009 (2024) https://doi.org/10.1051/itmconf/20246901009
MAIH2024
∑𝑛𝑛
initialized within the search space, where N is 𝑅𝑅2 = 1 − 𝑖𝑖=1(𝐵𝐵𝐵𝐵𝐵𝐵𝑖𝑖,𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 −𝐵𝐵𝐵𝐵𝐵𝐵𝑖𝑖,𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 )
(9)
∑𝑛𝑛 ̅̅̅̅̅̅
𝑖𝑖=1(𝐵𝐵𝐵𝐵𝐵𝐵𝑖𝑖,𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 − 𝐵𝐵𝐵𝐵𝐵𝐵 )
the number of solutions.
2. Fitness Evaluation: Each solution's
Where,
performance is assessed using a fitness
𝑛𝑛 is the number of observations;
function 𝑓𝑓(𝑋𝑋𝑖𝑖 )aimed at minimizing energy
𝐵𝐵𝐵𝐵𝐵𝐵𝑖𝑖,𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 is the actual (observed) value for the ith
consumption, represented as f(X) → min. observation;
3. Encircling Prey: Candidate solutions update 𝐵𝐵𝐵𝐵𝐵𝐵𝑖𝑖,𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 is the predicted value for the ith
their positions based on the best-performing observation;
solution 𝑋𝑋𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 using the following equation: ̅̅̅̅̅̅ is the mean of the observed values
𝐵𝐵𝐵𝐵𝐵𝐵
𝑋𝑋𝑖𝑖𝑛𝑛𝑛𝑛𝑛𝑛 = 𝑋𝑋𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 − 𝐴𝐴 . |𝐶𝐶. 𝑋𝑋𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 − 𝑋𝑋𝑖𝑖 | (3) The application of these metrics enables researchers
and practitioners to gauge the effectiveness of building
where A and C are the coefficients that control the energy consumption prediction models and make
exploration behavior. informed decisions about model selection and
refinement.
4. Exploration: MWOA enhances exploration by In order to enhance the accuracy, the data were
introducing random jumps around the best normalized to a standardized range between 0 and 1.
solution, defined as:
3 Results & discussion
𝑋𝑋𝑖𝑖𝑛𝑛𝑛𝑛𝑛𝑛 = 𝑋𝑋𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 + 𝐴𝐴 . |𝑅𝑅. rand. D | (4)
where R is a random factor, rand is a random number in 3.1 Comparative prediction using RF and ANN
[0,1], and D is the distance from the current position to In this study, a comprehensive examination involves
𝑋𝑋𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 . eight input variables, specifically Building Size (x1),
Floor Height (x2), Glazing Area (x3), Wall Area (x4),
5. Exploitation: The algorithm balances global window-to-wall ratio (WWR) (x5), Window Glazing U-
and local searches to refine solutions value (x6), Roof U-value (x7), and External Wall U-
effectively by adjusting the coefficients A and value (x8). The performance evaluation encompasses
C over iterations. the consideration of all or various combinations of these
6. Termination: The process continues until a input variables. Table 1 presents the following results of
stopping criterion, such as a maximum number the RMSE, CV, MAPE, MAD and R2 for artificial
of iterations, is met. neural networks at 1000 epochs, providing insights into
how the exclusion or inclusion of specific input
By effectively identifying optimal input values for variables influences the predictive performance of the
minimizing energy consumption, MWOA is used to ANN model. The configuration of ANNs is: number of
enhance energy efficiency in buildings through its input variables: 10 (neurons in the hidden layer): 1
mathematical modeling of whale behaviors. (neuron in the output layer).
3
ITM Web of Conferences 69, 01009 (2024) https://doi.org/10.1051/itmconf/20246901009
MAIH2024
(a) (b)
Fig. 2. Results from ANN models developed (a) with all variables as inputs and (b) without Glazing Area (x3) value.
Figure 3 and Table 2 present a thorough evaluation MAD (12.747), and a lower R² (0.505). Conversely, a
of Random Forest models with varying maximum forest with a maximum depth of 15 demonstrates better
depths (Max depth). The obtained results in Table 2 performance, featuring lower values of RMSE (1.392),
demonstrate that deeper trees in the forest lead to CV (2.523%), MAPE (1.356%), MAD (0.571), and a
improved performance. Specifically, a maximum depth higher R² (0.996).
of 1 results in relatively higher errors, characterized by
larger values in RMSE, CV, MAPE, MAD, and a lower Table 2. Random forest models with different max depth
R². As the maximum depth increases, there is a notable (MD) parameter.
enhancement in model performance, with lower errors
and a higher R². However, the results indicate that the RF RMSE CV MAPE MAD R²
models
forest's performance starts to deteriorate beyond a MD =1 15.589 28.256 30.893 12.747 0.505
maximum depth of 15. This suggests that increasing the MD = 5 4.239 7.683 7.703 3.338 0.963
maximum depth beyond a certain point may not MD = 10 1.537 2.786 1.838 0.782 0.995
significantly enhance model performance for the given MD =15 1.392 2.523 1.356 0.571 0.996
dataset. Table 2 further illustrates these findings by MD = 30 1.407 2.551 1.358 0.573 0.9959
showcasing the performance of forests with maximum MD =50 1.407 2.551 1.358 0.573 0.9959
depths. A forest with a maximum depth of 1 results in MD =100 1.407 2.551 1.358 0.573 0.9959
an under-fit model, characterized by higher values of
RMSE (15.589), CV (28.256%), MAPE (30.893%),
(a) (b)
Fig. 3. RF models with different maximum depths: (a) MD = 15, (b) MD = 1.
From table 3, the comparison between ANN and RF The choice between these two algorithms often
reveals that RF consistently outperforms ANN in depends on the nature of the problem, data availability,
predicting energy consumption, both in full and reduced and desired performance. RF is commonly favored for
models. RF achieves a lower RMSE (1.407 for the full its robustness to noisy data, ease of tuning, and ability
model and 2.363 for the reduced model) compared to to handle nonlinear relationships. On the other hand,
ANN (4.308 and 4.049, respectively), and it also shows ANN is highly powerful for modeling complex
better performance across CV, MAPE, MAD, and R². relationships but typically requires more data and
While ANN experiences a slight improvement in expertise for proper configuration and optimization.
accuracy when using important variables, RF sees a
decrease in performance with reduced variables. Despite
3.2 Optimization using a Modified Whale
this, RF remains more accurate and robust than ANN in
Optimization Algorithm (MWOA)
all metrics, making it the superior choice for this dataset.
Optimizing design and operational parameters is
Table 3. Prediction errors comparison of full and reduced essential for improving energy efficiency in smart
models.
buildings. These buildings, equipped with advanced
Model RMSE CV MAPE MAD R²
management systems, require the efficient use of
ANN all 4.308 7.808 6.888 3.336 0.962 resources to minimize energy consumption while
ANN 4.049 7.340 6.882 2.969 0.966 maintaining optimal indoor comfort. By adjusting
important factors such as building size, glazing area, or U-values
variables of walls and windows, energy losses can be reduced
RF all 1.407 2.551 1.358 0.573 0.9959 while adhering to architectural constraints.
RF 2.363 4.283 2.666 1.133 0.9886 Optimization becomes even more crucial in the
important context of increasing regulations regarding building
variables energy performance, aiming to reduce carbon footprints
while improving energy efficiency.
In the field of energy consumption prediction for The goal of this optimization process is to minimize
buildings, several studies have highlighted the the total energy consumption while adhering to the
effectiveness of AI and machine learning models. A constraints related to the building design parameters,
previous study compared the performance of an such as building size, floor height, glazing area, and the
Artificial Neural Network (ANN) with the Random thermal performance of windows, roofs, and walls.
Forest (RF) algorithm for predicting HVAC energy The Modified Whale Optimization Algorithm
consumption in a hotel in Madrid, Spain[20]. The study (MWOA) was chosen for this study due to its ability to
concluded that the ANN slightly outperformed RF, with find optimal solutions in complex, multidimensional
a lower RMSE (4.97 for ANN versus 6.10 for RF). search spaces. This algorithm, inspired by the hunting
However, it also emphasized the ease of use and behavior of humpback whales, effectively balances
parameter tuning of the RF model, especially when exploration (global search across the solution space) and
dealing with complex categorical variables and exploitation (local search around promising solutions).
multidimensional data, which are common in buildings. It is particularly well-suited for optimization problems
In our study, we observed similar results, with both with nonlinear relationships between variables, as seen
ANN and RF demonstrating comparable predictive in building energy efficiency models. The parameters
abilities. However, in contrast to the Madrid hotel study, used for the MWOA are summarized in Table 4 below.
our findings show that the RF model outperformed the
ANN in terms of accuracy, with a lower RMSE (1.392 Table 4. Parameters used for the modified whale
compared to 3.806 for ANN). This difference could be optimization algorithm (MWOA).
attributed to the nature of the dataset used in our study,
which might align better with RF’s ability to capture Parameter Description Va
nonlinear and noisy relationships between the input lue
features and energy consumption. Population size Number of candidate solutions 20
(represented as whales)
5
ITM Web of Conferences 69, 01009 (2024) https://doi.org/10.1051/itmconf/20246901009
MAIH2024
6
ITM Web of Conferences 69, 01009 (2024) https://doi.org/10.1051/itmconf/20246901009
MAIH2024