## 4 Single Level Equivalent Linearization  
In order to obtain a linearized form of the production of \(E_{t,\omega}^{ch}\) and \(\lambda_{t,\omega}^{ch}\), the partial derivative of the Lagrangian function of (10) with respect to primal decision variables is considered. In addition to the constraints explained in (11)-(15), the KKT optimality conditions for the lower-level problem are also taken into account. With considering the dual objective function, the lower-level problem is written as follows [26]:  
\[\underset{\varepsilon_{s}(\xi),\phi(\xi)}{\text{ }Maximize}\underset{s\in S}{\text{ }X_{s}^{0}(\xi)\varepsilon_{s}(\xi)+\phi(\xi)} \tag{16}\] \[\varepsilon_{s0}(\xi)+\phi(\xi)\leq\hat{E}_{t}^{D}\lambda_{t, \omega}^{ch}\] (17) \[\varepsilon_{s}(\xi)+\phi(\xi)\leq\hat{E}_{t}^{D}\lambda_{s,t,\xi},\qquad s=1,2,\dots,S\] (18) \[\varepsilon_{s}(\xi)-\varepsilon_{s^{\prime}}(\xi)\leq\hat{E}_{t}^ {D}K^{s,s^{\prime}}\qquad\forall s,s^{\prime}\in S,s\
eq s^{\prime} \tag{19}\]  
as shown in Figures 3-5, respectively. It should be mentioned that the prices are generated for one week, but to show the prices more accurately, only the prices for one day are shown. Also, the dashed blue lines in the Figures 3-6 show the mean of DA, positive and negative prices and EVs' demand, respectively. In this study, it is assumed that EVs charge with domestic chargers. The battery capacity for each EV is 24 kWh and the charging efficiency is 0.9 and it takes about 4 hours to be charged fully [19]. The amount of energy that each EV requires depends on its driving profile as well as its trip distance. Also, the final state-of-charge of EVs on the operating day is equal to the initial state-of-charge for the next day due to equal net energy exchange over the scheduling horizon [20]. With considering the correlation between EVs' demand and DA prices, the model in [26] is used to generate the EVs' demand scenarios with respect to DA prices. This means each DA scenario provides the EVs' demand scenario that is shown in Figure 6.  
In this figure, the uncertainty in driving behavior and energy requirement from the network is represented by different scenarios. Considering the actual number of scenarios may cause computational problems and too few scenarios may yield inaccuracies. So, a proper scenario reduction algorithm is used to omit the low probable and similar scenarios [27], and seven scenarios remained and are applied to the program as entries.  
The prices offered by the three rival aggregators are also considered. The forecasted errors are generated in the proposed model through different scenarios. The normal distribution function is used to model the forecasting errors as shown in Figure 2[27]. Here, one segment is centered as the predicted mean that is extracted from [30] and two slices are created to forecast errors with standard deviation \(\delta=0.15\)[23].  
Figure 4: Scenarios and mean of positive imbalance price.  
Figure 3: Scenarios and mean of day-ahead price.  
The cost of modeling the reluctance of EV owners to change their aggregator is neglected \((K^{s,s^{\prime}}~{}=~{}0)\) and the initial EVs' demand supplied by all aggregators is generated randomly. The maximum limitation for positive balancing energy is equal to the maximum rate of charging for each EV battery that is 3.6 kWh. The value of \(\alpha\) is 0.95.  
The bi-level stochastic programming problem is formulated as an equivalent MILP problem and solved with CPLEX in the GAMS software environment [31] on a computer with 4 GBs of RAM and Ci5 CPU.