Smart Grid Energy Optimization and Scheduling Appliances Priority for Residential Buildings through Meta-Heuristic Hybrid Approaches

: Smart grid technology has given users the ability to regulate their home energy use more efﬁciently and effectively. Home Energy Management (HEM) is a difﬁcult undertaking in this regard, as it necessitates the optimal scheduling of smart appliances to reduce energy usage. In this research, we introduce a metaheuristic-based HEM system which incorporates Earth Worm Algorithm (EWA) and Harmony Search Algorithms (HSA). In addition, a hybridization based on the EWA and HSA operators is used to optimize energy consumption in terms of electricity cost and Peak-to-Average Ratio (PAR) reduction. Hybridization has been demonstrated to be beneﬁcial in achieving many objectives at the same time. Extensive simulations in MATLAB were used to test the performance of the proposed hybrid technique. The simulations were run for multiple homes with multiple appliances, which were categorized according to the usage and nature of the appliance, taking advantage of appliance scheduling in terms of the time-varying retail pricing enabled by the smart grid two-way communication infrastructure algorithms EWA and HSA, along with a Real-Time Price scheme. These techniques helped us to ﬁnd the best usage pattern for energy consumption to reduce electricity costs. These metaheuristic techniques efﬁciently reduced and shifted the load from peak hours to off-peak hours and reduced electricity costs. In comparison to HSA, the simulation results suggest that EWA performed better in terms of cost reduction. In comparison to EWA and HSA, HSA was more efﬁcient in terms of PAR. However, the proposed hybrid approach EHSA gave the maximum reduction in cost which was 2.668%, 2.247%, and 2.535% in the case of 10, 30, and 50 homes, respectively, as compared to EWA and HSA. and the results were evaluated on the bases of cost in PKR, PAR, energy consumption or load in kWh, and user comfort in terms of waiting time, which was measured using the units of minutes or hours.


Introduction
In the coming decades, electrical power control grids, confronted with decentralization, liberalization of energy, and increasing requests for high-quality and reliable electricity, will come under stress in trying to provide energy according to these needs [1]. The use of a Smart Grid (SG) is considered a promising approach to coordinate these upcoming needs. Energy management has been investigated as one of the foremost and most complicated optimization problems in power control systems. In [1][2][3], practitioners proposed different approaches for efficiently managing the energy by using a smart grid with optimal power dispatch, scheduling of efficient home electrical appliances, and using metaheuristic

•
Applied the existing and proposed hybrid approach to optimize the energy consumption for multiple (10,30,50) and single homes on eight appliances each; • Evaluated the approach over three different time intervals of 60, 30, 5 min OTI; • Reduced the maximum cost of electricity consumption; • Reduced the PAR to accommodate the comfort of the users; • Real-Time Pricing from dynamic pricing rates was used; • Evaluated proposed approach in terms of PAR, cost, wait time, and load parameters; • Proposed an efficient home appliance scheduling technique: EHSA.
The notation guide for algorithms and other abbreviations is provided in Table 1.

Paper Organization
The rest of the paper is organized as follows: Section 2 contains discussion of the background, Section 3 outlines related work, and Section 4 presents the problem statement. The proposed system model is discussed in Section 5. Section 6 discusses the optimization techniques which we used for energy optimization. The simulation and results are discussed in Section 7. In Section 8, discussion and implications are presented, and finally, conclusions and future work are described in Section 9.

Background
An Energy Management System (EMS) is a collection of computer-aided tools used by electric utility grid operators to monitor, control, and optimize the performance of a generation or transmission system. Energy management is the process of tracking and optimizing energy consumption to reduce energy consumption in a building. Energy management is regarded as a critical component of an SG to improve renewable energy consumption and energy efficiency [1].
Electricity consumption is rising in tandem with the world's population. Conventional power grids are incapable of meeting today's electricity demand. The concept of the SG has been introduced to meet this demand. SGs have been is introduced to meet today's electricity demand, which is increasing because of the increase in population and electricity usage. An SG is an electricity network that allows for the bidirectional flow of electricity and data, as well as the use of digital communications technology to detect and respond to changes in usage and other issues. By using an SG, it is possible to manage power quality, energy efficiency, generation, and storage while fulfilling the market need, as shown in Figure 1. Some essential components of SGs used to meet energy optimization challenges are Smart Meters (SM), Renewable Energy Sources (RES), and Smart Appliances. SGs are designed to improve the reliability of the electrical power supply and reduce overall energy consumption. Using this information, Demand-Side Management (DSM) strategies are applied to optimize the usage of electricity and maintain a balance between demand and supply, which ultimately results in reduced electricity costs. These DSM strategies help users to manage the load during peak hours [2].

Related Work
Many researchers and practitioners are currently working on energy management in smart grids. In [3], the authors used an energy management controller (EMC) with three heuristic algorithms, Genetic Algorithm (GA), Ant Colony Optimization (ACO), and Binary Particle Swarm Optimization (BPSO). An EMC model was presented with the aim of reducing electricity cost and increasing user comfort by keeping peak generation away from residential energy. Residential users were further divided into three categories in this work: passive users, active users, and semi-active users. Using Multiple Knapsack Problems (MKP) for single and multiple homes, by using the combination of Inclined Block Rate (IBR) and Time of Use (ToU), and this combined pricing scheme was used for the calculation of cost. The algorithms used with these pricing schemes were GA, ACO, and BPSO, which are metaheuristic algorithms. Appliances were divided into three types according to energy consumption patterns. This system model was implemented using three heuristic algorithms, which were combined with the EMC model and RES separately to evaluate the efficiency of the proposed heuristic algorithms compared with EMC. After calculation of the electricity bill for all three combined techniques, the results showed that GA-EMC worked more effectively than ACO-EMC and BPSO-EMC. The electricity bill was 752 cents in the case of GA-EMC, and for ACO-EMC and BPSO-EMC the electricity bill increased by 25% and 39%, respectively.
In [4], a model for microgrid operations with responsive load and an electric vehicle was considered. The electrical vehicle scheduler model was implemented using BPSO, with the cost linked with the rescheduling of generated units. Rescheduling affected cost because of the change in power generation by wind and photovoltaic cells. In the presented model, microgrid operations with a responsive load and an electric vehicle were considered. The model was divided into two steps which were used to determine operating costs. By considering the uncertainties associated with photovoltaic (PV) power and wind, the cost function and emission function were divided into two parts. In [5], the authors proposed a Comprehensive Home Energy Management System (CHEMS). The six-

Related Work
Many researchers and practitioners are currently working on energy management in smart grids. In [3], the authors used an energy management controller (EMC) with three heuristic algorithms, Genetic Algorithm (GA), Ant Colony Optimization (ACO), and Binary Particle Swarm Optimization (BPSO). An EMC model was presented with the aim of reducing electricity cost and increasing user comfort by keeping peak generation away from residential energy. Residential users were further divided into three categories in this work: passive users, active users, and semi-active users. Using Multiple Knapsack Problems (MKP) for single and multiple homes, by using the combination of Inclined Block Rate (IBR) and Time of Use (ToU), and this combined pricing scheme was used for the calculation of cost. The algorithms used with these pricing schemes were GA, ACO, and BPSO, which are metaheuristic algorithms. Appliances were divided into three types according to energy consumption patterns. This system model was implemented using three heuristic algorithms, which were combined with the EMC model and RES separately to evaluate the efficiency of the proposed heuristic algorithms compared with EMC. After calculation of the electricity bill for all three combined techniques, the results showed that GA-EMC worked more effectively than ACO-EMC and BPSO-EMC. The electricity bill was 752 cents in the case of GA-EMC, and for ACO-EMC and BPSO-EMC the electricity bill increased by 25% and 39%, respectively.
In [4], a model for microgrid operations with responsive load and an electric vehicle was considered. The electrical vehicle scheduler model was implemented using BPSO, with the cost linked with the rescheduling of generated units. Rescheduling affected cost because of the change in power generation by wind and photovoltaic cells. In the presented model, microgrid operations with a responsive load and an electric vehicle were considered. The model was divided into two steps which were used to determine operating costs. By considering the uncertainties associated with photovoltaic (PV) power and wind, the cost function and emission function were divided into two parts. In [5], the authors proposed a Comprehensive Home Energy Management System (CHEMS). The six-layered model included appliance interface, cost minimization, electricity theft, fault, demand prediction, and dynamic pricing. In this paper, the authors presented a CHEMS model; in this model, load and appliances were categorized into different forms using the SG domain. The purpose of the presented CHEMS model was to schedule the different appliances for energy optimization and reduce peak load. Out of the six layers of the CHEMS model, four layers were implemented in this paper, remaining two layers are electricity theft control and fault identification. Through reduction of the peak load via a scheduled load with a User Comfort Index (UCI) and an unscheduled load, the reduction of the total cost was evaluated. Four layers (appliance interface, cost minimization, electricity theft, and fault) were implemented in this paper, and demand prediction and dynamic pricing associated with the remaining two layers were left for future work.
The work in [6] presented an energy management system with real-time reporting of the load to manage electricity and reduce cost and PAR, and also considered user comfort. Appliances within a single home were categorized into five types, elastic (el), thermostatically controlled (tc), inelastic (iel), user aware (ua), and regular (r), according to their usage with time. In order to increase user comfort level, users could manage the wait time of appliances manually. A Conventional Programmable Communication Thermostat (CPCT) was used with GA for implementation. The knapsack was used to control PAR reduction, which was handled using GA. The results show that the proposed system and algorithms worked effectively by organizing the scheduling of the appliances to manage energy consumption.
In [7], four types of pricing schemes are discussed: RTP, CPP, TOU, and no tariff. The algorithms used for the management of energy consumption and optimization of the load were Shuffled Frog Leaping (SFL) and Teaching and Learning based Optimization (TLBO). Appliances were classified into three types: non sheddable loads, sheddable loads, and shiftable loads. The results showed that if payment methods of consumers in the smart grid were optimized using TLBO and SFL, the demand response with the change in pricing according to the demand information could reduce cost and provide the best energy optimization pattern. The performance of TLBO was more efficient than that of SFL. In [8], the authors introduced hybrid technique that combined HSA with DE (HSDE) with the objective of minimization of operation cost and the total generation by PV, wind turbine (WT), and power flow constraint batteries. By comparing this technique with different hybrid techniques like modified DE (MDE), a photovoltaic-wind smart microgrid model with battery storage and day-ahead scheduling was presented. Photovoltaic arrays, wind turbines, diesel generators, and batteries were used to minimize total startup and generation costs. Harmony search algorithm (HSA) with hybrid differential evolution (HDE) was used for the optimization. An improved mutation was introduced in the proposed system in order to increase the working of the algorithm. In [9], author shows the evolutionary algorithms that were used in a smart home with hard constraints in the form of deadlines, focusing on the optimized pattern for shiftable appliances. Discrete Non-Dominated Multi-Objective Particle Swarm Optimization (DNMPSO) and Manhattan distance-based Non-Dominated Multi-Objective Genetic Algorithm (MNMGA) were used in this work; these algorithms are heuristic algorithms. To evaluate both DNMPSO and MNMGA, numerical simulations were implemented for energy management, with the scheduling of appliances to achieve the goal of reducing cost and minimizing peak demand. The results showed that the effect of DNMPSO was better than that of MNMGA.
All economical activities require energy resources, whether to provide transportation, manufacture goods, or run machines, computers, and heavy industrial machinery. High energy demands may result in competition for energy utilities and affect the arrangement of retail energy markets. The energy management system for retail energy market from supply side to a supply-demand balanced situation is shown in Figure 2. The supply end shows how energy is harvested, distributed, and allocated, which is linked to networking and metering to balance the load and predict the usage of individuals. linked to networking and metering to balance the load and predict the usage of individuals. To date, researchers have proposed several solutions to optimize energy management, from smart meters to smart grids to energy-efficient energy appliances to balance the supply and demand. Job scheduling of appliances is optimized using a GA for cost minimization in an SG. Storage devices like batteries and RES have been considered. The batteries become active and start discharging when high prices and high load come into action and start recharging when the price is low; RES is used for recharging of the batteries. In [10], Author considered different aspects of appliances including time duration, the priority of the appliance, and resource availability. In [11], Bacterial Foraging Optimization Algorithm (BFOA), Wind Driven Optimization (WDO), Genetic Wind-Driven (GWD), BPSO, and GA were used to manage home energy management systems by scheduling smart appliances.
These algorithms are heuristic. In this work, the RTP pricing scheme was used with these algorithms. User Comfort (UC), PAR reduction, and decrease in electricity cost were successfully achieved in this work. The results show different optimal solutions for these algorithms, as GWD performed best compared to other algorithms for electricity cost reduction. These techniques were applied in scenarios describing one home and multiple homes. In [12], WDO was used based on the knapsack problem, and was called Knapsack Wind Driven Optimization technique (KWDO). KWDO was applied to manage the electricity cost and allow control of the peak loads by the user. The main goal of this work was to achieve UC with cost reduction. However, to achieve UC, RES plays an important role, and experiments have shown that RES affects electricity bills. The setup of RES is not managed, which directly affects the total bills of the user.
In [3,5,7], Time of Use (ToU) pricing schemes were used with different approaches. In [3], block rate IBR and ToU were combined and this combined pricing scheme was used for the calculation of cost via evolutionary algorithms GA, BPSO, and ACO. In [5], the presented model was a six-layered CHEMA and a ToU pricing scheme was used for the evaluation, in order to reach the objectives of appliance interface cost minimization, electricity theft, and electrical fault. Meanwhile in [7], the ToU pricing scheme was changeable according to the demand response information. TOU was not considered alone throughout the process, but RTP, CPP, and no tariffs were also considered in this scenario; the pricing scheme changed when demand response change occurred because this model was implemented in the smart grid with the help of the TLBO and SFL algorithms. If TOU is To date, researchers have proposed several solutions to optimize energy management, from smart meters to smart grids to energy-efficient energy appliances to balance the supply and demand. Job scheduling of appliances is optimized using a GA for cost minimization in an SG. Storage devices like batteries and RES have been considered. The batteries become active and start discharging when high prices and high load come into action and start recharging when the price is low; RES is used for recharging of the batteries. In [10], Author considered different aspects of appliances including time duration, the priority of the appliance, and resource availability. In [11], Bacterial Foraging Optimization Algorithm (BFOA), Wind Driven Optimization (WDO), Genetic Wind-Driven (GWD), BPSO, and GA were used to manage home energy management systems by scheduling smart appliances.
These algorithms are heuristic. In this work, the RTP pricing scheme was used with these algorithms. User Comfort (UC), PAR reduction, and decrease in electricity cost were successfully achieved in this work. The results show different optimal solutions for these algorithms, as GWD performed best compared to other algorithms for electricity cost reduction. These techniques were applied in scenarios describing one home and multiple homes. In [12], WDO was used based on the knapsack problem, and was called Knapsack Wind Driven Optimization technique (KWDO). KWDO was applied to manage the electricity cost and allow control of the peak loads by the user. The main goal of this work was to achieve UC with cost reduction. However, to achieve UC, RES plays an important role, and experiments have shown that RES affects electricity bills. The setup of RES is not managed, which directly affects the total bills of the user.
In [3,5,7], Time of Use (ToU) pricing schemes were used with different approaches. In [3], block rate IBR and ToU were combined and this combined pricing scheme was used for the calculation of cost via evolutionary algorithms GA, BPSO, and ACO. In [5], the presented model was a six-layered CHEMA and a ToU pricing scheme was used for the evaluation, in order to reach the objectives of appliance interface cost minimization, electricity theft, and electrical fault. Meanwhile in [7], the ToU pricing scheme was changeable according to the demand response information. TOU was not considered alone throughout the process, but RTP, CPP, and no tariffs were also considered in this scenario; the pricing scheme changed when demand response change occurred because this model was implemented in the smart grid with the help of the TLBO and SFL algorithms. If TOU is used with IBR, it gives good results in terms of cost and PAR reduction, considering evolutionary algorithms.
RTP pricing schemes were used by [6,8,10,11]. GA algorithm was used with RTP in [6,10] with different purposes. In [6], the objective was to obtain PAR reduction by using GA and RTP. In [10], cost minimization in SG was considered when using GA and RTP. Comparing these two sets of results from the same techniques, GA and RTP, we see that GA and RTP work more efficiently if they are used for PAR reduction. Conventional Programmable Communication Thermostat (CPCT) was used with GA to achieve optimal solution patterns and more reduced PAR HEMS using HSA [6]. In [8], RTP was used with HSA and HDE to achieve the objective of minimizing total startup and generation costs. In [11], the RTP pricing scheme was used with BFOA, GWD, BPSO, and GA, to retain the UC, PAR reduction and decrease in electricity cost.
The authors in [3,9,12] used evolutionary algorithms for the purpose of achieving cost and PAR reduction and optimized patterns for shiftable appliances, respectively. In [3], GA, ACO, and BPSO were used with EMC and results were evaluated by combining these algorithms with EMC. The results showed that GA-EMC worked more effectively than ACO-EMC and BPSO-EMC. In [9], Particle Swarm Optimization (PSO) was combined with Discrete Non-Dominated Multi-Objective and a new technique, DNMPSO, was introduced; meanwhile, GA was combined with Manhattan Distance Based Non-Dominated Multi-Objective to introduce MNMGA. To achieve the purpose of reducing cost, results showed that DNMPSO was better than MNMGA. The authors in [12] presented the use of Bacterial Foraging Optimization Algorithm (BFOA), Wind Driven Optimization (WDO), Genetic Wind-Driven (GWD), BPSO, and GA to manage home energy management systems via scheduling smart appliances [13]. These algorithms are heuristic algorithms and an RTP pricing scheme was applied. UC reduction and a decrease in electricity cost were achieved.
Energy management in residential buildings is a critical research issue, and practitioners have used multiple approaches to manage the energy more efficiently in smart homes [14,15] through metaheuristics approaches [16,17], balancing the load between on-peak and off-peak hours [18], smart meters [19], and smart grids for scheduling optimal energy consumption [20]. In [21,22], the authors used multiobjective optimization with Renewable Energy Resources (RES) in a smart grid to improve the cost and achieve emission-based optimization using the DE metaheuristics approach and designed an AC-DC smart microgrid with RES for energy optimization, respectively. Table 2 describes the state of the art of existing energy management approaches.  Energy Management has been a critical research issue for decades, as discussed above. Researchers have used different metaheuristic approaches for the reduction of costs using different pricing schemes. In our work, we selected the HSA and EWA metaheuristic approaches and proposed a hybrid EHSA approach (a hybrid of HSA and EWA). We extracted these approaches from state-of-the-art, and the RTP tariff was applied. In this work, we evaluated the proposed approach on eight appliances by categorizing them into interruptible, non-interruptible, and based categories. We applied the proposed strategies on multiple homes, using 10, 30, and 50 homes, to evaluate the effectiveness of the proposed approach. We minimized the cost and PAR using these metaheuristic approaches. We were successful in reducing the energy consumption and load during peak hours to decrease the electricity bill cost to the user, while minimizing the waiting time to enhance user comfort.

Problem Statement
In HEMS, many optimization techniques are used to achieve the objective of reduced PAR, energy management, and User Comfort (UC) with the help of SGs. The revolutionary algorithms ACO, BPSO, and GA were used in [3] to achieve the objectives of PAR and cost reduction by using IBR and ToU pricing schemes. This work achieved the goal of cost and PAR reduction by combining all three algorithms with EMC separately for evaluation. However, the results for UC were not satisfactory. The authors in [5] presented a six-layered CHEMA model. Four layers-appliance interface, cost minimization, electricity theft, and fault-were implemented in this paper with the aim of reduction of peak load through scheduled load with UCI and unscheduled load, and reduction of the total cost. Two layers-demand prediction and dynamic pricing-were left for future work.
In [6], five categories of appliances were presented: elastic (el), thermostatically controlled (tc), inelastic (iel), user aware (ua), and regular (r). These categories were defined according to usage with time. CPCT was used with GA for implementation. The proposed systems and algorithms worked effectively by organizing the scheduling process of the appliances to manage energy consumption. However, the results for user comfort were not satisfactory. TLBO and SFL algorithms are presented in [7]; in this work, the authors considered RTP, CPP, ToU, and no-tariff pricing schemes. However, the performance of TLBO was better than that of SFL. In [8], HSA and HDE were used for optimization. An improved mutation was introduced in the proposed system in order to increase the effectiveness of the algorithm. Total startup and generation costs were reduced in this work, while user comfort, PAR, and load balancing were not considered properly. In [10], GA was used for cost minimization while considering job scheduling optimization. This work considered different aspects of appliances, including time duration, the priority of the appliance, and resource availability.
Subscribers or users are currently facing issues of electricity cost and user comfort, as discussed above in the earlier researchers' work. Most of them achieve low cost by compromising on user comfort. However, this compromise can be minimized by shifting the load from peak hours to nonpeak hours. Along with this, the pricing scheme that is implemented also plays a role in power usage and electricity cost. Thus, in our work, we implemented EWA, HSA, and a hybrid of both metaheuristic techniques, HSA and EWA, using the RTP pricing scheme to achieve the goal of reduced PAR, minimized cost of electricity, load management, and maximized user comfort. Our work considered multiple homes and multiple smart appliances within three different scenarios: 5 min Operational Time Interval (OTI), 30 min OTI, and 60 min OTI.

System Model
In our proposed model, we include multiple homes with multiple appliances which are categorized into different types depending on the time of use and the nature of the appliances. The three categories are interruptible, noninterruptible, and baseload appliances. The purpose of our model is to reduce PAR and electricity costs for the user while considering UC in terms of waiting time. Hybrid EWA and HSA along with the RTP scheme were used to achieve our objectives. The smart home is assembled with a Smart Meter (SM) and EMC. EMC is used to control, manage, and communicate between utility and consumer, as shown in Figure 3. Information transmission from the utility to the EMC and SM allows management of the load and price signals to reduce electricity cost. According to the power or electricity consumption pattern, appliances are categorized into three broad classes: interruptible, noninterruptible, and based appliances. The appliances and the parameters used in our system model are listed in Table 3 along with their power ratings and Length of Operation Time (LOT).   For evaluation, we implemented three scenarios using EWA, HSA, and hybrid EWA HSA along with a RTP tariff in a smart home considering multiple appliances. We considered 5 min Operational Time Interval (OTI), 30 min OTI, and 60 min OTI for eight appliances, and the results were based on cost, PAR, energy consumption, and user comfort.

Optimization Techniques
In this work, we considered two metaheuristic optimization techniques, EWA and HSA, and a hybrid of these metaheuristic approaches for the evaluation of PAR, cost, user comfort, and load management. The techniques are as follows.

Earth Worm Optimization
The bioinspired metaheuristic algorithm Earthworm Algorithm (EWA) is inspired by the contributions of earthworms in nature. The EWA method is inspired by the two reproductions of earthworms in nature (reproduction 1 and reproduction 2). In EWA, the offspring are independently generated by Reproduction 1 and Reproduction 2, and then all the generated offspring are weighted and summed to give the final earthworm of the next generation. The working procedure of EWA is shown in Algorithm 1. For evaluation, we implemented three scenarios using EWA, HSA, and hybrid EWA HSA along with a RTP tariff in a smart home considering multiple appliances. We considered 5 min Operational Time Interval (OTI), 30 min OTI, and 60 min OTI for eight appliances, and the results were based on cost, PAR, energy consumption, and user comfort.

Optimization Techniques
In this work, we considered two metaheuristic optimization techniques, EWA and HSA, and a hybrid of these metaheuristic approaches for the evaluation of PAR, cost, user comfort, and load management. The techniques are as follows.

Earth Worm Optimization
The bioinspired metaheuristic algorithm Earthworm Algorithm (EWA) is inspired by the contributions of earthworms in nature. The EWA method is inspired by the two reproductions of earthworms in nature (reproduction 1 and reproduction 2). In EWA, the offspring are independently generated by Reproduction 1 and Reproduction 2, and then all the generated offspring are weighted and summed to give the final earthworm of the next generation. The working procedure of EWA is shown in Algorithm 1.

Harmony Search Algorithm
This is a metaheuristic algorithm. It imitates the improvisation process of a jazz musician. Musical improvisation is a process of searching for better musical harmony. Three steps are used to generate a new harmony: memory considerations, pitch adjustment, and random selection. The generation of a new harmony depends on two control parameters, namely Harmony Memory Consideration Rate (HMCR) and Pitch Adjustment Rate. For each element of the new harmony random number is used, if a generated random number is less than the predefined HMCR, then a number is generated and the value chooses a specific location attain it from previously existing memory. The steps of HSA is shown in Algorithm 2. Algorithm 1. EWA for SG Scheduling 1: Step 1: Start initialization. First set t = 1 which is the generation counter 2: Set to generate t = 1 counter 3: Set the population to NP earthworm's P 4: randomly select individuals in the search space 5: Set the number of earthworms nKEW, the maximum generation MaxGn, α is the similarity factor, the ratio is β, and the constant γ = 0.9. 6: Step 2: Evaluate fitness. Set every aspect of the earthworm to its place 7: Step 3: 8: while Until the best solution is not reached or t < MaxGen do 9: Sort all earthworms according to fitness value 10: for i = 1 to NP (all earthworms) do 11: Generate offspring xi1 by breeding 1 12: produces offspring by breeding 2 13: end for 14

Hybrid HSA and EWA
The combination of two approaches is known as a hybrid approach. The fitness function of HSA is employed to operate after the initial functioning of EWA. In EWA, selection is done by comparing the trial and target vectors, but in HSA, selection is done entirely with HM members. The hybrid technique EHSA is more widely adopted, since it combines the best features of both existing approaches, HSA and EWA, to improve performance. EHSA combines the EWA-based production of new worms with the HSA-based selection technique. The hybrid approach was here evaluated in terms of PAR, electricity cost, load, and waiting time, used to indicate user comfort. Our work considered three scenarios for simulation and evaluation of the results of HSA, EWA, and the hybrid of these both techniques. Our work focused on PAR reduction and reduction electricity cost while considering user comfort in terms of waiting time. Our optimization problem was evaluated in terms of scheduling of appliances in different time slots to reduce electricity cost. The attributes associated with each appliance are appliance status (ON or OFF) and power rating, listed in Table 2. The cost of the electricity was calculated using Equation (1); load and PAR were calculated using Equations (2) and (3) (1)

Simulations and Results
This work was done using MATLAB. The appliances used were eight appliances with different usage patterns. Results were evaluated using EWA, HSA, and the hybrid of EWA and HSA (EHSA) approach along with a RTP pricing scheme. A time interval of five minutes was defined to complete all activities. For simulations, we considered 5 min OTI, 30 min OTI, and 60 min OTI across eight appliances, and the results were evaluated on the bases of cost in PKR, PAR, energy consumption or load in kWh, and user comfort in terms of waiting time, which was measured using the units of minutes or hours.

Simulations for Sixty Minutes OTI
In the 60 min OTI, the performance of the hybrid approach (EHSA) was better than that of the HSA and EWA with RTP. HSA and EWO also outperformed the unscheduled appliances. Cost and PAR were decreased, and in terms of load energy consumption, the hybrid approach, HSA, and EDW reduced load during peak hours. Peak hours were determined from 17 to 23 according to the 60 min OTI and 24 slots. The results of the hybrid approach (EHSA), HSA, and EWA were gathered. The EHSA minimized the Peakto-Average Ratio (PAR) effect on the cost, as shown in Figure 4a. EHSA and EWA reduced the energy consumption and load during peak hours in order to decrease the electricity bill cost of the user, as shown in Figure 4b. The cost value of EHSA was 1100 and that of EWA was 1200, and the waiting time of EWA was increased compared to those of HSA and EHSA. EHSA performed better in terms of user comfort, as shown in Figure 4c. Figure 4d shows that the load was reduced or shifted during peak hours to reduce the cost. The hybrid technique of both EWA and HSA showed that in 60 min OTI, the cost of the hybrid and EWA approach was reduced but the waiting time of EWA was more as compared to the hybrid technique EHSA. The results reveal that EHSA performed better in terms of user comfort and cost. on the bases of cost in PKR, PAR, energy consumption or load in kWh, and user comfort in terms of waiting time, which was measured using the units of minutes or hours.

Simulations for Sixty Minute OTI
In the 60 min OTI, the performance of the hybrid approach (EHSA) was better than that of the HSA and EWA with RTP. HSA and EWO also outperformed the unscheduled appliances. Cost and PAR were decreased, and in terms of load energy consumption, the hybrid approach, HSA, and EDW reduced load during peak hours. Peak hours were determined from 17 to 23 according to the 60 min OTI and 24 slots. The results of the hybrid approach (EHSA), HSA, and EWA were gathered. The EHSA minimized the Peak-to-Average Ratio (PAR) effect on the cost, as shown in Figure 4a. EHSA and EWA reduced the energy consumption and load during peak hours in order to decrease the electricity bill cost of the user, as shown in Figure 4b. The cost value of EHSA was 1100 and that of EWA was 1200, and the waiting time of EWA was increased compared to those of HSA and EHSA. EHSA performed better in terms of user comfort, as shown in Figure 4c. Figure 4d shows that the load was reduced or shifted during peak hours to reduce the cost. The hybrid technique of both EWA and HSA showed that in 60 min OTI, the cost of the hybrid and EWA approach was reduced but the waiting time of EWA was more as compared to the hybrid technique EHSA. The results reveal that EHSA performed better in terms of user comfort and cost.

Simulations for Thirty Minutes OTI
Simulations and results for 30 min OTI showed that the performance of the hybrid approach was better in terms of PAR, cost, and user comfort, as shown in Figure 5a-c. The hybrid technique EHSA with RTP performed better as compared to the EWA, HSA, and unscheduled appliances. The cost and PAR of EHSA were reduced as compared to EWA and HSA. In terms of cost, HSA performed well as compared to EWA, both metaheuristic techniques performed better as compared to the unscheduled pattern, and in load energy consumption, EHSA, HSA, and EWA reduced load during peak hours, as shown in Figure 5d. Peak hours were from (07:30 to 17:30) according to 30 min OTI and 48 slots. Results show that when using EHSA, HSA, and EWA with 30 min OTI, EHSA, EWA, and HSA reduced the energy consumption and load during peak hours to produce a decrease in the electricity bill cost of the user. However, the hybrid technique performed better than both of the metaheuristic algorithms by achieving a cost value of 2400 with minimum PAR value, as shown in Figure 5a,b, respectively. The waiting time of HSA and EWA was increased, while EHSA performed better in the form of user comfort, as the simulation results of 30 min OTI show in Figure 5c.

Simulations for Thirty Minute OTI
Simulations and results for 30 min OTI showed that the performance of the hybrid approach was better in terms of PAR, cost, and user comfort, as shown in Figure 5a-c. The hybrid technique EHSA with RTP performed better as compared to the EWA, HSA, and unscheduled appliances. The cost and PAR of EHSA were reduced as compared to EWA and HSA. In terms of cost, HSA performed well as compared to EWA, both metaheuristic techniques performed better as compared to the unscheduled pattern, and in load energy consumption, EHSA, HSA, and EWA reduced load during peak hours, as shown in Figure  5d. Peak hours were from (07:30 to 17:30) according to 30 min OTI and 48 slots. Results show that when using EHSA, HSA, and EWA with 30 min OTI, EHSA, EWA, and HSA reduced the energy consumption and load during peak hours to produce a decrease in the electricity bill cost of the user. However, the hybrid technique performed better than both of the metaheuristic algorithms by achieving a cost value of 2400 with minimum PAR value, as shown in Figure 5b and Figure 5a, respectively. The waiting time of HSA and EWA was increased, while EHSA performed better in the form of user comfort, as the simulation results of 30 min OTI show in Figure 5c.

Simulations for Five Minutes OTI
Results for 5 min OTI show that the performance of EHSA, EWA, and HSA with RTP was better as compared to that of the unscheduled appliances, However, the EHSA approach outperformed the others in terms of cost, as it achieves low cost with minimum PAR by shifting the load from peak hours, and shifted the minimum load to maximize user comfort and reduce the total cost value. The cost and PAR of HSA were almost the same as those of EWA; however, both metaheuristic techniques performed better than the unscheduled pattern, as shown in Figure 6a,b, and in load energy consumption, EHSA and EWA reduced load during peak hours by achieving the maximum user comfort, reducing the waiting time as shown in Figure 6c. Peak hours were from (06:45 to 19:05) according to 5 min OTI and 288 slots, as represented in Figure 6d. Results show that when using EHSA, HSA, and EWA with 5 min OTI, EHSA, and EWA reduce the energy consumption and load during the peak hours to decrease the electricity bill cost of the user, and the waiting time of EWA was increased. EHSA performed better in terms of user comfort, as shown in Figure 6c of 5 min OTI.

Simulations for Five Minute OTI
Results for 5 min OTI show that the performance of EHSA, EWA, and HSA with RTP was better as compared to that of the unscheduled appliances, However, the EHSA approach outperformed the others in terms of cost, as it achieves low cost with minimum PAR by shifting the load from peak hours, and shifted the minimum load to maximize user comfort and reduce the total cost value. The cost and PAR of HSA were almost the same as those of EWA; however, both metaheuristic techniques performed better than the unscheduled pattern, as shown in Figure 6a,b, and in load energy consumption, EHSA and EWA reduced load during peak hours by achieving the maximum user comfort, reducing the waiting time as shown in Figure 6c. Peak hours were from (06:45 to 19:05) according to 5 min OTI and 288 slots, as represented in Figure 6d. Results show that when using EHSA, HSA, and EWA with 5 min OTI, EHSA, and EWA reduce the energy consumption and load during the peak hours to decrease the electricity bill cost of the user, and the waiting time of EWA was increased. EHSA performed better in terms of user comfort, as shown in Figure 6c

Simulations for Multiple Homes
We evaluated the results of our proposed hybrid technique EHSA and collected results for our proposed scheme across multiple homes, comparing it with EWA, HSA, and unscheduled to find the differences between the cost and user comfort level. We applied our hybrid technique on 10, 30, and 50 homes with the goal of minimizing the total cost and maximizing the user comfort level via load management during peak hours, as shown in Figure 7a,b, respectively.

Simulations for Multiple Homes
We evaluated the results of our proposed hybrid technique EHSA and collected results for our proposed scheme across multiple homes, comparing it with EWA, HSA, and unscheduled to find the differences between the cost and user comfort level. We applied our hybrid technique on 10, 30, and 50 homes with the goal of minimizing the total cost and maximizing the user comfort level via load management during peak hours, as shown in Figure 7a and Figure 7b, respectively.

Feasible Region
A feasible region is a defined area defined by a set of points where the objective function satisfies the result. The problem's restrictions are a small number of specified points. We found the feasible region of a cost function for multiple houses in this paper. As demonstrated in Figure 8, the feasible region of the objective function minimizes cost by minimizing energy consumption. Figure 8 shows the feasible region for single, 10, 30, and 50 houses in subfigures a-c, respectively. All viable solutions were covered according to the fitness function. The feasible region, also known as the search space, is a region defined by a subset of all optimization problems. The overall cost region is shown by points P1 (0.600, 15

Feasible Region
A feasible region is a defined area defined by a set of points where the objective function satisfies the result. The problem's restrictions are a small number of specified points. We found the feasible region of a cost function for multiple houses in this paper. As demonstrated in Figure 8, the feasible region of the objective function minimizes cost by minimizing energy consumption. Figure 8 shows the feasible region for single, 10, 30, and 50 houses in Figure 8a-c, respectively. All viable solutions were covered according to the fitness function. The feasible region, also known as the search space, is a region defined by a subset of all optimization problems. The overall cost region is shown by points P1 (0.

Discussion and Implications
After the simulations of EHSA, EWA, HSA, and unscheduled approaches, different results were evaluated in terms of PAR, user comfort, electricity cost, and load. The performance of techniques varies from scenario to scenario, and there was always a tradeoff between user comfort and cost. However, this could be maximized by shifting the unnecessary use during peak hours, thus maintaining the user comfort and reducing the cost. Discussion of these four parameters is as follows:

PAR
PAR was reduced when using EHSA, HSA, and EWA as compared to unscheduled load, because EHSA, HSA, and EWA efficiently reduced the load during peak hours to reduce the cost to the user. Low PAR also helps the utility to maintain its stability, which results in a reduction of cost. While in our proposed hybrid technique PAR outperformed EWA and HSA, reduced PAR and increased user comfort showed a trade-off between PAR, user comfort, and cost.

User Comfort
User comfort of EHSA was than that for EWA and HSA. In our proposed hybrid technique, user comfort was superior compared to HSA and EWA. The hybrid technique performed well in terms of user comfort; however, there was a trade-off between cost and user comfort which could be managed by shifting the unnecessary load to reduce the waiting time and achieve high user comfort with minimum cost.

Cost
EHSA, EWA, and HSA performed efficiently to reduce the cost to the user as compared to the unscheduled process. Because it reduced the load during peak hours according to the categories and usage of the appliances, HSA efficiently turned appliances ON/OFF to reduce cost in peak hours; however, user comfort acted there as a trade-off parameter to achieve the cost parameter with a specific or small number of appliances. The cost was reduced with a desirable waiting time.

Conclusions
In this paper, the performance of HEMS with RTP was investigated utilizing metaheuristic optimization techniques such as HSA, EWA, and the proposed EHSA. We ran simulations for multiple homes to demonstrate the effectiveness of the proposed methodology. There were eight smart appliances in each home. According to their energy consumption patterns, these appliances were divided into subcategories. We analyzed similar appliances in three situations for each home: 60 min Operational Time Interval (OTI), 30 min OTI, and 5 min OTI. Cost, PAR, and user comfort were all factors considered when evaluating optimization approaches. The user comfort was measured by the length of waiting time. The efficiency of our proposed technique in terms of cost and PAR reduction was demonstrated by simulation results. The proposed scheme gave the maximum reduction in cost, which was 2.668%, 2.247%, and 2.535% in the case of single, 10, 30, and 50 homes, respectively, as compared to EWA and HSA. In terms of PAR and cost reduction, the proposed technique EHSA performed well compared to HSA and EWA. HSA performed better than EWA in terms of PAR reduction, whereas EWA outperformed HSA in terms of cost reduction. Furthermore, the proposed EHSA technique outperformed the other techniques in terms of PAR and cost reduction, but there was still a cost-to-user comfort trade-off. In the future, we will combine RES with a storage system to investigate the cost of reducing electricity usage.
Author Contributions: All the authors contributed equally. All authors have read and agreed to the published version of the manuscript.

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.

Data Availability Statement:
The data used in this research can be obtained from the corresponding author.

Conflicts of Interest:
The authors declare no conflict of interest.