## 8 Load Optimization and Scheduling  
In this section, we discuss the TOU pricing model in which EMC receives the price signal from the electricity provider (utility). The main objective is to design and simulate an optimization model to reduce the electricity bill of residential users. To model user comfort, we have considered three types of appliances, including must run, schedulable having RE storage and schedulable with appliance waiting time limits. Users can select any appliance type according to comfort and energy requirements. However, during low price time intervals, users cannot use more electricity than the given threshold. Therefore, total energy consumption and maximum waiting time for all types of appliances are given as:  
\[ \begin{split} E_{t}=\sum_{t=1}^{tn}\bigg{(}\sum_{i=1}^{n}E_{mr_{(t,i)}}\lambda_{(t,i)}+\sum_{i=1}^{n}E_{ss_{(t,i)}}\lambda_{(t,i)}+\\ \sum_{i=1}^{n}E_{ssd_{(t,i)}}\lambda_{(t,i)}\bigg{)}\geq E_{th}+ \sum_{i=1}^{n}\delta t_{w_{max}}^{n}\lambda_{(t,i)}\end{split}  \tag{13}\]  
The daily electricity cost for all types of appliances can be written as:  
\[C=\sum_{t=1}^{t_{n}}\sum_{i=1}^{n}C_{class_{1}}+C_{class_{2}}+C_{class_{3}}-C_{RE} \tag{14}\]  
where \(C\) denotes the daily electricity cost of all types of appliances and \(C_{class_{1}}\), \(C_{class_{2}}\) and \(C_{class_{3}}\) show the electricity cost of each class, respectively. Electricity cost with a renewable energy source is denoted by \(C_{RE}\). In our proposed scheme, solar plates are used as a renewable energy source, whose capacity is assumed to be 30 kW. It is clear from Equation 14 that the master problem is decomposed into sub-problems. It is also noted that all of the sub-problems discussed in Section 4 are convex in nature,and we can solve these by using any standard optimization technique (heuristic, non-linear, mixed integer non-linear). In order to reduce the electrically bill, energy consumption should also be minimized by considering and satisfying all of the constraints. These types of problems have been a focus of research during the last decade [38,39]. Generally, based on the above model, the cost saving of any number of appliances can be unknown and can take any value within the range \([cost^{min}_{sav},cost^{max}_{sav}]\). Here, we assume that the prudent consumer could desire minimizing the regret of the selected appliances based on the given cost saving scenario. This problem can be formulated by using the robust generalization of the knapsack problem [38]. It is assumed that \(cost_{sav}\) can take any value within the specified limits of each appliance. Let \(s\) be the set of all electricity cost savings \(cost^{s}_{sav_{n}}\) that satisfy the given conditions. \[cost^{s}_{sav_{n}}\in[cost^{min}_{sav},cost^{max}_{sav}]\ \ \forall\ n=[t_{1},t_{2},t_{3},....t_{n}] \tag{15}\]  
Let \(S\) be the set of all possible solutions, _i.e._,  
\[ \begin{split} S=\left\{S=(s_{1},s_{2},s_{3},...s_{n}):\sum_{t=1} ^{t_{n}}\sum_{i=1}^{n}[(E_{(t,i)}x_{(t,i)}\lambda_{(t,i)}\geq E_{th}+\delta t_ {w}^{n})]\right\}\\ \forall\ E\leq C_{t}.\end{split}  \tag{16}\]  
We denote \(z^{s}(i_{n})\) the solution given for scenario \(s\) from solution space \(s\in S\). \[z^{s}(i_{n})=\sum_{t=1}^{t_{n}}\sum_{i=1}^{n}\left[(E^{s}_{(t,i)}x_{(t,i)} \lambda_{(t,i)}\geq E_{th}+\delta t_{w}^{n})\right] \tag{17}\]  
where \(E^{s}_{(t,i)}\) denotes the energy consumption solution set \(s\) of \(i\) appliances, such that [\(s\in S\)]; similarly, the energy consumption of all possible solution sets \(s\), where \([s\in S]\) can be obtained. Let \(z^{*s}(i_{n})\) be the optimal solution of the given set of appliances. The regret \(r^{s}\) associated with a solution \(z^{s}(i_{n})\) by comparing the optimal solution with the given solution is given as:  
\[r^{s}=z^{*s}(i_{n})-z^{s}(i_{n}) \tag{18}\]  
Let \(S_{0}\) be the set of all possible sets of solutions, and the maximum regret \(r_{max}\) is equal to the sum over all possible scenarios. Therefore, to provide the user with the maximum possible benefits, maximum regret must be minimized.