Benchmarking of Heuristic Algorithms for Energy Router-Based Packetized Energy Management in Smart Homes

This article presents an ER-based PEM strategy for PV integrated smart homes to jointly optimize their load scheduling delays, energy transactions cost, and battery degradation cost. The proposed approach incorporates a MA case, where, the ER acts as a main selecting agent realized by all other system elements. This leads to a combinatorial optimization problem, which can be effectively solved by heuristic optimization methods (HOMs), namely, genetic algorithm (GA), binary particle swarm optimization (BPSO), differential evolution (DE) algorithm, and harmony search algorithm (HSA). Specifically, we investigate the impact of the hyperparameters of the HOMs on the designed ER-based PEM system. Simulations are carried out for multiple smart homes under varying weather conditions to evaluate the effectiveness of HOMs in terms of selected performance metrics. Results show that the ER-based PEM reduces the average aggregated system cost, ensures economic benefits by selling surplus energy, while meeting customers energy packet demand, satisfying their quality-of-service, and operational constraints.


MAs
Multiagents Admission cost for the charging event of a storage system in a smart home at t. c

I. INTRODUCTION
O VER the past few decades, electric power system has been influenced greatly by the integration of large-scale RRs. The RRs (represented by solar panels and wind turbines) have become inevitable for alleviating energy prices and mitigating environmental concerns [1], [2]. Yet, energy generation from RRs is intermittent making them less reliable for a stable operation of the power system [3]. Recently, EI has been widely investigated to combat the intermittency in renewable generation through Internet-oriented technologies, such as ERs, plug and play services, and PEM [4], [5], [6].
In the EI paradigm, ER is an integral part, analogous to a router in an Internet network [7]. ER provides real-time communication among users and the utility grid and performs management of RRs, flexible and nonflexible household loads, rooftop PV panels, and storage system often classified as agents [8]. Thus, ER is regarded as an essential element that interfaces multiple agents (MAs) and enables energy resource allocation in smart homes exploiting demand-side management (DSM) [9], [10].
PEM as a part of the DSM can be utilized to meet energy packet demand of smart home customers by scheduling flexible energy packets while ensuring their QoS constraints [11]. In PEM, energy is delivered to the customer loads in the form of energy packets that represent fixed power consumed by the load during a predefined time interval, e.g., 1 kW in an hour [12]. In this sense, this article focuses on the ER-based PEM (ER-PEM) framework for smart homes and provides resource allocation of MAs operating at various times instants. In addition, ER-PEM enables cost-effective solutions for smart users considering QoS, energy transactions between ER and utility grid, PV energy, and storage system. However, a limited amount of work has been done in the above context and most of the literature has either focused on communication and control aspects [5], [6], [7], [9], [13] or on energy management aspects of ER [11], [12], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23]. For instance, authorsin [5] and [6], described the role of the ER in EI networks, investigated design challenges in terms of communication typologies, governance models, and security concerns. Gao et al. [7] studied an ERbased system to investigate the communication and reliability of multiple ERs and energy trading for green cities in EI. Guo et al. in [9] proposed secure energy routing protocols for the optimal energy dispatch between energy hubs (EH) considering power transmission constraints in the EI. Tu et al. [13] proposed a modular-based ER strategy for connecting dc micro grid clusters with ac grids. The other references investigated the operation of ER based on the management aspects [11], [12], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], for example, authors in [11] and [12] evaluated the QoS metric for load allocation problem using PEM system. Li et al. [14] proposed an optimizationbased strategy for the integrated energy system to minimize the cost of the EH using ER applications. In [15], the authors examined optimization problems for home energy management systems (HEMS) in the context of the EH, while the authors in [16] and [17] formulated an energy management solution for operational costs and CO 2 minimization considering contingency constraints in microgrids. Ahmad and Khan [18] solved the joint optimization problem through Lyapunov optimization considering renewable sources, loads, and energy procurement prices, whereas Carli et al. in [19] proposed scheduling algorithms for solving an online optimization problem in microgrids and daily cost minimization through the DSM was achieved. Demand response (DR) methods were proposed in [20] and [21] to control the peak to average ratio (PAR) and to reduce systems costs, while the authors in [22] and [23] investigated HEMS with DSM to reduce energy costs and peak power consumption, considering user's requirements over a finite time horizon.
It is suggested from the above literature review that most of the previous works have investigated energy management solutions e.g., [16], [17], [18], [19], [20], [21], [22], [23] or the control and routing aspects of the ER [7], [9], [15] without considering distinctive and key aspects of EI, such as ER, MAs, and PEM. Although authors in [11] and [12] have studied PEMbased solutions, however, their system model has not provided  I  COMPARISON OF THE STATE-OF-THE-ART WORKS WITH OUR DESIGNED SYSTEM MODEL adequate analysis of design aspects of energy packets, for instance, arrival time, unit energy packet demand, scheduling start time, departure time, and allowable service delay. In contrast, the designed ER-PEM system is a unique architecture and incorporated distinctive design aspects of EI and ER-PEM system. Moreover, the designed ER-PEM system not only accomplished the objectives (i.e., to minimize average aggregated system costs based on, energy packet transactions cost, load scheduling delays cost, and battery degradation cost) but also carried a comparative analysis of the heuristic optimization methods (HOMs) in terms of different sets of hyperparameters and different seasons. Table I briefly summarizes the models in the previous work and also compares the previous models with the designed ER-PEM system in this article.
In the above context, we present an ER-PEM system for multiple smart homes to achieve optimal energy plans in terms of management of MAs based on heuristic optimization methods. Specifically, we account for key attributes of the smart homes, i.e., energy packet scheduling and pricing parameters, and constraints of roof-top panels and energy storage system in the context of ER-PEM system. The goal of ER-PEM is to minimize an average aggregated system cost by solving a joint optimization problem of load scheduling and storage management. The minimization of an average aggregated system cost is subject to constraints of energy demand, scheduling delay parameters, storage system management and energy procurement parameters. To this joint optimization problem, we employ HOMs: genetic algorithm (GA), binary particle swarm optimization (BPSO), differential evolution (DE), and harmony search algorithm (HSA). Finally, we present simulation results and analyze the relative performance of HOMs and the impact of their hyperparameters on the designed ER-PEM system.
The major contributions of this work are summarized below. 1) A comprehensive system model is presented for smart homes based on an ER-PEM system. The model consists of multiple smart homes and their associated characteristics including energy packet attributes and delay constraints, PV energy generation, battery storage system, and energy packets' transactions. 2) An energy pricing model ( [24], [25]) is tailored for energy packet exchange (buy and sell) between smart homes and packetized energy service provider (P-ESP). The model provides flexibility for economic energy transactions while conserving the demand-supply ratio.
3) The joint optimization problem is solved by implementing four well-known HOMs-GA, BPSO, DE, and HSAand their performance and suitability for the designed system model are benchmarked.

4) A comprehensive case study is conducted to evaluate
HOMs and their associated hyperparameters in terms average aggregated system cost parameters. Note that this work is an extension of [26] and it contributes in the following ways.
1) Literature review is extensively updated with state-of-theart research methods in terms of their contributions and potential research gaps. 2) Unlike a single smart home in [26], the ER-PEM model in this article is upgraded with a systematic integration of multiple smart homes, their respective attributes and constraints considering an extended set of HOMs and varying weather conditions. 3) The relative performance analysis of HOMs is carried out based on the joint optimization problem of load scheduling and storage management in the ER-PEM system. In addition, simulation scenarios are extended to investigate the impact of the HOMs' hyperparameters on energy packet transactions and their associated service delays.
The rest of this article is organized as follows. Section II formulates the problem and provides the system model. A brief overview of heuristic optimization is given in Section IV. Simulation results are presented in Section V. Finally, Section VI concludes this article. Fig. 1 depicts conceptual overview of ER-PEM system. Where Fig. 1(a) shows the interaction of ER with MAs, utility grid, and P-ESP, and Fig. 1(b) represents three main building blocks of the ER: a power electronics module, a communication module, and a management-and-control module [7]. The power electronics module can be a solid-state transformer, inverters, and converters to provide circuitry-based active control of energy flows. The management module is responsible for allocating energy resources and providing optimal energy usage plans to satisfy users' demand and cost requirements. The power electronics and management modules are connected through a communication module that may consist of a wired network, e.g., PLC and fiber optics (FOs), a wireless network, e.g., WiMAX, cognitive radio (CR), and a SDN, or a combination of both [5]. Potentially, the ER can act like a plug-and-play interface for smart homes to connect to or disconnect from traditional energy sources, PV sources, battery storage systems, and electrical loads. In this work, we mainly focus on packetized energy optimization via an energy management module carrying the following tasks: 1) devise and manage schedules for energy packets transactions considering all connected sources, storage, and loads; and 2) coordinate with the P-ESP for economic energy transactions.

A. Load Model
A set of smart homes j ∈ {1, 2, . . ., M} accommodate loads i ∈ {1, 2, . . ., N} that operate at discrete time slots t ∈ {0, 1, 2, . . ., T 0 − 1} in a local energy community. The loads are energy consumption elements in each smart home, and they are characterized by different attributes as follows.
1) Load arrival time ( j,i t ): The time slot at which a request for a given load arrives in a smart home j.
2) Unit energy packets demand (P j,i t ): In a smart home, we consider the energy is consumed in the form of discrete value packets by load i and each energy packet is repre- The time slot at which the load departs after completing its operation. Let U j,i t be the number of unit energy packets P j,i t demanded by a smart home j of load i at time slot t. The total energy packets required by all smart homes (M ) with loads (N ) during scheduling horizon (T 0 ) is computed by During appliance scheduling, the following user defined QoS constraint should be satisfied: Equation (2) ensures that a given appliance i in a smart home j is scheduled at t without violating its delay requirement (d j,i t,max ), considering its arrival time ( j,i t ) and its length of operation time (ς j,i t ). During the scheduling duration (T 0 ), appliances with d j,i t,max > 0 can be delayed from their respective arrival times ( j,i t 's), thereby adding flexibility to the load scheduling process. However, this flexibility (i.e., load scheduling delay) may adversely affect user comfort, if it goes beyond a specific user-defined level. Let d j,i t be the delay experienced by load i in smart home j at t after serving [23], [27], such that in which, if j,i t = ζ j,i t then d j,i t = 0, and the load is served immediately; otherwise, delay is incurred. A greater value of d j,i t in (3) reflects the downgraded comfort level of the smart home user. Thus, (4) is modeled to impose user QoS-based lower and upper limits on Using (5), the average delay incurred of any load i in a smart home j during T 0 is obtained as Finally, (6) guarantees that the user QoS-based average bounds (0 and d

B. Energy Price Model
Smart homes, equipped with ERs and energy sources, are either having insufficient or adequate energy packets. Energyinsufficient smart homes have a greater energy demand than their locally generated and stored energy, and smart homes which possess adequate energy packets have a smaller energy demand than their locally generated and stored energy. , . . ., H sell t,I ]) back to the utility grid through the P-ESP. This process of energy packets exchange (buying and selling) is conducted by an energy pricing model of the P-ESP, which is formulated based on the constraints of feed-in-tariff of the utility, and demand-and-supply ratio (R DS t ) within the energy packet sharing zone. The P-ESP acts as an agent for M smart home prosumers. It can buy energy packets from smart homes and the utility grid at unit prices H j,buy t and J buy t , and sells energy packets to them at unit prices H j,sell t and J sell t , respectively [24]. This can be formulated as It is noticed from (7)  Meanwhile, considering the energy packet selling cost, P-ESP's charge and utility's charge, an energy packet buying price is defined as shows that the overall energy packets demand are greater than the total energy packet supply of the smart home prosumers in the energy packet sharing zone, and this energy packet insufficiency is satisfied by procuring energy packets from the utility grid at J buy t . In-line with the above context, let K j,buy t indicates the cost of energy packets bought by smart home j from the utility grid at time slot t via P-ESP here in (9), H j,sell t represents the selling cost of energy packets, P M,L t is the total energy packets demands at time t, and E j t,pv , E j,s t are available energy from rooftop PV and energy storage system at time instant j. It is also assumed that a smart home j buys energy packets only if the total energy packets demand can not be satisfied by E j t,pv + E j,s t . Similarly, (10) formulates the cost of energy packets sold by smart home j to the utility grid at time slot t via P-ESP Further, the smart home users can sell the surplus energy packets given that E j t,pv + E j,s t must be greater than demand of P M,L t . As per [25], eq. (9) and (10)] the average cost of the energy packets transaction (K tx t ) can be expressed as Here, the goal is to maximize the prosumer's energy packet revenue by minimizing the difference between K j,sell t and K j,buy t . However, the process of energy packets buying and selling is constrained by the following: where (12) implies that ERs can schedule the flexible loads in smart homes at other allowable time slots (x j,i t ), while keeping the total energy packets demand constant. Likewise, (13) guarantees that the scheduling of flexible loads (x j,i t ) must not exceed smart home's base energy packet demand (P j,i t,min ) and the upper bound on supply capacity (P j,i t,max ).Constraints (14) and (15) ensure that energy procurement and selling criteria should be controlled and can not exceed given limits i.e., H j,buy t,max and H j,sell t,max . Finally, (16) constraints on the feed-in energy packets when the utility grid restricts the selling of additionally generated energy packets (B max ) due to grid security issues.

C. PV System
As mentioned earlier, roof-top PV panels are installed in the smart homes converting solar energy to electrical energy. Based on the model in [28], let E t,pv be the total amount of harvested energy from the PV panels by M smart homes over the entire horizon (T 0 ) such that from (17), E t,pv can be calculated as , the symbols η pv , A pv , and I ir signify conversion efficiency, generator area, and solar irradiance, respectively. While 0.005 is the value use for temperature correction factor (TCF), and K t respesents outdoor temperature. Let E c t,pv be the energy consumed from E t,pv in (18) with respective constraint (19) as given as follows: From (18) and (19), it is clear that E j t,pv is firstly supplied to the scheduled load in j at t ( , and the remaining part (E r t,pv ), if any, is stored in an in-home energy storage system (according to (20). It is worth noting that charging and discharging events of the battery cause a degradation cost in it. Hence, to manage charging or discharging events, PEM-ER can determine whether to store or not the conserved portion of E j t,pv (i.e., E r,j t,pv ) in the battery based on joint optimization.

D. Energy Storage System
During the time horizon T 0 the energy storage system can be operated by three possible states: 1) charging; 2) discharging; 3) idle considering the current energy packet demand and supply conditions. That is, during charging state, it can either be charged from the PV panels, the P-ESP, or a combination of both. Likewise, during discharging state, it can be discharged to satisfy the energy packet need of various loads. In an idle state, it is neither charging nor discharging. These state transitions are bounded by the following: Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply.
Specifically, (21) and (22) imply that charging and discharging demand at time t can be met by the available energy in the battery. (22) also limits that the total charging amount (E j t,pv + E g t ) at time slot t does not exceed its upper limit (S max ), while (23) restricts the total discharging amount in j at t (k j t ) by its upper bound (k j max ). Equation (24) imposes per slot minimum and maximum capacity constraints (E j,s t,min and E j,s t,max ) on the current energy state of the battery (E j,s t ). The current energy state of the battery system is computed as signify decay rate in the battery, the efficiencies of charging and discharging activities, respectively.
Let a ; 0, otherwise} specify whether an event charging occurred (a ; 0, otherwise} is considered for a discharging event. In this regard, charging and discharging events lead to degradation cost in the battery, indicated by c (+) t and c (−) t , respectively. Based on a thorough analysis in [29], [30], [31], [32], and [33], the battery degradation costs at t can be formulated as follows: In (26) and (27) represent battery degradation cost occur due to its charging and discharging activities in a smart home j. It can be noted that the lifetime of the battery storage system depends on fast variation of charging (i.e., E r,j t,pv + E g t ) and discharging (k j t ) activities, however, if charging and discharging are kept at their rated values then the lifetime of the storage battery is affected by current variations corresponding to their rated values. Therefore, based on (26) and (27), the degradation cost of a the battery in a smart home j at t is given in the following, its average is computed over T 0 as: The objective here is to minimize the average battery degradation cost in (29). From the above discussions, it is clear that minimizing (30) is a joint stochastic optimization problem between the three considered system costs. And solving this problem through traditional mathematical optimization techniques is computationally expensive and required high assessment [16], [17], [18]. Therefore, in the next section, heuristic optimization techniques are adopted to solve the joint stochastic optimization problem of (30).

III. PROBLEM FORMULATION
pv , E r t,pv , k j t be an energy flow vector and control actions for smart homes at time slot t. The aim here is to minimize an average aggregated system cost which consists of the following parts: 1) the energy packet transactions cost (selling and buying) with the P-ESP (K M,tx T 0 ); 2) household load scheduling delays cost (K d (d M,N T 0 )); 3) energy storage battery degradation cost (K M,s T 0 ). Our aim is to find an optimal policy {θ T 0 , d M,N T 0 }, while minimizing the average system cost. Thus, the problem can be formulated as minimize: . The cost function in (30) and the formulated constraints in (6)-(24) are related to energy scheduling, energy procurement, and energy control as discussed in the previous Sections II-A and II-D. Clearly, the optimization problem in (30) is a joint stochastic optimization problem between the three considered system costs. This joint scheduling makes the problem difficult to solve by traditional mathematical optimization techniques [12], [13], [14]. Therefore, in the next section, heuristic optimization techniques are adopted to solve the joint stochastic optimization problem of (30).

IV. OPTIMIZATION TECHNIQUES
Heuristic optimization techniques are generally employed to solve scheduling problems due to their ability to solve high dimensional and complex problems with fast convergence, ease in implementation, and local optima avoidance capabilities [20], [21], [22], [23]. Thus, we employ the following well-known heuristic algorithms: GA, BPSO [34], DE, and HSA [35] methods. These algorithms are briefly discussed in the following.

A. Genetic Algorithm
The GA [35] is employed to solve the joint optimization problem in (30) through the following steps. 1) Population generation: Initialize a set of random population (P 0 ) such that X a ∈ {1 if P 0 (a) > 0.5, otherwise 0}. The individuals in P 0 are binary coded X ab , b ∈ [1, k] where k is a dimensional vector denoting the operation of load as ON and OFF states. The algorithm parameters; P 0 , crossover, mutation types (C bt , M bt ), and probabilities (P c , P m ), respectively, where bt is the set of positive integers.
2) System inputs: Obtain the input values of 4) Updating P 0 : The set of individuals in P 0 are modified and go through crossover and mutation with a probability range between 0 and 1. In each iteration, stochastic operators are applied (until generations reach a preset number) to achieve optimal solutions and minimize (30).

B. Binary Particle Swarm Optimization
The joint optimization problem in (30) is solved via the BPSO [35] algorithm through the following steps.
1) Population generation: Initialize the swarm (S 0 ) in a pair ( − → ps r , − → v r ) using (31). The algorithm parameters are set, including maximum and minimum velocities of the particles, normal distribution between 0 and 1. The position ps r of the particle r is computed as where − → ps r , − → v r ∈ R n represent position and velocity of the particles and − → ps r (t − 1) is the prior position of the particle in S 0 . 2) System inputs: Obtain the required input values as mentioned in Section IV-A with upper and lower bounds according to Section II.
3) Evaluation: Calculate K d (d 4) Updating S 0 : For the optimal values of S 0 , the search space is refined/altered according to where α 1 .rand 1 and α 2 .rand 2 are random weights for p r (local) and p g (global) positions of the particles, respectively. In (33) − → v r max and − → v r min signify the maximum and minimum velocities of particle r at random point, respectively. It is to be observed that − → ps r is constrained between [0, 1]. The updated particles in S 0 are further tested in the evaluation step to achieve best values (until generations reach a preset number).

C. Differential Evolution Algorithm
The joint optimization problem in (30) is solved through the DE algorithm [36] involving the steps given below. 1) Population generation: Initial population P 1 ∈ R n is obtained from (34) with p U e , p L e being the upper and lower bounds of P 1 , respectively, where rand i is a uniformly distributed random number between 0 and 1.
2) System inputs: Obtain the required input values as mentioned in Section IV-A with upper and lower bounds according to Section II. 4) Updating P 1 : P 1 is updated through mutation process using (35) and new trial vector T v is obtained by crossover using (36) T v = M de if rand(j) ≤ cr P 1 if rand(j) > cr (36) where F in (35) is a constant between [0, 1], v r1 , v r2 , and v r3 are the vectors (randomly) chosen from P 1 and r1, r2, r3 are positive integers ∈ {1, 2, 3, 4. . .n}. Through crossover (cr), new trial vector is generated as per (36). The updated individuals in P 1 are further tested in the evaluation step to achieve the best individuals until generation reaches a preset number.

D. Harmony Search Algorithm
The joint optimization problem in (30) is solved through the HSA algorithm [35] implemented via the following steps.
1) Population generation: Initialize harmony memory (HM ) size and other parameters of the algorithm; such as HM consideration rate (HM c), pitch adjustment ratio (P a), minimum and maximum bandwidth (b min , b max ) 2) Inputs: Obtain the required input values as mentioned in Section IV-A with upper and lower bounds according to Section II.
3) Evaluation: In each iteration, HSA operators P (HM c) and P (P a) are applied to HM to strive for optimal solutions until generations reach a preset number.

V. RESULTS AND DISCUSSION
In this section, we present simulation results of the designed ER-PEM system model based on the selected four HOMs: GA, BPSO, DE, and HSA. We benchmark the performance of HOMs based on energy scheduling parameters (i.e., energy balance, average transactions, average delay, and average system cost cost) in varying seasons and under different values of HOMs' hyperparameters.
For simulations purpose, we assume M = 10 smart homes with the same energy profiles for a finite scheduling horizon of 24 hours (starting from 1:00 A.M. to the next day at 1 A.M.) [37]. Further, PV energy is generated randomly varying over T 0 and I ir with E   solar irradiance and temperature is obtained from the Finnish Meteorological Institute (FMI) [38]. We consider that smart home users can buy or sell their energy packets from or to the utility with H buy t,min = 0.6 cents/kWh, H buy t,max = 3.7 cents/kWh, H sell t,min = 0.06 cents/kWh and H sell t,min = 0.57 cents/kWh [39]. We also consider following sets of hyperparameters: 3) selection of F, P ce , p L e , p u e for DE; 4) selection of HM c, P a min , P a max , b min , b max for HSA. The HOMs are analyzed under varied selection sets of their respective values of hyperparameters as given in Table II. We run our simulation using MATLAB scripts (version R2018b) on a 2.5-GHz PC with 32 GB RAM. Fig. 3 shows energy balance results for the unscheduled case against the selected HOMs (i.e., GA, BPSO, DE, and HSA). It is clear from Fig. 3 that energy demand of smart homes is met from the on-site renewable resources and external power grid. It can be seen from Fig. 3 that PV energy is insufficient to meet the energy demand of smart homes, however, it is used efficiently by HOMs. Whenever possible, the smart homes procure energy at low prices from the utility grid to meet their energy demand. It can be further noted from Fig. 3 that the selected HOMs schedule the demand of smart homes efficiently while respecting system constraints as discussed in Sections II and III. Fig. 4 depicts relative performance of the selected HOMs against the unscheduled case in terms of the PEC involving selling of energy packets to and buying of energy packets from the P-ESP over T 0 . In the unscheduled case [see Fig. 4(a)], energy packet transactions are unidirectional only, i.e., E t 's are bought by smart home customers at 2.30$for E t,max . By contrast, the heuristic algorithms [see Fig. 4(b)-(e)] carry bidirectional energy packet transactions among smart home customers and the P-ESP. Fig 4 reflects that the HOMs are efficient to balance the energy demand of smart homes as well as empower the smart home customers to sell surplus energy. Particularly, smart home customers buy energy during 1-5 A.M. When the available PV generated energy exceeds the demand during day time, the surplus energy packets are sold back to the P-ESP.
Quantitatively, the selling costs (in $/slot) for GA, BPSO, DE, and HSA algorithms are 0.61, 1.04, 0.51, and 0.89, respectively. The performance comparison of algorithms shows that the BPSO and HSA utilize the harvested energy from the PV system and energy storage system in a more efficient manner than the GA, and the DE-selling greater amount of energy packets to the P-ESP. This validates that the heuristic optimization algorithms allocate energy resources effectively and facilitate customers to sell back their surplus energy to the utility grid via the P-ESP. Table III illustrates the buying and selling cost of the M smart homes on daily and monthly basis. As mentioned previously, in an unscheduled case, the energy packet transactions are unidirectional and the daily average buying cost is 1.9 $. By contrast, with the inclusion of HOMs, smart home customers are able to sell the surplus energy at an average cost of 0.61, 1,04, 0.51, and 0.89 $ by the GA, BPSO, DE, and HSA, respectively, as shown in Table III. It can be observed from the table that the selling cost of energy packets under various hyperparameters' selection remains constant except for selection IV, where the cost slightly increases by 0.11 ( $/slot) for GA, DE, HSA, and 0.6 ( $/slot) for BPSO. On the other hand, the procurement cost  of energy packets varies with the selection of different values of hyperparameters. Essentially, the inclusion of hyperparameters' selection (I-IV) reflects that HOMs has improved the scheduling process (by selling the energy packets and procuring energy packets at low prices) and reduced the overall PEC of smart home customers. Fig. 5(a)-(d) show the impact of load scheduling delay of the selected algorithms on the average system cost under the hyperparameters' selection I-IV. The average system cost is calculated as energy procurement cost, scheduling delay cost, and battery degradation cost (as mentioned in Section III). The average system cost can be increased/decreased based on the allowable load scheduling delays, which means relaxing the allowable delay can decrease the average cost of the system and vice versa. This relation is depicted in Fig. 5 as strict scheduling delay of the algorithms results in higher average system cost, whereas when scheduling delay is allowed to relax, the cost of the system is reduced. It is important to note that this tradeoff can help the users to operate scheduling delays at their desired level with respect to the average cost of the system. Similarly, the impact of the hyperparameters' selections (II, III, IV) for the average system cost versus d T 0 ,max shows sublinear relation for the given algorithms. This means during scheduling process, the operation of the load i can be delayed to obtain flexibility in the average system cost, however, on the other hand, QoS would be compromised. It can also be observed from Fig. 6(a)-(d) that during the scheduling process, BPSO attains d j,i T 0 ,max and compromises QoS most in comparison to other algorithms which in turn reduces system cost. Note that, in Fig (a)-(c) the HOMs exhibit the same behavior (sublinear), however, the order of the algorithms in terms of d j,i T 0 ,max has changed due to different set of hyperparameters selection. This reflects that different values of hyperparameters can add flexibility to the scheduling process considering constraints of the scheduling parameters. The order of the algorithms in terms of d j,i T 0 ,max is presented in the Table IV. It is worth mentioning that the ER-PEM provides the optimal energy plans for a single home, like HEMS and multiple homes considering the energy-demand requirement as discussed in Section II. Thus, for the sake of simplicity, here, we show the BPSO algorithm to demonstrate the PEM planes for 10 smart homes separately in Fig. 7. Fig. 7(a) and (b) represents the PEM plans for ten smart homes at "t" for an unscheduled case and the BPSO algorithm. It can be observed from Fig. 7(a) that the PEM plans without scheduling are uniform values for smart homes during "t" which consequently generates power peaks in peak hours. In contrast, Fig. 7(b) depicts that the algorithm BPSO tends to provide diverse PEM plans for each smart home in time slot "t" and avoids the peak consumption of energy. Fig. 8(a) and (b) shows the performance of the BPSO algorithm for T 0 during three days: summer-spring-winter in terms of the maximum allowable delay and the average cost of the system. In Fig. 8(a), when the season conditions varied from summer-spring-winter, the value of d j,i T 0 increases reflecting demanding constraints of energy storage systems due to the increase in imbalance between R DS t . Next, Fig. 8(b) represents the effect of d j,i T 0 ,max on the average system cost considering varied season conditions. The tradeoff relation between the average system cost and d j,i T 0 ,max can be seen, which represents the average system cost can be lowered with the stringent load scheduling delay and vice versa.

VI. CONCLUSION
This article presents an ER-based PEM system for MAs at smart homes in the EI. The goal is to minimize the average aggregated system cost which consists of load scheduling delay cost, energy procurement cost, and battery degradation cost. To achieve the objective, we jointly optimize the energy usage of smart homes, grid-connected PV energy, and energy storage system The ER-PEM solves the joint optimization problem considering the four well-known HOMs: GA, BPSO, DE, and HSA. Through simulations, the selected HOMs are benchmarked in terms of energy scheduling parameters, energy scheduling delays, energy balance, and average system cost parameters. Moreover, the performance of the ER-PEM is also evaluated by considering the impact of the hyperparameters of heuristic techniques and varying weather conditions on ER-PEM system. The results show that the ER-based PEM minimizes the average aggregated system cost and provides effective energy plans for a single smart home and in an energy community of multiple smart homes and varied season conditions. In the future, we aim to investigate the impact of electric vehicles integration on the EI under the assumptions of the proposed model.