A Real-Time Balancing Market Optimization with Personalized Prices: From Bilevel to Convex

This paper studies the static economic optimization problem of a system with a single aggregator and multiple prosumers in a Real-Time Balancing Market (RTBM). The aggregator, as the agent responsible for portfolio balancing, needs to minimize the cost for imbalance satisfaction in real-time by proposing a set of optimal personalized prices to the prosumers. On the other hand, the prosumers, as price taker and self-interested agents, want to maximize their profit by changing their supplies or demands and providing flexibility based on the proposed personalized prices. We model this problem as a bilevel optimization problem. We first show that the optimal solution of this bilevel optimization problem can be found by solving an equivalent convex problem. In contrast to the state-of-the-art Mixed-Integer Programming (MIP)-based approach to solve bilevel problems, this convex equivalent has very low computation time and is appropriate for real-time applications. Next, we compare the optimal solutions of the proposed personalized scheme and a uniform pricing scheme. We prove that, under the personalized pricing scheme, more prosumers contribute to the RTBM and the aggregator's cost is less. Finally, we verify the analytical results of this work by means of numerical case studies and simulations.


Introduction
In recent years, the increase in the penetration of Distributed Energy Resources (DER)s at the demand side has drastically changed the structure of our power system.
As a result, the old passive households, which only consumed energy, found a more active role with the help of the demand side generation. The new term prosumer was introduced in the energy community to represent this transition for households [1].
The emergence of prosumers calls for a new real-time market structure in contrast to the existing day ahead and intraday markets. Since output power of many DERs is volatile due to their intrinsic environmental dependency, planning for supply and demand matching needs to be done as close as possible to real-time to keep the system stable and economically efficient. Therefore, a Real-Time Balancing Market (RTBM) [2] that incorporates available unused capacity of prosumers' controllable DERs and flexible loads, which together we denote here as controllable Active Demand and Supply (ADS) units, should be developed to address the supply volatility by incentivizing prosumers.
Currently, there is only an ex-post financial settlement procedure in the Netherlands and most of Europe, and no actual or physical real-time balancing occurs [3]. Communication infrastructure in the new paradigm of smart grid [4] facilitates the participation of the prosumers with controllable ADS units in an RTBM. Moreover, to prevent direct interaction of the prosumers with higher level agents in the market and aggregate them, a market participant, the aggregator, has been introduced [5]. The aggregators have different roles in different market structures.
The goal of an aggregator in an RTBM is to optimize its operational costs for balancing by incentivizing the prosumers to utilize their unused assets. There are many approaches which an aggregator can employ to steer its associated prosumers to an optimal operation point [6]. One of the most popular approaches is to consider the aggregator as a leader, who can anticipate the reaction of the prosumers, proposes some prices to the following prosumers such that their reactions would be optimal for the aggregator. This price incentive oriented setup falls into the category of bilevel optimization problems [7] and Stackelberg games [8], where the lower level problems and the upper level problem are the problems related to the prosumers and the aggregator, respectively.
The bilevel and Stackelberg game modeling of the aggregator and prosumers' interactions have been studied extensively in the literature [9][10][11][12][13][14][15]. Two different pricing schemes have been proposed to incentivize prosumers in the aforementioned studies. The uniform pricing scheme is an incentivization scheme where the aggregator proposes the same price to all of the prosumers [9,10]. In the other pricing, i.e., the personalized pricing scheme, the aggregator proposes a unique price to each prosumer in order to reach its goal [12,13,16]. While these two pricing schemes have been considered in different works interchangeably and it is argued that the personalized pricing scheme has some benefits over uniform pricing scheme, there exists no research which provides rigorous mathematical proofs on the differences between these two schemes.
Moreover, the state-of-the-art approach to solve these types of bilevel optimization problems is to solve them as Mixed-Integer Programming (MIP)s [9,17,18]. However, implementing the mentioned setup in real-time requires very fast computations. The time intervals for a real-time balancing market can often be as low as 5 minutes [19].
Therefore, the solution for each interval has to be computed and executed within seconds or even less. While papers like [20] have studied the computational efficiency of the bilevel optimization correspond to generating firms strategic offering by introducing a convex relaxation, to the best of our knowledge, no study addressed the computation time for the prosumers/aggregator setup with personalized prices for a high number of prosumers.
It should be noted that, although the algorithms in [14] and [16] are distributed, their efficiency are not guaranteed for large problems and real-time applications.
In contrast to the above works, here we stick to a simple model for the aggregator and prosumers interaction with personalized pricing scheme to analyse the corresponding bilevel optimization problem in a fundamental and tractable mathematical way. Although our model is simple, we keep the essence of these market models and most of the results in this paper can be generalized to more complicated and realistic models.

Contributions:
We present a bilevel optimization problem to model the interactions between self-interested aggregator and prosumers in an RTBM. A personalized pricing scheme by the aggregator is proposed to incentivize the prosumers to participate in this market. Bilevel problems, in general, are non-convex [21]. We first prove that the global optimal solution of this bilevel optimization problem can be found by solving a convex equivalent problem. This convex equivalent formulation has two main advantages. On the one hand, it guarantees global optimality. On the other hand, a convex formulation is attractive in real-time applications with high number of prosumers since the other approaches to solve bilevel optimization problems (e.g., MIP-based approach) are not computationally efficient. Afterwards, we compare the optimal solution of the proposed model with personalized prices to a uniform pricing scheme. We prove that the personalized pricing scheme leads to a less cost for the aggregator and under this pricing scheme more prosumers contribute to the balancing market. Preliminary results of this work are partially presented in the extended abstract [22]. In contrast to the abstract, this paper considers a more general model for the prosumer and provides theoretical proofs for the results. Also, in this paper we compare uniform and personalized pricing schemes in different aspects.
The paper is organized as follows. Section 2 explains the prosumers/aggregator interaction model in a real-time balancing market and introduces the bilevel problem. In Section 3, we show that the bilevel optimization problem is equivalent to a certain convex problem. The analytical comparison of the optimal solution of the proposed personalized pricing scheme and a uniform pricing scheme is presented in Section 4. The efficiency of the proposed method is illustrated by means of simulations in Section 5. Section 6 concludes the paper. The proofs of some theoretical results are presented in Appendix A.

Problem formulation
In this section, we formulate the static bilevel economic optimization problem of an aggregator and its portfolio for participation in an RTBM. While this paper is devoted to investigate a single time-step, the proposed scheme can also be applied for dynamic cases with multiple time-steps. The general structure of this market is as follows. Each aggregator has a set of prosumers under contract and each prosumer is on a contract with only one aggregator. There are many types of aggregators in an electricity market. In this paper, we consider a commercial aggregator which also acts as a Balance Responsible Party (BRP) [23]. Therefore, the aggregator here is also responsible for balancing its portfolio. To do so, the aggregator receives a real-time price from the Transmission System Operator (TSO), who usually has the highest role in the market hierarchy, and incentivizes the prosumers with personalized prices to supply or consume more or less based on that. The change in each prosumer electrical energy supply or demand in a time interval is referred as flexibility. Next, we explain the problem setting and market structure in detail. uncontrollable supply units. Throughout this paper, we assume that each prosumer has a modular mCHP and HP as its controllable ADS units and it might have a solar panel or wind turbine as an uncontrollable one. Each prosumer heat demand is also assumed to be flexible by considering a loss of comfort factor, that is, it is willing to consume more or less heat if its loss of comfort is compensated by the aggregator. Since heat is an output for both mCHP and HP, prosumers are able to alter their controllable ADS units output level to participate in the balancing market.
Due to the uncertain nature and volatility of both the uncontrollable DERs and the prosumers demand, there could be a mismatch between the pre-planned supply and demand schedules in the real-time. To balance this mismatch and to participate in the RTBM, the aggregator incentivizes the prosumers with personalized prices [24] in a centralized way to consume or supply more energy using their controllable ADS units. Before providing a precise mathematical formulation, we elaborate on some technical notions.
The aggregator is in up-regulation if its prosumers' demand is lower than its supply.
Similarly, the aggregator is in down-regulation if the demand is higher than the supply for its prosumers. Likewise, the TSO is in up-regulation if the total system demand is lower than the total system generation. Otherwise, it is in down-regulation. Based on these definitions, we distinguish the following four cases: Case 1. The aggregator and the TSO both are in up-regulation: The aggregator needs to pay the TSO to take care of its excess supply or it can incentivize the prosumers with mCHP to generate less and the prosumers with HP to consume more.   In both Case 2 and Case 4 the solution for the optimal strategy of the aggregator is trivial: sell the requested flexibility to the TSO. However, in Case 1 and Case 3 the aggregator needs to find a trade-off between the possible options for the optimal strategy. In the following subsection, we focus on modeling Case 1 and Case 3 as a bilevel optimization problem.

The prosumers/aggregator model
We consider both the aggregator and the prosumer as self-interest agents. The aggregator tries to minimize its cost to settle the imbalance and the prosumer's goal is to maximize its revenue and minimize its cost and discomfort by altering its demand or supply given the personalized price proposed by the aggregator.
We consider one aggregator and n prosumers each has one HP and mCHP. For all i ∈ N = {1, 2, . . . , n}, we denote the proposed personalized price by the aggregator to the ith prosumer by x i and the prosumer i's HP and mCHP optimal flexibility response by y i1 and y i2 , respectively. Accordingly, we reserve the subscripts i1 and i2 to denote the parameters of the ith prosumer's HP and mCHP, respectively. To model both Case 1 and Case 3, we employ the following optimization problem for each prosumer: max yi1,yi2 where m i1 , m i2 > 0 are the maximum available flexibility, b i1 and b i2 are the prices of providing flexibility and f i (y i1 , y i2 ) is the discomfort function for prosumer i. In this translate the flexibility provision to heat increase/decrease [25]. Note that in both Case 1 and Case 3, the HP and mCHP's heat outputs due to flexibility provision change in the opposite direction. For instance, in Case 1, the aggregator rewards the prosumer to increase its HP consumption and decrease its mCHP generation. This leads to more heat generation for the HP and less for the mCHP. Therefore, we have employed minus sign in the discomfort function definition. Next, we elaborate further on the model and parameters.
In (1a), the first term corresponds to the received payment by the prosumer i from the aggregator. The second term models the discomfort of the prosumer i for providing flexibility y i1 and y i2 . Finally, the last two terms capture the amount prosumer i can save or the cost it should pay with respect to the intraday market plannings for providing flexibility y i1 and y i2 .
The parameter b i1 for the prosumer's HP in both the aggregator up-regulation (Case 1) and down-regulation (Case 3) is as follows: −π e if aggregator in down-regulation, Likewise, for the prosumer's mCHP this parameter is defined as follows: where c i is dependent on the mCHP technology of the prosumer i and is given by and π e ≥ 0 and π g ≥ 0 are fixed electricity and gas prices charged by the electricity and gas suppliers, respectively.
Further, we define the maximum available flexibility m i1 and m i2 as follows. For prosumer i, let P i1 and P i2 denote the input electrical power to an HP device and the output electrical power of an mCHP device, respectively. Also, let P max  flexibility of the prosumer i's HP is given by where ∆t is the duration of each time step for the RTBM and assumed to be equal to 300 seconds in this paper. Similarly, we define m i2 for a prosumer's mCHP as follows: As the agent responsible for supply and demand balancing in the RTBM, the aggregator has two options to accomplish its goal, namely, to incentivize the prosumers for flexibility provision with the associated cost of x i y i = x i (y i1 + y i2 ) or to buy flexibility from the TSO with the price p > 0. The aggregator's problem is to find the best strategy given these two options.
Considering the above model, bounds on the proposed price x i and also the prosumers' optimality conditions, we obtain the bilevel optimization problem (2) which has the problem (1) as a constraint for each prosumer: where x and y are vectors with components x i and y i , respectively. Also, f > 0 denotes the mismatch between supply and demand in both up-and down-regulation. If the flexibility provided by the prosumers is i∈N y i then, the aggregator needs to trade (f − i∈N y i ) with the TSO. Figure 1 shows these interactions. To guarantee a minimum profit for each prosumer and to prevent a high aggregator's payoff, we impose the nonnegative lower and upper boundsρ andρ on the aggregator's proposed price x i . We consider an ex-ante pricing scheme, that is, the TSO informs the aggregator about the price p prior to the start of each 5-minute interval.
These types of bilevel problems and markets have a strong connection with Stackelberg games [8], where a leader announces a policy to its followers and then the followers, who are unaware of the outside world, react by their best response strategy. In other words, the leader has the advantage of anticipating the followers reactions. A full investigation of such a market in a game-theoretic framework can be found in [14].
In the setup we consider in this paper, the aggregator's goal is to satisfy its internal imbalance in real-time. However, in other possible settings beyond the scope of this paper, helping the TSO to satisfy the total system imbalance can also be a goal for the aggregator. Therefore, in that setting the problem formulation for Case 1 and Case 3 is given by (2) without considering (2c). In this situation, if i∈N y i −f ≤ 0, the aggregator pays p(f − i∈N y i ) to the TSO and if i∈N y i − f > 0, then the aggregator receives p(f − i∈N y i ) from the TSO for providing flexibility.

The bilevel market optimization problem with personalized prices and its solution
The model above for the aggregator and the prosumers interactions is very close to the bilevel electricity market models in [9,12,13], where different market technicalities have been considered. Furthermore, we restrict our model to a static case. Despite these differences, our model captures the basic properties of a bilevel market.
The aforementioned studies have used two pricing schemes, i.e., the uniform pricing scheme and the personalized pricing scheme interchangeably. However, none of these studies has investigated the optimal solution of the optimization problems with these two pricing scheme in a rigorous mathematical way. In the following two sections, we first show that under the personalized pricing scheme the optimal solution of the bilevel optimization problem can be found by solving an equivalent convex optimization problem.
Then, we elaborate on the optimal solution of the bilevel problem with the personalized pricing in contrast to the optimal solution of the same problem with uniform pricing scheme.

On the solution of the bilevel electricity market problem with the personalized pricing scheme
In general, bilevel optimization problems are very difficult to solve. They have been extensively studied in the framework of Mathematical Programming with Equilibrium Constraints (MPEC). We refer to [21] for a full investigation of MPECs. The simplest case of a bilevel optimization problem is when both the upper and lower level problems are linear. Even in this simplest case, [26] has shown that the problem is strongly NP-hard.
Some classes of bilevel optimization problems can be reformulated as MIP problems and solved by commercial software packages [27]. This approach has been extensively used to solve electricity market optimization problems as a state-of-the-art approach [17], [18]. In this section, we elaborate on a convex equivalent of the the problem (2). It should be emphasized that we are not seeking for an algorithm to solve the problem (2). The contribution here is to introduce a convex reformulation for the bilevel problem (2).
Having a convex equivalent enables us to solve the problem using any algorithm available in the commercial software packages and find the global optimal solution. In what follows, we first show that the bilevel optimization problem (2)  can be found using a convex equivalent problem.

From bilevel to single-level
Given x i the optimization problem (2e) is a convex optimization problem. Therefore, one can rewrite (2e) as its necessary and sufficient KKT conditions Here µ i1 and ν i1 are the dual variables for the lower bound and upper bound on y i1 , respectively. Likewise, µ i2 and ν i2 are the dual variables for the lower bound and upper bound on y i2 , respectively. Having (3), let us rewrite the bilevel optimization problem (2) as the following single-level optimization problem: i∈N Since the KKT conditions are necessary and sufficient for (2e), the next results immediately follows.
Proof. See Appendix A.
In the next subsections, we focus on the optimization problem (4) as the equivalence of (2).

ADS device activation
In the previous section, we have built a model based on the fact that each prosumer can have both HP and mCHP. However, modeling both types of ADS devices might not always be necessary as formalized in the following lemma.
Then, the following statements hold.
That is the ith prosumer's mCHP does not provide flexibility in down-regulation.
That is the ith prosumer's HP does not provide flexibility in up-regulation.
Proof. See Appendix A.
Motivated by the lemma above, hereafter, we assume that each prosumer has either an HP or mCHP. Therefore, (4e) can be rewritten as Note that to ease the notation, we have dropped 1 and 2 in the subscripts related to each prosumer since it only has one ADS device. Solving the parametric linear complementarity problem (5) analytically leads to the following piece-wise linear map from x i to (y i , µ i , ν i ): This allows us to rewrite the optimization problem (4) as the following piece-wise quadratic optimization problem:

On the convexity of single-level optimization problem
Here, we elaborate on the solution of the optimization problem (7). It turns out under some specific conditions, the optimization problem (7) has trivial optimal solution for some i ∈ N . The following lemma investigates these specific conditions.   Lemma 3. Consider the optimization problem (7). Then, the following statements hold.
Proof. See Appendix A.
The above lemma shows that if b i >ρ orρ > a i m i + b i for some i ∈ N , we can find the optimal solutions without solving any optimization problem. Then, the following question arises immediately: What if none of the conditions in Lemma 3 holds? This question is answered by the following example and the results after that.
Motivated by this example, we consider the following convex quadratic problem by It appears that a global minimum of the nonconvex problem (7) can be found by solving the convex problem (8).
Then, there exists an optimal solution x * , y * , µ * and ν * for (7) such that µ * = ν * = 0 and the same x * and y * are also the minimizers of the convex quadratic problem (8).
Proof. See Appendix A. Theorem 7. Consider the optimization problem (7). Then, and x * i , y * i for all i ∈ θ are the minimizers of the following convex problem: Proof. The proof for the optimal solutions of the subsets α and β immediately follows from Lemma 3. Eliminating this trivial solutions, the proof for the minimizers of indices in θ follows from Lemma 5.
Another advantage of using the convex optimization problem (11) over the bilevel one stems from privacy considerations. Indeed, the aggregator needs to have all information about the prosumers to the bilevel problem in a centralized way. However, the prosumers may not be willing to share their information with third parties due to privacy concerns.
Since Theorem 7 allows a distibuted solution to find the optimum (see [28]), such privacy concerns are not an obstacle for solving the problem (8) or (11).

Personalized pricing vs. Uniform pricing
In the setup we have considered so far in this work, a personalized pricing scheme is implemented. This means that the aggregator proposes different prices to each prosumer to minimize its cost. However, in another scenario, one can consider a uniform pricing scheme where the aggregator proposes the same price to all the prosumers [9]. These two pricing schemes are very well-known in microeconomics literrature [29]. In what follows, we investigate the advantages of personalized pricing over uniform pricing in the defined balancing market. For this purpose, we first (re)write the problems for these schemes.
The optimization problem PP corresponds to the personalized pricing scheme: PP : min Note that this is a reformulation of the problem (7). For simplicity, we consider the parameterρ equal to zero, although all the following analyses can be verified for arbitrarȳ ρ. Similar to the problem above, we define the problem UP for the uniform pricing scheme.
Here all the proposed prices to the prosumers are equal and it is denoted by the scalar decision variable x: UP : min One of the main benefits of the personalized pricing scheme is that it leads to a lower or equal balancing cost. The next proposition states this advantage.
Proposition 8. The aggregator's optimal cost in the personalized pricing scheme is less than or equal than its optimal cost in the uniform pricing scheme, i.e., Proof. One can rewrite the problem (13) by replacing x by x i and add an extra constraint as Therefore, the feasible set of the problem UP is a subset of the feasible set of the problem PP. This concludes that φ * PP ≤ φ * UP .
Having a less balancing cost for the aggregator is not the only superior aspect of the personalized pricing scheme. The next proposition shows that under this pricing scheme more prosumers contribute to the balancing market.
Proposition 9. Let n PP (N ) and n UP (N ) be the number of prosumers who participate in the personalized and uniform pricing scheme, respectively. Then, n UP (N ) ≤ n PP (N ).
To prove the proposition above, we need some auxiliary results. The following lemmas concerning the optimization problems PP and UP play an essential role in the proof of Proposition 9.
Lemma 10. Consider the optimization problems PP and UP. Then the following two statements hold.
Then, the optimal solution y * i is positive for both problems.
II) Let b i >ρ for some i ∈ N . Then, the optimal solution y * i is zero for both problems.
Proof. See Appendix A.
Lemma 11. Consider the optimization problem PP. Suppose that 0 ≤ b i ≤ρ for all Proof. See Appendix A.
Lemma 11 provides a sufficient condition for contribution of each prosumer in the personalized pricing scheme, whereas the next one provides a necessary condition for contribution of each prosumer in the uniform pricing scheme.
Lemma 12. Consider the optimization problem UP. Suppose that 0 ≤ b i ≤ρ for all i ∈ N . Also, suppose the sets γ = {i ∈ N | y * i > 0} andγ = {i ∈ N | y * i = 0} are given. Then, p > b i for all i ∈ γ.

Proof. See Appendix A.
Remark 13. Note that in Lemma 12, (p − b i ) is sign-indefinite for i ∈γ. Therefore, we can argue that there existsγ such that N ⊇γ ⊇ γ and p > b i for all i ∈γ. Now, we are in a position to prove Proposition 9.
Proof of Proposition 9. Define the set, Due to Lemma 10, n PP (α) = n UP (α) = |α| and n PP (θ) = n UP (θ) = 0. Now, suppose that n UP (β) is given. Then, based on Lemma 12, p > b i holds for all i ∈γ whereγ is defined in Remark 13. As a result, due to Lemma 11, n PP (β) ≥ n UP (β). Consequently, we have n PP (N ) ≥ n UP (N ). The profit of a single prosumer in the personalized pricing scheme might be higher or lower than its profit in the uniform pricing scheme. Nonetheless, Proposition 9 states that the chance of participation of a prosumer and having revenue in the balancing market is higher in the personalized scheme.

Simulations
In this section, first we evaluate the performance of our convex equivalent problem for the RTBM in terms of computation time and optimality. We use the state-of-theart MIP-based approach in [27] as a benchmark for this evaluation. Next, we compare the aggregator's cost and prosumers' contribution under two schemes: personalized and uniform pricing.
For simulation purposes, we consider one type of HP and two types of mCHP technologies for the prosumers. We assume that half of the prosumers have HP and the other half are equipped with mCHP. We assign to each prosumer a specific technology of HP or mCHP, randomly. Tables 1 and 2 show the data regarding these types and also their corresponding |b i | parameters. The supplier gas and electricity prices are based on data from [30] for the Netherlands and equal to 0.0861 e/kWh and 0.1707 e/kWh, respectively. The price p for both up-and down-regulation is set to 0.7 e/kWh based on the settlement price data of TenneT from [31] for a period where the TSO is under high stress. It should be noted that the TSO informs the aggregators about this price ex-ante.
All optimization problems are implemented in MATLAB r2018b and solved by the Gurobi Optimizer [32]. The simulations were run on four Intel Xeon 2.6 GHz cores and 1024 GB internal memory of the Peregrine high performance computing cluster of the University of Groningen.
Details of this approach can be found in [27].
The MIP solvers use complicated heuristic methods to find the optimal solution. Moreover, the computation time for computing an optimal solution is highly related to specific parameters of the problem. To find a rough estimate of the optimization run time, we implement a set of 1000 Monte Carlo simulations with uniformly generated random parameters a i , m i and f for the optimization problem. This is done for different numbers of prosumers. Table 3 summarizes the run time results for these Monte Carlo scenarios.
The last column of this table shows the number of scenarios (out of 1000 Monte Carlo scenarios) where the MIP problem leads to an infeasible solution or an optimal solution with higher cost than the convex problem.
The computation time for the convex optimization problem grows approximately linear with respect to the number of prosumers. This can be seen from the average run time in Table 3 for the convex formulation. If we consider 30000 as the typical number of prosumers for an aggregator, then the average and the maximum run time are acceptable for a real-time application with 5-minute time interval. However, this is not the case for an MIP formulation. Figure 3 and Table 3 show that the average and maximum computation time of MIP is not suitable for a real-time market since the computational time grows approximately exponentially. Moreover, there are some cases that the MIP formulation with high number of optimization variables does not converge to the global optimal or even to feasible solution. This is shown on the last column of Table 3. For instance, for 10-prosumer case, both the MIP and convex formulation have the same optimal solution in all 1000 random scenarios. Nevertheless, in 30000-prosumer case, the MIP formulation converges to a higher minimum cost or an infeasible solution with respect to the convex formulation in 40 out of 1000 random scenarios of the simulations. It is clear that in the rest 960 scenarios both the formulations have the same optimal solution.

Pricing schemes comparison
This subsection is devoted to show the validity of Proposition 8 and 9. We consider a case where the aggregator and TSO are in down regulation. The total number of prosumers is assumed to be 5 and all are equipped with mCHPs. The full details of prosumers' parameters are presented in Table 4. The requested flexibility f is 0.05 kWh.  The results for both pricing schemes are demonstrated in Table 5.
The optimal results in Table 5 shows that all prosumers contribute to the balancing market under the personalized pricing scheme. However, in the uniform pricing scheme, only the prosumer number 3, 4 and 5 provide flexibility. Furthermore, the aggregator's optimal cost in the personalized pricing scheme is less than its optimal cost in the uniform pricing scheme. Indeed, this is inline with what is claimed in Section 4.

Conclusions
In this paper, we have developed a market with a TSO, an aggregator and prosumers to address real-time balancing. We have modeled the corresponding economic optimization problem of a self-interested aggregator and prosumers as a bilevel optimization problem under a personalized pricing scheme. Generally, bilevel optimization problems are nonconvex. We have shown that it suffices to solve a specific convex optimization problem  Also, we have compared the optimal solutions for two pricing scheme, i.e., personalized and uniform pricing scheme. We have shown, in a rigorous mathematical way, that under the personalized pricing scheme more prosumers contribute to the balancing market and the aggregator's optimal cost is less.
III: The proof is similar to that of the previous statement.
Proof of Lemma 3.
I: Since b i >ρ, for any feasible x i such thatρ ≥ x i ≥ρ, we can write b i >ρ ≥ x i ≥ρ.
Therefore, x i < b i . Then, based on the objective function (7a) and the constraint (7d) , we can conclude that Then, based on (7d), we can Proof of Lemma 5. We consider two cases. Note that since m i > 0, µ i and ν i cannot be nonzero at the same time.
Case 1) Suppose, for the sake of contradiction, x * i , y * i , µ * i and ν * i be the only optimal solution of the problem (7) and µ * i > 0 and ν * i = 0. Since x * i , y * i , µ * i and ν * i are an optimal solution and hence are feasible, they should satisfy the constraints of the problem (7), .i.e.ρ ≤ x * i ≤ρ, We definex i = x * i + µ * i = b i and consequently we havē Proof of Lemma 11. Since 0 ≤ b i ≤ρ for all i ∈ N , based on Lemma 5, µ * i = ν * i = 0 for all i ∈ N in (12). Suppose, for the sake of contradiction, there exists j ∈ N such that y * j = 0 and x * j = b j . We can leave out the constraints corresponding to the index j from the problem (12). As a result, the following optimization problem has the same optimizer: where xi−bi ai = y i . This optimization problem is convex. Therefore, the optimizer of this problem satisfies the KKT conditions. We write the KKT conditions of this problem for the index j as follows: Having x * j = b j , we conclude b j = p which is a contradiction since b i < p for all i ∈ N .
As a result, the next optimization problem has the same optimizer as (13).
Then, we have the following results.
• Let j ∈ γ 1 and k ∈ γ 1 \ {j}. Since ω is positive, we can conclude from (A.5) and (A.6) We multiply p > 2b j − χ by and we multiply p > 2b k − χ for all k ∈ γ 1 \ {j} by By adding these inequalities together, we have p > b j .
• Let j ∈ γ 2 . Due to (A.5) and (A.7), we have Since χ is a weighted average of the elements of the set {b i | i ∈ γ 1 }, there exists k ∈ γ 1 such that b k ≥ χ. Also, since k ∈ γ 1 , we have p > b k . Therefore,