Energy Consumption Optimization and User Comfort Maximization in Smart Buildings Using a Hybrid of the Fireﬂy and Genetic Algorithms

: This research work proposed a hybrid model to maximize energy consumption and maximize user comfort in residential buildings. The proposed model consists of two widely used optimization algorithms named the ﬁreﬂy algorithm (FA) and genetic algorithm (GA). The hybridization of two optimization approaches results in a better optimization process, leading to better performance of the process in terms of minimum power consumption and maximum occupant’s comfort. The inputs of the optimization model are illumination, temperature, and air quality from the user, in addition with the external environment. The outputs of the proposed model are the optimized values of illumination, temperature, and air quality, which are, in turn, used in computing the values of user comfort. After the computation of the comfort index, these values enter the fuzzy controllers, which are used to adjust the cooling / heating system, illumination system, and ventilation system according to the occupant’s requirement. A user-friendly environment for power consumption minimization and user comfort maximization using data from di ﬀ erent sensors, user, processes, power control systems, and various actuators is proposed in this work. The results obtained from the hybrid model have been compared with many state-of-the-art optimization algorithms. The ﬁnal results revealed that the proposed approach performed better as compared to the standard optimization techniques. writing–original F.W. and M.F.; writing–review M.F., A.A., M.A., visualization, F.W.; supervision, M.M. authors


Introduction
One of the most prominent applications of technological integration with AI techniques is the conception of smart or energy-efficient buildings. The major motivational factor behind this integration is an efficient energy management system and user satisfaction inside building in terms of a minimum energy consumption and maximum user comfort index. Therefore, a trade-off is required between the indoor environmental quality (IEQ) and energy consumption in residential buildings [1][2][3]. For this purpose, an energy consumption management system is required inside the residential building that can maximize the comfort level of the occupant and minimize the power consumption. For maintaining the quality of occupants' lives inside the building, three basic parameters: namely, indoor thermal quality (ITQ), indoor air quality (IAQ), and door visual quality (IVQ) are needed by the occupants residing in the buildings [4]. For maintaining the IVQ, the residential building uses the illumination (the lighting system) to facilitate its occupants [5]. The ITQ is represented by the temperature level of the building. In order to preserve the temperature inside the building in the occupants' comfort zone, the residential buildings maintain a cooling/heating system. For maintaining the IAQ of the building in the occupants' comfort zone, the system measures the CO 2 concentration. The ventilation system keeps the CO 2 concentration as low as possible to keep the occupants in their comfort zone inside the building [6]. These three parameters (temperature, illumination, and air quality) are considered to maintain the comfort level inside the building according to the users' demands. Three parameters in our work to maintain the IEQ of the building depending on the users' demands have been considered. The methodology adopted in this work followed the standard proposed by the authors in [1][2][3][7][8][9]. The authors in all of the above research works have used the air temperature as the input of the temperature parameter, because air temperature measurements are adequately easy in implementation. For reading the air temperature, the temperature sensor only reads the values, and no further computation is required.
In order to achieve an occupant's preferred IEQ, many international standards have been followed for the last few decades. All these standards keep different parameters under consideration with their preferences. In this connection, the authors in [10] considered different variables for maintaining a user-preferred ITQ. Similarly, some other parameters have also been considered when deciding the internal environment of the energy-efficient building. For example, four parameters-namely, air quality, lighting, thermal comfort, and acoustics-were used by the authors in [11] to define the internal environment of a residential building. In addition to previously considered parameters, the ventilation system was also taken into consideration in the newly developed standard. In order to define the ITQ of a building, the authors in [12] outlined four values affecting the temperature-namely, air temperature, mean radiant temperature, air velocity, and humidity values, which will create the ITQ. The authors are also of the opinion that there are many other parameters that can be useful for defining the ITQ, but covering all of them for maintaining a standardized thermal requirement is one of the sophisticated tasks during building energy management. The internationally accepted standard for developing an IEQ is the ANSI/ASHRAE guidelines 10P, which recommend a few parameters when working with design, development, and operations of energy-efficient buildings [13]. In this standard, the ITQ, IAQ, aural, and IVQ are separately addressed. Similarly, there are some other factors affecting the ITQ that have been recommended by ANSI/ASHRAE Standard 55 [14]. The ITQ is affected by the weather variation, shading strategy, and an appropriate ventilation system. In the ISO standard 7730, different factors are identified and recommended for maintaining thermal comfort [15]. For PMV calculation, a methodology was proposed by the authors in [16] that is adequately supportive to consider different parameters when an energy management system is developed.
The firefly algorithm (FA) is a widely used metaheuristic, nature-inspired swarm intelligence technique formulated by Xin-She Yang in 2008 [17]. The significant wellspring of motivation prompting the advancement of the FA is the wonder of light emanation by fireflies. The light emitted by fireflies is used for the attraction of fireflies for their potential mate. The FA is considered to be one of the most robust, easily implementable, and simple optimization approaches, making it widely applicable for solving various types of complicated optimization problems. When the FA is used for solving optimization problems, it works in three main operational stages-namely, initial population generation stage, the position changing stage of fireflies, and the termination stage. In the starting phase, the initial population is randomly generated and evaluated for getting the most optimal solution for the given problem. At the firefly position changing stage, this population is updated using a factor known as the randomization factor. The termination stage is used for ending the operational procedure of the FA.
Two phenomena-namely, exploration and exploitation-are used for defining a well-established solution search space suitable for obtaining the optimal solution of the problem. The process of Energies 2020, 13, 4363 3 of 26 exploration is considered for determining new solutions, thus expending the solution search space to cover more solutions, whereas exploitation is used for focusing on the nearby locations close to the solution found so far. In order to enable the solution search space of the standard FA as an efficient one, there must be a balanced relationship between the exploration and exploitation of the solution search space, i.e., the solution search space should be neither too explorative nor too exploitative. If the exploration and exploitation have an imbalanced relationship, the algorithm will finally fail to get the best optimal solution of the problem. In this scenario, some further processing is required to achieve the desired goal. In the proposed approach, the properties of the genetic algorithm (GA) have been considered to carry out the further optimization process to get the required result. The GA possesses rich operators called selection, mutation, and crossover operators for balancing the exploration and exploitation of the solution search space [18].
In this paper, a hybrid firefly algorithm based on the GA algorithm has been proposed for the performance of a conventional firefly algorithm. In the proposed model, the FA is run for a fixed number of iterations to obtain the optimal solution of the energy optimization problem. It is observed that the solution quality is not improved after running the standard FA for a limited number of iterations, and the solution obtained is not the most optimal solution. In order to further improve the optimization process, the GA is embedded after the termination stage of the standard FA. A significant amount of improvement has been observed in the solution quality by introducing the GA after running the FA for a few iterations.
The organization of the structure of the remaining paper is carried out as below. Section 2 gives a detailed view of the literature study and related work, and Section 3 presents the proposed work, while Section 4 consists of the implementation and experimental results, with a detailed discussion. In Section 5, the paper is concluded. The abbreviations with their corresponding descriptions are itemized in Table 1.

Literature Review
Previously, several research studies have been conducted. Various types of energy consumption resources, their consumption, and different parameters worth consideration for the occupants have been explored by researchers. For example, the authors in [19] introduced an equation-based system for energy efficiency management, intelligent buildings modeling, simulation, and power consumption optimization in smart buildings. These equation-based systems are used for declaring the relationship among various variables that play roles in any form in energy-efficient buildings. These systems make use of computational algebra for enabling simpler architecture of the buildings for generating efficient and effective codes in order to perform simulations and the process of optimization. The authors applied the idea to different microgrids, a few buildings, some controllers used for controlling the temperature of the buildings, interactive inverters for maintaining the power quality, and HVAC systems. The systems were found to be efficient in obtaining the desired goals. Similarly, a multiagent control system based on information fusion has been proposed by the authors in [20]. In order to control and manage the energy inside the buildings, they used to order weighted aggregated averaging aggregation. The proposed approach maximizes user comfort and minimizes power consumption. There are many internal and external factors influencing user comfort inside the buildings. All these factors have some strong relationship to affect the occupants of the building. A model was proposed by the authors in [21] for understanding this relationship to keep them under consideration when developing some energy and user comfort-related approach for residential buildings. Both the indoor and outdoor environmental factors have been considered by the authors in [22] for managing the user comfort and power usage management system. For efficient energy management systems, different types of classification, prediction, and optimization models and techniques have been presented in the literature. The authors in [23] developed an energy management system for providing the user comfort in the buildings connected to microgrids. The model was developed for balancing the consumption and production of the energy by different power-generating resources. The developed system takes into account the amount of energy generated by various power-generating sources, providing it to the buildings and, at the same time, maintaining user' comfort, according to the requirements. Similarly, an efficient algorithm was proposed by the authors in [24] for management of the demand response and thermal comfort optimization in an environment facilitated with renewable power sources and storage devices. The authors targeted two major issues present in the literature, focusing on energy consumption and occupant satisfaction. The first issue resolved by the authors was the integration of power generation and consumption with the user behavior and guaranteeing the user thermal comfort. The second issue targeted was to develop a robust and scalable demand response system. A multi-objective simulation-based multi-objective optimization problem was solved by the authors in [25] by proposing a model based on the particles swarm optimization algorithm. For enhancing the performance of a building energy management system, the authors applied a single-objective and multi-objective particle swarm optimization (PSO) and coupled it with EnergyPlus simulation software. In order to evaluate the performance, effectiveness, and capability of the proposed model, it was applied to single-room architecture in which various types of building management parameters were considered that can affect the energy consumption, and four major climate areas in Iran were selected for testing. In the optimization process of the approach, multi-criterion and single criterion optimization analyses of yearly based cooling/heating systems and lighting system power consumptions are tested for understanding the relationship between the annual energy consumption minimization and the objective function. In the same manner, a simulation-based system, in combination with the genetic algorithm, was used by [26] for a multi-objective optimization process in which the benefit of power consumption was maximized and the thermal discomfort was minimized. In a similar attempt, the genetic algorithm was applied by the authors in [27] for a multi-objective optimization problem in which the energy consumption was minimized and the user thermal comfort was maximized. In order to improve the prediction power of the neural network, the authors also applied the GA, and then, the thermal comfort and the energy consumption were predicted. Lastly, the authors Energies 2020, 13, 4363 5 of 26 established a multi-objective building using the GA and neural network for the optimization process. Similarly, single-objective and multi-objective optimization models were developed by the authors in [28] using the nondominated sorting genetic algorithm. The inputs of the system were different environmental parameters, including weather data, lighting system, renewable energy management parameters, cooling/heating load, and the occupancy schedules. The output of the optimization process is the optimal energy system design and the user-preferred environment. In a similar fashion, the nondominated sorting genetic algorithm was used by the authors in [29] for minimizing the visual and thermal discomforts. Different types of building parameters were considered in the proposed work, e.g., the locations of the buildings, geometry of the buildings, volume of buildings, number of rooms, and types of rooms. An approach was developed by authors in [30], focusing on energy efficiency and the management of smart or energy-efficient buildings. All of the energy management systems were divided into four categories-namely, building space, lighting system, HVAC systems, and occupancy and comfort management systems. Similarly, the authors in [31] used deep reinforcement learning for the energy optimization in buildings. Different types of energy resources and consumption appliances were considered in the work.
Shimin Li et al. [32] proposed another stochastic optimization approach known as the slime mold algorithm (SMA) in light of the oscillation method of slime mold in natures. In that particular research work, they introduced few novel features, utilizing a remarkable numerical model dependent on adaptive weights so as to mimic the way toward creating positive and negative inputs of sludge form waves during spreading. The incitement has been controlled with the assistance of a bio-oscillator for producing the ideal way for associating food with a great exploratory capacity and exploitation affinity. They led broad, similar trials of proposed SMA with a few metaheuristic approaches utilizing a lot of benchmark functions to confirm its productivity. Furthermore, they utilized four smart building problems to approve the adequacy of the algorithm in severe optimizing problems. The conclusive outcomes introduced in various tables and figures demonstrated that the proposed SMA is a new enhancement procedure on various search landscapes. In [33], the authors presented another improved algorithm, named the equilibrium optimizer (EO). The EO is propelled by the control volume mass equalization models, which were utilized to evaluate both the dynamic and balanced states in material science. In their proposed EO approach, every particle is considered as a single solution, and its position is referred to the concentration of these particles while acting as a search agent. The positions are randomly updated for the current-best solutions by the search operators and named equilibrium candidates. At the point when the last best particle from the equilibrium candidates reaches the balanced state, it is then considered as the ideal output. An unmistakable "generation rate" term is demonstrated to help the exploration and exploitation capacity of the EO for the evasion of nearby minima. The authors in [34] introduced Henry Gas Solubility Optimization, a novel material science-based approach that imitates the conduct of Henry's law. This work is being roused by the Henry's law of dissolvability, which demonstrates that "on a steady temperature, the particular measure of a gas which dissolvable in a particular volume and sort of fluid is directly proportional to the partial pressure of that gas in equilibrium with that fluid". The exploratory outcomes led from 47 optimization problems and the CEC'17 test suite with three engineering design problems uncovered that Henry Gas Solubility Optimization (HGSO) focuses on a harmony between exploration and exploitation capacities of the search space, which avoids the problem of local optima.
The firefly algorithm (FA) is one of the most recently introduced metaheuristic, nature-inspired swarm intelligence techniques formulated by Xin-She Yang in 2008 [17]. The light emitted by fireflies is used for the attraction of fireflies for their potential mate. The FA is one of the most robust, easily implementable, and simple optimization approaches, making it widely applicable to solve different types of complicated optimization problems.
There are a few major drawbacks associated with all the previously proposed optimization algorithms applied for the energy optimization and management in residential buildings. Firstly, most of them are used in their standard operational working mechanisms. This independent working Energies 2020, 13, 4363 6 of 26 characteristic of most of the optimization models makes them weak in handling the parameters from the environment, as well as from the user, leading to an inefficient energy management and optimization process. Secondly, the optimization algorithms are suffering from an imbalanced relationship between the exploration and exploitation capabilities of the solution search space that leads to their failure in getting the most optimal solution of an optimization problem. Due to this property, most of the proposed approaches for the energy optimization process have not been successful in achieving minimum power consumption and maximum user comfort. Lastly, some optimization algorithms have been used in their enhanced, modified, or in hybridization with other optimization algorithms; their complexities increase adequately due to their sophisticated operations in the introduction of modifications or embedding other algorithms' characteristics. In order to overcome all of these drawbacks, a new, simple, and efficient model is proposed in this work. The newly developed model is a hybrid of two optimization algorithms-namely, the FA and GA. The hybridization process makes the model more powerful in minimization of the power consumption and maximization of the user comfort as compared to the independent and conventional optimization techniques. A balanced relationship between the exploration and exploitation capabilities of the solution search space of the standard FA has been achieved by embedding rich operators of the GA used for exploration and exploitation, making it powerful in order to get the minimum power consumption and maximum user comfort. Lastly, the proposed model is easy to implement, because both the FA and GA are easy in terms of integration, running, development, and parameter tuning. The detailed description, working procedure, components, and complete structure of the proposed approach are given in various sections of this paper.

Proposed Approach
In this work, a hybrid approach of one evolutionary intelligence (EI) technique and swarm intelligence (SI) technique is used for energy consumption reduction and increasing the user comfort level in smart buildings. The proposed hybrid model named FA-GA, as it is a blend of an SI technique known as the firefly algorithm (FA) and EI approach called the genetic algorithm (GA), is illustrated in Figure 1. This is a multi-objective optimization approach used to minimize the power consumption and maximize the comfort of the user. The major aim of this model is to blend the fitness functions of the FA and GA to the energy consumption optimization function. The optimization function considered in this research work is used to minimize the power utilization and maximize the level of comfort of the user.
In the proposed hybrid model, the two techniques are applied in a serial fashion. In this manner, the parameters that are used in the optimization module enter the first optimization algorithm-namely, the FA, in this case. After the optimization is performed by the FA, the parameters enter the second algorithm-namely, the GA, in this case, for further improving the optimization process. In this work, three parameters called temperature, illumination, and air quality are taken into account that come from the corresponding sensors and are given as inputs to the first optimizer, named the FA, and then the second optimizer, named the GA. All the parameters used in this work follow the standard adopted by the authors in [1][2][3][7][8][9]. The authors in all of the above research works have used the air temperature as the input of the temperature parameter. After the optimization is performed by the FA-GA hybrid optimization model, the error difference between the newly optimized parameters and the environmental parameters is computed. This error difference is in turn used to calculate the user-preferred indoor environment. In order to provide the required environment to the occupants, the fuzzy controllers are used. The fuzzy controllers take the error difference as the input and generate the required power necessary for changing the status of the actuators as the output. There is a power controller that directs the internal or external power source to provide power to the actuators to change their status according to the power generated by fuzzy controllers.  Figure 1. Proposed firefly algorithm-genetic algorithm (FA-GA) approach for energy management.
In the proposed hybrid model, the two techniques are applied in a serial fashion. In this manner, the parameters that are used in the optimization module enter the first optimization algorithmnamely, the FA, in this case. After the optimization is performed by the FA, the parameters enter the second algorithm-namely, the GA, in this case, for further improving the optimization process. In this work, three parameters called temperature, illumination, and air quality are taken into account that come from the corresponding sensors and are given as inputs to the first optimizer, named the FA, and then the second optimizer, named the GA. All the parameters used in this work follow the standard adopted by the authors in [1][2][3][7][8][9]. The authors in all of the above research works have used the air temperature as the input of the temperature parameter. After the optimization is performed by the FA-GA hybrid optimization model, the error difference between the newly optimized parameters and the environmental parameters is computed. This error difference is in turn used to calculate the user-preferred indoor environment. In order to provide the required environment to the occupants, the fuzzy controllers are used. The fuzzy controllers take the error difference as the input and generate the required power necessary for changing the status of the actuators as the output. There is a power controller that directs the internal or external power source to provide power to the actuators to change their status according to the power generated by fuzzy controllers.

Proposed AI Algorithm
The major and the most complicated part of the proposed energy management efficiency system is the reduction process of the energy utilization and increasing the occupant's comfort level, which is considered as a multi-objective optimization problem. Two powerful AI optimization algorithmsnamely, the FA and GA-have been considered for improving the energy optimization process; therefore, this proposed algorithm has been given a name as the FA-GA model. The motivation behind using the combination of these two algorithms is the fact that only one technique is not able to perform the complete optimization process and finds difficulty in finding the most optimal value of the problem. The objective function or the fitness function used in this process is given in Equation

Proposed AI Algorithm
The major and the most complicated part of the proposed energy management efficiency system is the reduction process of the energy utilization and increasing the occupant's comfort level, which is considered as a multi-objective optimization problem. Two powerful AI optimization algorithms-namely, the FA and GA-have been considered for improving the energy optimization process; therefore, this proposed algorithm has been given a name as the FA-GA model. The motivation behind using the combination of these two algorithms is the fact that only one technique is not able to perform the complete optimization process and finds difficulty in finding the most optimal value of the problem. The objective function or the fitness function used in this process is given in Equation (13) and is associated with the light intensity in Equation (1). The parameters differences are used for making fireflies, whereas the comfort index value is associated with each firefly-emitted light intensity. The initial solution search space is randomly generated using these input parameters, and the solution for each member of the initial population is calculated, which represents the comfort index for each combination. At the second stage of the standard FA, the solutions generated in the initialization stage are updated using the firefly position changing stage, for which the FA uses Equations (3)-(5). The whole mathematical representation of the FA is outlined in Equations (1)- (5). Based on the rules of light in physics, the light intensity released by any single firefly, I (r), from a distance r with the firefly can be calculated using Equation (1).
where I 0 indicates the light intensity emitted at the light source point. In such a case, γ is the absorption coefficient of the medium, I is the light intensity from distance r, which is then calculated by the Equation (2).
Energies 2020, 13, 4363 In such a case, r is the distance between the light source point and the observation point of light. The light intensity here can be correlated with the attractiveness within the fireflies of the FA, which is calculated by Equation (3).
In here, β 0 is the attractiveness at the distance r = 0. While the separation between two fireflies' x i and y j is the Euclidean distance that can be calculated by Equation (4).
For every generation, the firefly position can be changed based on Equation (5).
while α is the randomization parameter, ε represents a Gaussian distribution-based generated random number. The randomization factor is used for controlling the solution search space. After the FA is run to predefined iterations, the GA is applied for a further optimization process. The switching of the optimization process from the FA to GA consists of a few technical steps. The firefly of the FA becomes the chromosomes of the GA, whereas the error differences of all the parameters make the genes of the GA. The GA takes a start from the solution search space generated by the FA in its maximum number of iterations and further continues its processing in the standard normal GA operational steps. The further optimization by the GA takes place in the following stages: a.
An initial population is created for the GA using the standard FA population. b.
The fitness function for user comfort is computed using Equation (13). c.
The best individuals are selected using Roulette wheel, Rank, or tournament selection. In our work, rank-based selection was used. d.
One-point crossover of the selected individuals is performed. e.
Offsprings are generated after the crossover. f.
The mutation operation is performed. g.
The above steps are repeated for the specified number of iterations. h.
When the termination criterion is met, the best-fitted chromosomes are selected. i.
The best chromosomes obtained represent the value of the maximum comfort index.
The proposed approach comprising of the FA and GA is shown in Figure 2.

Comfort Index
The indoor comfort environment of the building is computed using different parameters under consideration. The occupant's comfort is calculated similar to [1][2][3]. This is the overall comfort inside building in the defined range of [0, 1] where 0 represents lowest comfort level and 1 being the highest comfort. The indoor comfort is subjective in nature depending on user preferences. The overall comfort is the blend of three sub-comforts known as temperature, illumination and air quality comforts. In order to compute comfort of each parameter, first their discomfort is calculated as explained by [30] and given by following equations. The temperature discomfort is given by Equation (6).
where T is the environmental temperature, and T s is the user-set temperature. Similarly, the illumination discomfort is given by Equation (7).
where I represents the environmental illumination, and I s represents the user-set illumination.
Energies 2020, 13, x FOR PEER REVIEW 9 of 26 Pseudocode for the suggested approach comprising of the FA and GA a. Begin: 1. Generate the initial population of fireflies using temperature, illumination, and air quality 2. Calculate the comfort index associated i. do a. I = 0. b. By using (4), carry out the calculation of firefly from the optimal. c. Carry out the updating of the fireflies by using Equation (5). d. By using Equation (13)

Comfort Index
The indoor comfort environment of the building is computed using different parameters under consideration. The occupant's comfort is calculated similar to [1][2][3]. This is the overall comfort inside building in the defined range of [0, 1] where 0 represents lowest comfort level and 1 being the highest comfort. The indoor comfort is subjective in nature depending on user preferences. The overall comfort is the blend of three sub-comforts known as temperature, illumination and air quality comforts. In order to compute comfort of each parameter, first their discomfort is calculated as explained by [30] and given by following equations. The temperature discomfort is given by Equation (6).
where T is the environmental temperature, and is the user-set temperature. Similarly, the illumination discomfort is given by Equation (7).
where I represents the environmental illumination, and represents the user-set illumination. In a similar fashion, the air quality discomfort can be computed by Equation (8).
where A shows the environmental air quality, and As represents the user-set air quality parameter value.
In accordance with the discomforts, the comforts associated with temperature, illumination, and air quality are given by Equations (9)- (11). In a similar fashion, the air quality discomfort can be computed by Equation (8).
where A shows the environmental air quality, and A s represents the user-set air quality parameter value.
In accordance with the discomforts, the comforts associated with temperature, illumination, and air quality are given by Equations (9)- (11).
Using Equations (9)-(11), the overall indoor environment comfort is given as in Equation (12): where i = 1 to n = 3 for the three parameters. Based on the above computations, the overall comfort index is computed using Equation (13) [30].
where CI represents the user comfort level index. err 1 , err 2 , and err 3 are the user-set parameters for the three parameters, respectively, and prr 1 + prr 1 + prr 1 = 1. err 1 , err 2 , and err 3 are the differences between the user-defined parameters and environmental parameters. The maximum value of CI is 1. T u is the user-set temperature, I u is the user-set illumination, and A u is the user-set air quality value. After the computation of comfort, the required power for maintaining the comfort is supplied by the controller agent. The total power required is the combination of the electric power required for the three parameters, as shown in Equation (14) [30].
where E TOTAL = total required power, E T = power required for temperature comfort, E I = power required for illumination comfort, and E A = power required for air quality comfort.
It must be kept under consideration that E TOTAL ≤ E max , where E max is the maximum power that is provided by the power source. In order to achieve the required temperature, illumination, and air quality comfort, the fuzzy controllers are used. The coordinator agent uses the outputs of the fuzzy controllers to change the statuses of the actuators concerned. According to the authors of [7], the power required for maintaining the temperature (E T ), illumination (E I ), and air quality (E A ) comfort is given by Equations (15)-(17), respectively. E T = 5.655 * T + 2.961 (15) where T represents the errors of the user-set and the environmental temperature values. Similarly, the power required for the illumination comfort is given by Equation (16): where I represents the error between the user-set and the environmental illumination values. Similarly, the power required for air quality comfort is given by Equation (17): where A represents the difference between the user-set and the environmental air quality values. After the process of optimization, the comfort index is computed. The parameters obtained after calculating the comfort index are entered as inputs to the fuzzy controllers, which, in turn, change the statuses of the actuators accordingly to provide a user-preferred environment inside the building. The details of fuzzy controllers are given in the following sections.

Fuzzy Controllers
The initial concept of fuzzy has been proposed by Zadeh, L.A. at California University [1]. Fuzzy controllers use the concept of fuzzy logic, which gives a new representation to the set theory in which an element can belong to a set of values with some membership functions instead of a few fixed numbers of classes. It uses the concept of inferential rules and the elastic category to deal with uncertainty in the representation of values. In order to reduce the distance between human representation for a problem and the numerical computer representation by a computer system, fuzzy logic control is used, which is implemented in fuzzy controllers. The fuzzy logic control allows dynamic modeling and the description of the controller in terms of simple language statements. There are many reasons that make fuzzy controllers advantageous over the traditional techniques. The first reason of using fuzzy logic instead of traditional controllers is that, in the case of the latter one, there is no proper way of quantitatively refining the parameters by tuning. The controller's parameters can be properly tuned if the system is built on the concept of simple language representation. The second reason of using a fuzzy control system is that it can be used to achieve the quantitative control of a nonlinear system very easily. In our proposed system, the fuzzy controllers have been used because all three parameters-namely, temperature, illumination, and air quality-cannot be handled using the traditional representation of values. The cooling/heating system, lighting system, and ventilation system have been managed using the fuzzy controllers due to the advantages associated with the fuzzy controllers discussed in this section.
In the proposed system, fuzzy controllers have been used for calculating the energy requirements of each environmental parameter for maintaining high-quality user comfort by controlling the corresponding actuators. Resultantly, several generalized functions were formulated to fulfill the requirements of each subsystem. The function has been used for comparing the power determined by the coordinator agent to adjust the amount of energy used. The coordinator will compare the energy demand of each actuator with the available energy present in the energy resource. If the required energy is available, it is supplied to the actuators to maintain a high level of comfort. If a sufficient amount of power is not available, then it is brought from the external resource of energy. The major purpose of the fuzzy controllers is to provide the energy demand required for changing the statuses of the actuators based on parameter differences between the user-set values and the environmental values. This difference is converted to energy by applying fuzzy rules. For each of the fuzzy controllers, the inputs and outputs are described in detail in the following sections.

Temperature Fuzzy Controller
The temperature fuzzy controller takes the error difference between the environmental temperature and the optimized temperature as inputs and generates the power as the output, which is then used to change the statuses of the actuators according to the user-preferred values. The temperature fuzzy controller inputs and outputs are given in the following rules: In the above rules, err 1 is the error between the external environmental temperature and the FA-GA-optimized temperature calculated by Euclidean distance, and PR 1 represents the output power generated for controlling the actuator status. The output difference is the error, and it will be an input to the temperature fuzzy controller. Based on that output error, the energy PR 1 (required power 1) will be generated by the temperature fuzzy controller for providing it to the heating and cooling actuators. NH is the least output error for the external environmental temperature and FA-GA-improved temperature, tailed by NM, NL, ZE, PL, PM, and PH. Therefore, it can be moved from NH towards PH while the difference increases and vice versa. Similarly, the desired power (PR 1 ) for a heating and cooling controlling system is the least (PR 1 = PR 1 NH) for the error difference NH and the highest error difference PH, i.e., PR 1 = PR 1 PH. So, PH is the least error difference between the external environmental temperature and the FA-GA-optimized temperature. While PR 1 NH is the least power required for the heating and cooling system, and PR 1 PH is the highest power required for the heating and cooling system control.

Illumination Fuzzy Controller
The inputs of the illumination fuzzy controller are the error between the external environmental illumination and the FA-GA-optimized illumination values based on Euclidean distance and generates the required power as the output, which is then used to update the lighting actuators status. The required inputs and outputs of the illumination fuzzy controller are given in the following rules: If (err 2 = = HS), then PR 2 = PR 2 HS If (err 2 = = MS), then PR 2 = PR 2 MS If (err 2 = = BS), then PR 2 = PR 2 BS If (err 2 = = OK), then PR 2 = PR 2 OK If (err 2 = = SH), then PR 2 = PR 2 SH If (err 2 = = H), then PR 2 = PR 2 H In the above rules, err 2 is the error between the external environmental illumination and the FA-GA-optimized illumination calculated by Euclidean distance, and this error is used as the input to FIS. HS MS, BS, OK, SH, and H are different labels of membership functions of the input variable of illumination FIS. PR 2 is the required power for illumination, and PR 2 with input variable membership function labels in the output variable indicate the required power for the corresponding input membership function.

Air Quality Fuzzy Controller
The main purpose of the air quality controller is to calculate the required power for controlling the status of the air quality actuator. It takes the error difference between the environmental air quality and FA-GA-optimized air quality values and generates the required power as the output. The rules are given as: If (err 3 = = LOW), then PR 3 = PR 3 LOW If (err 3 = = OK), then PR 3 = PR 3 OK If (err 3 = = SH), then PR 3 = PR 3 SH If (err 3 = = LH), then PR 3 = PR 3 LH If (err 3 = = HIGH), then PR 3 = PR 3 HIGH In the above rules, err 3 is the error between the external environmental illumination and the FA-GA-optimized illumination calculated by Euclidean distance, and this error is used as the input to FIS. LOW, OK, SH, LH, and HIGH are different labels of the membership functions of the input variable of the air quality FIS. PR 3 is the required power for the air quality, and PR 3 with input variable membership functions labels in the output variable indicate the required power for the corresponding input membership function.

Coordinator
The input for the coordinator is the total power energy needed by the controlling system for cooling and heating and lighting and ventilation and generates the output power available based on the power sources. The required power generated by the coordinator is calculated using Equation (18).
In the above equation, TRP represent the total power energy required, PR 1 represents the power required by the cooling and heating system, PR 2 represents the power required by the lighting system, and PR 3 represents the power required by the ventilation system.

Actuators
All the equipment and devices, which require power energy in order to operate inside the buildings, are known as actuators. The main examples of actuators are air conditioners, freezers, and refrigerators; exhausts fans for ventilation purposes; and other light-emitting equipment for lightening. The status of each actuator updates based on the error difference calculated using the Euclidean distance between the environmental parameters and the FA-GA-optimized parameters.

Experimental Setup and Discussion
This section describes the overall hardware and software resources used in our research activity. The experiments for this paper were conducted on an Intel(R) core(TM) i5 CPU with a 2.7 GHz processor. For fast implementation, the proposed and comparative models and developed model were coded using MATLAB R2016a. The parameters of all the considered algorithms used in the experiments are given in Table 2.

Parameter Optimizations
The ranges of the considered parameters, including illumination, temperature, and air quality, are given in Table 3. The responsibility of the optimization algorithms is to keep these parameters in their specified ranges. When the environmental parameters are outside these ranges, the optimization algorithms will bring them to the ranges with the least possible differences with the environmental values.

Temperature Control System
The major elements of the temperature control system are the computation of error differences, power consumption, and inputs/outputs for the fuzzy controller. The optimization algorithm reduces the error difference between the user central point and the environmental temperature. The aforementioned error difference is used for computing the temperature power consumption. The temperature power consumption using different optimization algorithms in comparison with the proposed technique is shown in Figure 3.  Table 4 shows the difference between the user-set values of the temperature (Kelvin) parameter and the environmental parameter after performing the optimization process. In the table,     The temperature fuzzy controller inputs the error difference as per Table 4 and generates the power consumption as the outputs. The input membership and output membership functions are shown in Figures 4 and 5 for the error variance of the environmental temperature and optimized temperature, respectively. The temperature fuzzy controller inputs the error difference as per Table 4 and generates the power consumption as the outputs. The input membership and output membership functions are shown in Figures 4 and 5 for the error variance of the environmental temperature and optimized temperature, respectively.    An example of the input and output for the temperature fuzzy controller is given in Figures 5  and 6, which show the complete inputs-outputs relationship for the temperature fuzzy controller. Balancing the relationship between inputs and outputs for the temperature fuzzy controller results in the most optimal solution. An example of the input and output for the temperature fuzzy controller is given in Figures 5  and 6, which show the complete inputs-outputs relationship for the temperature fuzzy controller. Balancing the relationship between inputs and outputs for the temperature fuzzy controller results in the most optimal solution.

Illumination Control System
Similar to the temperature control system, the illumination control system has also the same elements working in the same manner as the temperature control system works. The major elements of the illumination parameter control system are the calculation of the error differences between the environmental illumination and the optimized illumination values, the power consumption for the illumination, and the fuzzy controller inputs and outputs system. Table 5 represents the error differences for the different optimization algorithms in combination with the proposed algorithm.

Illumination Control System
Similar to the temperature control system, the illumination control system has also the same elements working in the same manner as the temperature control system works. The major elements of the illumination parameter control system are the calculation of the error differences between the environmental illumination and the optimized illumination values, the power consumption for the illumination, and the fuzzy controller inputs and outputs system. Table 5 represents the error differences for the different optimization algorithms in combination with the proposed algorithm.
In the case of the illumination control system, a total of two days of data was observed on an hourly basis, and in Table 5, we have illustrated the results for the 24-h illumination error differences using Euclidean distance between the original value and optimized temperature value. As shown in Table 5, the illumination error values obtained by the proposed hybrid mode are lower than the standard FA and GA. A minor difference for the first few hours for all comparative approaches is relatively near, while from hour 8 to hour 12, the FA, GA, and FA-GA showed the minimum error difference. The error difference onward from hour 14 until hour 24 showed that the FA-GA produced the most optimal error difference for the actual and optimized temperatures. Relatively for all the observations of the illumination error optimization, the developed hybrid optimization model-namely, the FA-FA model, outperforms all the standard algorithms, e.g., the GA, FA, ABC, PSO, and ACO. The difference between the optimized values and the user-set values are shown in Table 5 for the illumination parameter (lux). The performances of different algorithms were compared in terms of minimizing the absolute values of the differences between the user-set illumination and the environmental illumination parameters values. It is evident from the table that the values observed for the proposed FA-GA model are lesser than the other optimization algorithms considered for comparison. This clearly shows the performance of the proposed technique is better than the optimization algorithms applied in their standard format for achieving the goal of minimizing these values. The values observed for all other optimization algorithms have fluctuations for different models and values. In some cases, the values observed by the GA are better than the values observed by the standard FA, ABC, ACO, and DE. In other cases, the values obtained by ABC, ACO, FA, and DE are better than the other techniques considered, making all of them almost equally powerful in their standard operations for handling these values. The most powerful technique of all these models is the proposed FA-GA model, since it combines two optimization algorithms for the optimization process. The illumination parameter values obtained are used for computing the power consumption and the comfort index values. If these values are lesser, it will lead to less power consumption for the illumination parameters and vice versa. Similarly, these values are used for calculating the comfort index of the building. The lesser values of these observed parameters leads to a higher comfort index and vice versa. As a result, if these values are properly minimized by the optimization algorithm, it will result in lower power consumption and a higher comfort index, which are the basic requirements of the optimization model in the proposed system.
Based on the error difference, the power consumptions observed for various algorithms are shown in Figure 7. It can be clearly observed that the minimum power consumption has been carried out by the proposed model with few fluctuations. For the remaining techniques, there are variations in the power consumption; some approaches have little power consumption than the other ones.
illumination parameters and vice versa. Similarly, these values are used for calculating the comfort index of the building. The lesser values of these observed parameters leads to a higher comfort index and vice versa. As a result, if these values are properly minimized by the optimization algorithm, it will result in lower power consumption and a higher comfort index, which are the basic requirements of the optimization model in the proposed system.
Based on the error difference, the power consumptions observed for various algorithms are shown in Figure 7. It can be clearly observed that the minimum power consumption has been carried out by the proposed model with few fluctuations. For the remaining techniques, there are variations in the power consumption; some approaches have little power consumption than the other ones.    Figure 10a represents the power delivered by the illumination fuzzy controller for the lighting actuator, while the relationship between inputs and outputs for the illumination fuzzy controller is presented in Figure 10b.   Figure 10a represents the power delivered by the illumination fuzzy controller for the lighting actuator, while the relationship between inputs and outputs for the illumination fuzzy controller is presented in Figure 10b.  Figure 10a represents the power delivered by the illumination fuzzy controller for the lighting actuator, while the relationship between inputs and outputs for the illumination fuzzy controller is presented in Figure 10b.  Figure 10a represents the power delivered by the illumination fuzzy controller for the lighting actuator, while the relationship between inputs and outputs for the illumination fuzzy controller is presented in Figure 10b.

Air Quality Control System
Similar to the other two control systems, the air quality control system has also the same components working in the same manner as the temperature and illumination control systems work. The major components of the air quality control system are the calculation of the error differences between the environmental air quality and the optimized air quality values, the power consumption for the air quality, and the fuzzy controller inputs and outputs system. The error differences for the different optimization algorithms in combination with the proposed algorithm are shown in Table 6.

Air Quality Control System
Similar to the other two control systems, the air quality control system has also the same components working in the same manner as the temperature and illumination control systems work. The major components of the air quality control system are the calculation of the error differences between the environmental air quality and the optimized air quality values, the power consumption for the air quality, and the fuzzy controller inputs and outputs system. The error differences for the different optimization algorithms in combination with the proposed algorithm are shown in Table 6.
In the case of air quality power consumption, the data was also collected for two whole days on an hourly basis, while we have illustrated the results for one day with 24 h. As shown in Table 6, the air quality error difference obtained by the proposed hybrid mode is lower than the standard FA and GA. A gradual reducing error difference for the first few hours for all considered approaches can be seen. While, from hour 14 to hour 24, the results show that the FA-GA produced the most reduced error difference for the actual and optimized temperatures. The FA-GA model has been successful in minimizing the air quality difference more than the other optimization models considered. For the air quality control system, the lowest error was accomplished by the developed hybrid FA-GA model, followed by the GA, FA, ABC, and ACO, respectively. The effectiveness of the FA-GA model was observed in all the cases.
The error variance between the users' defined air quality and the optimized air quality (CO 2 concentration) for all of the considered approaches is shown in Table 6. The performance and efficiency of all the algorithms are measured in terms of the minimum values for these differences. These values are given in their standard forms, but when considered in the computations of power consumption and comfort index, these are taken in their absolute form. The major aim of all the optimization algorithms is to reduce the absolute values of these parameters. The table clearly indicates that this aim has been achieved by the proposed model in a better way as comparatively to the other optimization algorithms applied in their standard formats. The efficiency in the result of minimizing these values by the proposed model is the result of hybridizing two optimization algorithms in their conventional procedures. For all other optimization models, many fluctuations can be observed in these values. In some cases, one technique may outperform the other, whereas, in other cases, the result may be the opposite. Since these values are used in turn for calculating the air quality power consumption and the occupant's comfort, the minimum values for this will result in less power consumption and higher user comfort, as outlined in the mathematical formula used for computing these values. The proposed model has been adequately proved to be the most powerful as compared to the other standard models. The result behind this efficiency is their combination of two standard models that combine the advantages of both the techniques while eliminating their disadvantages. The power consumption observed for various algorithms shown in Figure 11 is based on the error difference shown in Table 6. It can be clearly observed that the minimum power consumption has been carried out by the proposed model, with few fluctuations. For the remaining techniques, there are variations in the power consumption, with some approaches having little power consumption than the other ones. The air quality fuzzy controller inputs, outputs, examples, and total consumptions observed are shown in Figures 12-15 The power consumption observed for various algorithms shown in Figure 11 is based on the error difference shown in Table 6. It can be clearly observed that the minimum power consumption has been carried out by the proposed model, with few fluctuations. For the remaining techniques, there are variations in the power consumption, with some approaches having little power consumption than the other ones. The air quality fuzzy controller inputs, outputs, examples, and total consumptions observed are shown in Figures 12-15, respectively.             According to the power energy utilized by the temperature control system shown in Figure 3, the power consumed by the illumination control system presented in Figure 7, and the power utilized by the ventilation control system shown in Figure 11, the total power utilized by other optimization approaches is illustrated in Figure 15. According to the power energy utilized by the temperature control system shown in Figure 3, the power consumed by the illumination control system presented in Figure 7, and the power utilized by the ventilation control system shown in Figure 11, the total power utilized by other optimization approaches is illustrated in Figure 15. According to the power energy utilized by the temperature control system shown in Figure 3, the power consumed by the illumination control system presented in Figure 7, and the power utilized by the ventilation control system shown in Figure 11, the total power utilized by other optimization approaches is illustrated in Figure 15. The second major purpose of the optimization algorithm is the maximization of the user comfort. The user comfort is represented by the indoor environment preferred by the occupants residing inside the building. It is defined by three parameters-namely, temperature, illumination, and air quality-in our proposed system. The maximum value of the user comfort is 1, based on the division of preferences given by the user to each of the contributing components. After the parameters are optimized by the optimization algorithms, the user comfort index is computed using Equation (13). The user comfort calculated for the proposed approach in comparison with the other optimization techniques considered is shown in Figure 16. The second major purpose of the optimization algorithm is the maximization of the user comfort. The user comfort is represented by the indoor environment preferred by the occupants residing inside the building. It is defined by three parameters-namely, temperature, illumination, and air quality-in our proposed system. The maximum value of the user comfort is 1, based on the division of preferences given by the user to each of the contributing components. After the parameters are optimized by the optimization algorithms, the user comfort index is computed using Equation (13). The user comfort calculated for the proposed approach in comparison with the other optimization techniques considered is shown in Figure 16.

Statistical Analysis of All Approaches
The statistical facts about the power consumption and the user comfort for various optimization algorithms are shown in Table 7. This analysis is based on the temperature power consumption, illumination power consumption, air quality power consumption, total power consumption, and user comfort outlined in Figures 3,7,11,15 and 16. In the case of the power consumption for temperature, illumination, air quality, total consumption, and the comfort index, there are fluctuations in the observations of all the considered optimization algorithms. In the case of observations for the proposed model, the power consumption is less than all the other algorithms. Similar observations can be found for the user comfort as well. The highest user comfort was achieved for the proposed algorithm, whereas many fluctuations could be observed in the values of the other considered techniques.
The strength of the proposed FA-GA model is sufficiently evident from observing the data given in Table 7. The temperature, illumination, air quality power, and the total power consumption for all the other standard optimization models and the proposed FA-GA model are compared. It is clear from the table that the power consumption values of temperature, illumination, air quality, and the total power consumption for the proposed model are less than the other algorithms used in their

Statistical Analysis of All Approaches
The statistical facts about the power consumption and the user comfort for various optimization algorithms are shown in Table 7. This analysis is based on the temperature power consumption, illumination power consumption, air quality power consumption, total power consumption, and user comfort outlined in Figure 3, Figure 7, Figure 11, Figures 15 and 16. In the case of the power consumption for temperature, illumination, air quality, total consumption, and the comfort index, there are fluctuations in the observations of all the considered optimization algorithms. In the case of observations for the proposed model, the power consumption is less than all the other algorithms. Similar observations can be found for the user comfort as well. The highest user comfort was achieved for the proposed algorithm, whereas many fluctuations could be observed in the values of the other considered techniques. The strength of the proposed FA-GA model is sufficiently evident from observing the data given in Table 7. The temperature, illumination, air quality power, and the total power consumption for all the other standard optimization models and the proposed FA-GA model are compared. It is clear from the table that the power consumption values of temperature, illumination, air quality, and the total power consumption for the proposed model are less than the other algorithms used in their standardized form, showing the better performance and efficiency of the proposed technique. When we observed the values obtained from the other models, many fluctuations could be seen in their performances. In the case of some values, the performance of the GA was better, whereas, in some other cases, the efficiency of the ABC, ACO, FA, and DE were better than the other considered techniques. The power consumption minimization was the first aim of the optimization process, which was obtained quite successfully by the FA-GA model in a better way than the other standard optimization models.
The second aim of the optimization process is the maximization of the user comfort index, as shown in the table. The minimum, maximum, and average user comforts obtained by different optimization models are shown in the last section of the table. The highest comfort index was achieved by the hybrid FA-GA model, followed by other standard optimization models, with various fluctuations for different considered approaches. In the same manner to the observations of power consumption, the proposed model outperforms the other standard models in terms of getting the maximum user comfort.
In the proposed approach, we combined two optimization algorithms-namely, the genetic algorithm and firefly algorithm. The computation complexity of the genetic algorithm is O (gnm), where g represents the number of generations, n indicates the size of the population, and m represents the individual sizes. In the proposed work, another firefly algorithm was used. The firefly algorithm is a metaheuristic algorithm, and it is very simple in terms of complexity and, hence, is easy to implement. The computation complexity of the firefly algorithm is O (n2t), where n represents the inner loops, and t denotes the outer loop. These asymptotic notations exhibit that the computation complexity of both algorithms is low; hence, both of these approaches are fast to run [35,36].

Conclusions and Future Work
In this paper, a hybrid algorithm of one EI technique-namely, the GA, and one SI approach called the FA was developed for the multi-objective optimization problem of energy consumption minimization and management of the IEQ of smart buildings. The proposed optimization model has been named the FA-GA, as it uses the FA as the first optimization technique, and after a fixed number of iterations, the GA is embedded for further improving the optimization process. A whole energy-efficient residential building with different components is proposed in which the optimization algorithm is used for minimizing the energy consumption and IEQ management. The inputs of the optimization algorithm are the ITQ, IVQ, and IAQ parameters from the environment, as well as the user-preferred ranges of the parameters. When the values of the environmental parameters are outside the user-preferred range, the optimization algorithm brings them to the range by minimizing their differences with the user-central points of the parameters. The outputs of the optimization algorithm are the optimized temperature, illumination, and air quality. Based on these values, the IEQ is computed. After the user-preferred values of the parameters are computed, the actuators are used to provide the required environment to the user. A power coordinator is used to control the flow of the required power to change the status of the actuators.
There are a few limitations associated with the building management system proposed in this work. Firstly, for the thermal sensation, only one temperature-namely, air temperature-was considered, which can be extended to other temperature dimensions, e.g., operative temperature and mean radiant temperature. Secondly, other parameters such as the weather conditions and building architecture also need attention for consideration when building management systems are developed.
In the current work, we have only considered three parameters. In the future, we will consider more parameters. In this work, the user-set parameters are static. In the future, we will make the user-set parameters dynamic.