## 3 Proposed Methodology
### Objective Function Specification for Compensation Optimization  
The aim of compensation optimization is to maximize cost benefit to the DSO, aggregator, and end user as defined by Equations (1)-(3). In this case, maximization of energy cost savings for the DSO will result in increased compensation to the DR aggregator, and consequently, increased reward to the end users for participating in DR programs. The objective function will take the form of a problem in which the DSO operation costs are minimized, while the compensation to the DR aggregator (and consequently the profit to the end users) is maximized. The objective function is described by:  
\[\begin{array}{rl}F_{comp}=&min\left(\sum\limits_{t=1}^{T}c_{t,DSO}\big{(}P_ {\varphi}(\omega,t)\big{)}+\sum\limits_{t=1}^{T}-\big{(}c_{t,AGG}\delta_{comp,AGG}(t)\big{)}\right.\\ &\hskip 142.26378 pt\left.+\sum\limits_{t=1}^{T}-(\delta_{comp,EU}(t)-D_{k,t}) \right),\end{array} \tag{40}\]  
subject to:  
\[0\leq\omega\leq 1\ (\text{DSO reward maximization coefficient}), \tag{41}\]  
\[\omega_{j}\geq 0\ \ (\text{\emph{represents DSO reward to aggregator }}j), \tag{42}\]\[\delta_{comp,AGC}(t),\ \delta_{comp,EUI}(t)\geq 0. \tag{43}\]  
The day-ahead market under the DR program is structured to obtain the aggregator with the most rewarding energy utilization profile using the following steps:  
1. Initialization of DSO savings, aggregator compensation, and end user reward.
2. Estimation of appliance scheduling threshold by each aggregator.
3. Aggregators announce the unit reward schedule for each time slot within the given day.
4. Demand of each user within the aggregator is determined as well as the deviation from reference usage limits specified in (ii) and (iii).
5. The operator announces the total demand for each aggregator cluster.
6. The aggregator with the most cost savings is selected as the winner of the bid and removed from the competition.  
With regard to Step iv, it is necessary to describe a disutility factor [7] which determines the level of deviation of a given appliance from the end user's reference energy level without DR program.  
\[D_{k,t}=I_{k}(d_{k,t}-d_{k,t})^{2}, \tag{44}\]  
where \(D_{k,t}\) is disutility factor of appliance \(k\) at time slot \(t\), \(I_{k}\) is the inelasticity coefficient of appliance \(k\). Usually, \(I_{k}\geq 0\). The closer the value of \(I_{k}\) is to 1, the greater the level of dissatisfaction to the end user. \(d_{k,t}\) is energy demand of appliance \(k\) with DR, \(d_{k,t}\) is energy demand of appliance \(k\) without DR.  
The algorithm for implementing the demand response competition among the five aggregators is optimized using a genetic algorithm (GA), and is detailed in Algorithm 1. The parameter settings for implementing the GA are specified in Table 2.  
```
Start Initialize \(I_{k}\), \(D_{k,t}\), \(r_{DSO,t}\), \(r_{AGG,t}\) and\(r_{EUI,t}\) under no DR program For each aggregator, determine the inelasticity coefficient for all shiftable appliances Determine unit reward vector \((v_{r})\) for each time slot from operator demand vector \((v_{d,O})\) Aggregators calculate the compensation from the objective function Aggregators each send their individual demand vectors \((v_{d,AGG})\) DSO accepts the aggregator with lowest \(v_{d,AGG}\) compared to \(v_{d,O}\) End
```  
**Algorithm 1** Procedure for rewarding the best-performing aggregator by DSO