## 3 Methodology: IW-ABC
### Fitness Function  
The quality of the solution, \(x_{i}\), is evaluated using the fitness function, \(f(x_{i})\), which is defined according to the optimization problem. There are two objectives considered here. The first objective is the occupant's comfort level maximization, which is measurable using the user comfort index (CI), while the second objective is the minimization of energy consumption of the appliances used to control the room lighting, temperature, and air quality. The fitness function adopted here follows the work of [36].  
The comfort index ranges between 0 and 1, where 0 indicates the least comfortable and 1 is when the most comfortable environment is achieved. The comfort index is measured by taking into account the gap between the user's preference and the room's environmental  
Figure 4: Pseudo Code of Onlooker Bee Phase.  
Figure 5: Pseudo Code of Scout Bee Phase.  
values. The lesser the gap the better it is for the occupant. The CI is calculated using Equation (6).  
\[CI=p_{1}\left[1-\left(\frac{e_{1}}{T_{s}}\right)^{2}\right]+p_{2}\left[1-\left( \frac{e_{2}}{I_{s}}\right)^{2}\right]+p_{3}\left[1-\left(\frac{e_{3}}{A_{s}} \right)^{2}\right] \tag{6}\]  
where \(p_{1}\), \(p_{2}\), and \(p_{3}\) are the coefficients that control the importance of temperature, illumination, and air quality toward a user's comfort. These coefficients are defined by the users. The equal values of \(p_{1}\), \(p_{2}\), and \(p_{3}\) indicate the equal importance of all three parameters in providing comfort to the occupant. The errors or differences between the optimized temperature, illumination, and air quality (\(T_{o}\), \(I_{o}\), and \(A_{o}\)) and the environmental values (\(T_{c}\), \(I_{c}\), and \(A_{c}\)) are represented by \(e_{1}\), \(e_{2}\), and \(e_{3}\), respectively. On the other hand, \(T_{s}\), \(I_{s}\), and \(A_{s}\) are the user's preferred temperature, illumination, and air quality, respectively. The optimized value (\(T_{o}\), \(I_{o}\), and \(A_{o}\)) is the evaluated solution i.e., the food source, \(x_{i}\).  
The difference between the optimized values and the environment is used for the energy consumption calculation. The amount of energy required by respective appliances is based on this difference. Smaller difference requires smaller energy usage, bigger difference cause higher energy consumption. The total energy consumption is calculated using Equation (7).  
\[EC=E_{T}+E_{I}+E_{A} \tag{7}\]  
The energy required by the temperature control actuator is denoted by \(E_{T}\), lighting actuator, \(E_{I}\), and actuator to control the indoor air quality, \(E_{A}\). Each of these energy requirements can be calculated using Equations (8)-(10), respectively.  
\[E_{T}=P_{T}(T_{O}-T_{C}) \tag{8}\]  
\[E_{I}=P_{I}(I_{O}-I_{C}) \tag{9}\]  
\[E_{A}=P_{A}(A_{O}-A_{C}) \tag{10}\]  
where \(P_{T}\) is the energy required per-unit change of the temperature, whereas \(P_{I}\) is the energy required per-unit change of the illumination, and lastly \(P_{A}\) is the energy required per-unit change of the air quality.  
The energy saving gain (\(G_{es}\)) has an inverse relation with the energy consumption. A lower energy consumption leads to higher energy saving gain, where the energy saving gain formula is given in Equation (11).  
\[G_{es}=\left(1-\left(\frac{EC-E_{min}}{E_{max}-E_{min}}\right)^{2}\right) \tag{11}\]  
The \(E_{min}\) and \(E_{max}\) are the minimum and maximum energy and are based on the maximum and minimum of the user preferred temperature, illumination, and air quality.  
The two objectives of the user comfort index maximization and energy consumption minimization is tackled as a single objective using the weighted penalty method as shown in Equation (12).  
\[Maximize(a_{1}\bullet CI+a_{2}\bullet G_{ec}) \tag{12}\]  
where \(a_{1}\) and \(a_{2}\) determine the importance of CI and \(G_{ec}\), respectively, and \(a_{1}+a_{2}=1\). Equation (12) is the fitness function of the IW-ABC.