scieee AI-readable full text Open interactive document viewer

A real-time balancing market optimization with personalized prices: From bilevel to convex

Shomalzadeh, Koorosh,Scherpen, Jacquelien M. A.,Camlibel, Kanat

Abstract

EconStor is a publication server for scholarly economic literature, provided as a non-commercial public service by the ZBW.

Full text

Shomalzadeh, Koorosh; Scherpen, Jacquelien M. A.; Camlibel, Kanat Article A real-time balancing market optimization with personalized prices: From bilevel to convex Operations Research Perspectives Provided in Cooperation with: Elsevier Suggested Citation: Shomalzadeh, Koorosh; Scherpen, Jacquelien M. A.; Camlibel, Kanat (2023) : A real-time balancing market optimization with personalized prices: From bilevel to convex, Operations Research Perspectives, ISSN 2214-7160, Elsevier, Amsterdam, Vol. 10, pp. 1-10, https://doi.org/10.1016/j.orp.2023.100276 This Version is available at: https://hdl.handle.net/10419/325762 Standard-Nutzungsbedingungen: Die Dokumente auf EconStor dürfen zu eigenen wissenschaftlichen Zwecken und zum Privatgebrauch gespeichert und kopiert werden. Sie dürfen die Dokumente nicht für öffentliche oder kommerzielle Zwecke vervielfältigen, öffentlich ausstellen, öffentlich zugänglich machen, vertreiben oder anderweitig nutzen. Sofern die Verfasser die Dokumente unter Open-Content-Lizenzen (insbesondere CC-Lizenzen) zur Verfügung gestellt haben sollten, gelten abweichend von diesen Nutzungsbedingungen die in der dort genannten Lizenz gewährten Nutzungsrechte. Terms of use: Documents in EconStor may be saved and copied for your personal and scholarly purposes. You are not to copy documents for public or commercial purposes, to exhibit the documents publicly, to make them publicly available on the internet, or to distribute or otherwise use the documents in public. If the documents have been made available under an Open Content Licence (especially Creative Commons Licences), you may exercise further usage rights as specified in the indicated licence. https://creativecommons.org/licenses/by/4.0/ Operations Research Perspectives 10 (2023) 100276 Available online 21 April 2023 2214-7160/© 2023 The Author(s). Published by Elsevier Ltd. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/). Contents lists available at ScienceDirect Operations Research Perspectives journal homepage: www.elsevier.com/locate/orp A real-time balancing market optimization with personalized prices: From bilevel to convex Koorosh Shomalzadeh a,∗, Jacquelien M.A. Scherpenb, M. Kanat Camlibela aJan C. Willems Center for Systems and Control, Bernoulli Institute for Mathematics, Computer Science and Artificial Intelligence, Faculty of Science and Engineering, University of Groningen, Nijenborgh 9, 9747 AG, Groningen, The Netherlands bJan C. Willems Center for Systems and Control, Engineering and Technology Institute Groningen, Faculty of Science and Engineering, University of Groningen, Nijenborgh 4, 9747 AG, Groningen, The Netherlands ARTICLE INFO Keywords: Real-Time Balancing Market (RTBM) Convex optimization Bilevel optimization Flexibility management Personalized pricing ABSTRACT 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. 1. 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 realtime balancing occurs [3]. Communication infrastructure in the new ∗Corresponding author. E-mail addresses: [email protected] (K. Shomalzadeh), [email protected] (J.M.A. Scherpen), [email protected] (M.K. Camlibel). 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. https://doi.org/10.1016/j.orp.2023.100276 Received 26 October 2022; Received in revised form 16 February 2023; Accepted 10 April 2023 Operations Research Perspectives 10 (2023) 100276 2 K. Shomalzadeh et al. The bilevel and Stackelberg game modeling of the aggregator and prosumers’ interactions have been studied extensively in the literature [9–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 5min [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,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 analyze 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 2explains 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 6concludes the paper. The proofs of some theoretical results are presented in Appendix. 2. 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 timestep, 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. Prosumers are equipped with various kinds of ADS units. They consist of two prominent categories, namely controllable and uncontrollable units. Micro Combined Heat and Power (mCHP) units and Heat Pump (HP) units are examples of controllable active supply and demand units of electricity, respectively. Output generation of units such as solar cells and wind turbines is dependent on environmental conditions. Thus these are 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. Case 2. The aggregator is in up-regulation and the TSO is in downregulation: The TSO pays the aggregator for its excess supply. Case 3. The aggregator and the TSO both are in down-regulation: The aggregator needs to pay the TSO to provide supply or it can incentivize the prosumers with mCHP to generate more and the prosumers with HP to consume less. Case 4. The aggregator is in down-regulation and the TSO is in upregulation: The TSO pays the aggregator to consume more. Operations Research Perspectives 10 (2023) 100276 3 K. Shomalzadeh et al. 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. 2.1. 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 𝑛prosumers each has one HP and mCHP. For all 𝑖∈𝑁= {1,2,…, 𝑛}, we denote the proposed personalized price by the aggregator to the 𝑖th prosumer by 𝑥𝑖and the prosumer 𝑖’s HP and mCHP optimal flexibility response by 𝑦𝑖1and 𝑦𝑖2, respectively. Accordingly, we reserve the subscripts 𝑖1and 𝑖2to denote the parameters of the 𝑖th prosumer’s HP and mCHP, respectively. To model both Case 1 and Case 3, we employ the following optimization problem for each prosumer: max 𝑦𝑖1,𝑦𝑖2 𝑥𝑖(𝑦𝑖1+𝑦𝑖2)−(𝑓𝑖(𝑦𝑖1, 𝑦𝑖2) + 𝑏𝑖1𝑦𝑖1+𝑏𝑖2𝑦𝑖2)(1a) subject to 0 ≤𝑦𝑖1≤𝑚𝑖1,(1b) 0≤𝑦𝑖2≤𝑚𝑖2,(1c) where 𝑚𝑖1, 𝑚𝑖2>0are the maximum available flexibility, 𝑏𝑖1and 𝑏𝑖2 are the prices of providing flexibility and 𝑓𝑖(𝑦𝑖1, 𝑦𝑖2)is the discomfort function for prosumer 𝑖. In this work, we consider 𝑓𝑖(𝑦𝑖1, 𝑦𝑖2) = 1 2(√𝑎𝑖1𝑦𝑖1−√𝑎𝑖2𝑦𝑖2)2where the parameters √𝑎𝑖1,√𝑎𝑖2translate 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 𝑖from the aggregator. The second term models the discomfort of the prosumer 𝑖for providing flexibility 𝑦𝑖1and 𝑦𝑖2. Finally, the last two terms capture the amount prosumer 𝑖can save or the cost it should pay with respect to the intraday market plannings for providing flexibility 𝑦𝑖1and 𝑦𝑖2. The parameter 𝑏𝑖1for the prosumer’s HP in both the aggregator up-regulation (Case 1) and down-regulation (Case 3) is as follows: 𝑏𝑖1={𝜋𝑒if aggregator in up-regulation, −𝜋𝑒if aggregator in down-regulation, Likewise, for the prosumer’s mCHP this parameter is defined as follows: 𝑏𝑖2={−𝑐𝑖𝜋𝑔if aggregator in up-regulation, 𝑐𝑖𝜋𝑔if aggregator in down-regulation, where 𝑐𝑖is dependent on the mCHP technology of the prosumer 𝑖and is given by 𝑐𝑖=nominal input power nominal electricity output power, and 𝜋𝑒≥0and 𝜋𝑔≥0are fixed electricity and gas prices charged by the electricity and gas suppliers, respectively. Further, we define the maximum available flexibility 𝑚𝑖1and 𝑚𝑖2as follows. For prosumer 𝑖, let 𝑃𝑖1and 𝑃𝑖2denote the input electrical power to an HP device and the output electrical power of an mCHP device, respectively. Also, let 𝑃max 𝑖1and 𝑃max 𝑖2denote the maximum electrical Fig. 1. A general overview of interactions for the aggregator, the prosumers and the TSO in the RTBM. power for prosumer 𝑖’s ADS devices. Then, the maximum available flexibility of the prosumer 𝑖’s HP is given by 𝑚𝑖1={(𝑃max 𝑖1−𝑃𝑖1)𝛥𝑡 if aggregator in up-regulation, 𝑃𝑖1𝛥𝑡 if aggregator in down-regulation, where 𝛥𝑡 is the duration of each time step for the RTBM and assumed to be equal to 300 s in this paper. Similarly, we define 𝑚𝑖2for a prosumer’s mCHP as follows: 𝑚𝑖2={𝑃𝑖2𝛥𝑡 if aggregator in up-regulation, (𝑃max 𝑖2−𝑃𝑖2)𝛥𝑡 if aggregator in down-regulation. 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 𝑥𝑖𝑦𝑖=𝑥𝑖(𝑦𝑖1+𝑦𝑖2)or to buy flexibility from the TSO with the price 𝑝 > 0. The aggregator’s problem is to find the best strategy given these two options. Considering the above model, bounds on the proposed price 𝑥𝑖 and also the prosumers’ optimality conditions, we obtain the bilevel optimization problem (2) which has the problem (1) as a constraint for each prosumer: min 𝑥,𝑦 𝜙(𝑥, 𝑦) = ∑ 𝑖∈𝑁 𝑥𝑖𝑦𝑖+𝑝(𝑓−∑ 𝑖∈𝑁 𝑦𝑖)(2a) subject to  𝜌≤𝑥𝑖≤𝜌, ∀𝑖∈𝑁, (2b) 𝑦𝑖=𝑦𝑖1+𝑦𝑖2,∀𝑖∈𝑁, (2c) ∑ 𝑖∈𝑁 𝑦𝑖≤𝑓, (2d) ⎧ ⎪ ⎪ ⎨ ⎪ ⎪ ⎩ max 𝑦𝑖1,𝑦𝑖2 𝑥𝑖(𝑦𝑖1+𝑦𝑖2)−(𝑓𝑖(𝑦𝑖1, 𝑦𝑖2) + 𝑏𝑖1𝑦𝑖1+𝑏𝑖2𝑦𝑖2) subject to 0 ≤𝑦𝑖1≤𝑚𝑖1, 0≤𝑦𝑖2≤𝑚𝑖2, ∀𝑖∈𝑁, (2e) where 𝑥and 𝑦are vectors with components 𝑥𝑖and 𝑦𝑖, respectively. Also, 𝑓 > 0denotes the mismatch between supply and demand in both upand down-regulation. If the flexibility provided by the prosumers is ∑𝑖∈𝑁𝑦𝑖then, the aggregator needs to trade (𝑓−∑𝑖∈𝑁𝑦𝑖)with the TSO. Fig. 1 shows these interactions. To guarantee a minimum profit for each prosumer and to prevent a high aggregator’s payoff, we impose Operations Research Perspectives 10 (2023) 100276 4 K. Shomalzadeh et al. the nonnegative lower and upper bounds  𝜌and 𝜌 on the aggregator’s proposed price 𝑥𝑖. We consider an ex-ante pricing scheme, that is, the TSO informs the aggregator about the price 𝑝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 ∑𝑖∈𝑁𝑦𝑖−𝑓≤0, the aggregator pays 𝑝(𝑓−∑𝑖∈𝑁𝑦𝑖)to the TSO and if ∑𝑖∈𝑁𝑦𝑖−𝑓 > 0, then the aggregator receives 𝑝(𝑓−∑𝑖∈𝑁𝑦𝑖)from the TSO for providing flexibility. 2.2. 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. 3. 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]. An aggregator can have up to several thousands of prosumers under its contract. To implement an RTBM with 5-minute time intervals, the optimal solution of the problem (2) should be found as fast as possible. The increase in the number of the optimization variables, as a result of the growth in the number of the prosumers, leads to an unacceptable computation time in real-time applications for combinatorial optimization problems such as MIP problems. In this section, we elaborate on a convex equivalent of 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) is equivalent to a single level optimization problem. Then, we prove that under sufficient conditions only one of the ADS devices of each prosumer becomes active in the RTBM. Consequently,we consider the problem of one device per prosumer and show that the solution of the new problem can be found using a convex equivalent problem. 3.1. From bilevel to single-level Given 𝑥𝑖the optimization problem (2e) is a convex optimization problem. Therefore, one can rewrite (2e) as its necessary and sufficient KKT conditions: 𝑎𝑖1𝑦𝑖1−√𝑎𝑖1𝑎𝑖2𝑦𝑖2+𝑏𝑖1−𝑥𝑖−𝜇𝑖1+𝜈𝑖1= 0, −√𝑎𝑖1𝑎𝑖2𝑦𝑖1+𝑎𝑖2𝑦𝑖2+𝑏𝑖2−𝑥𝑖−𝜇𝑖2+𝜈𝑖2= 0, 0≤𝑦𝑖1⟂𝜇𝑖1≥0,0≤𝑚𝑖1−𝑦𝑖1⟂𝜈𝑖1≥0, 0≤𝑦𝑖2⟂𝜇𝑖2≥0,0≤𝑚𝑖2−𝑦𝑖2⟂𝜈𝑖2≥0. (3) Here 𝜇𝑖1and 𝜈𝑖1are the dual variables for the lower bound and upper bound on 𝑦𝑖1, respectively. Likewise, 𝜇𝑖2and 𝜈𝑖2are the dual variables for the lower bound and upper bound on 𝑦𝑖2, respectively. Having (3), let us rewrite the bilevel optimization problem (2) as the following single-level optimization problem: min 𝑥,𝑦,𝜇,𝜈 𝜙(𝑥, 𝑦) = ∑ 𝑖∈𝑁 𝑥𝑖𝑦𝑖+𝑝(𝑓−∑ 𝑖∈𝑁 𝑦𝑖)(4a) subject to  𝜌≤𝑥𝑖≤𝜌, ∀𝑖∈𝑁, (4b) 𝑦𝑖=𝑦𝑖1+𝑦𝑖2,∀𝑖∈𝑁, (4c) ∑ 𝑖∈𝑁 𝑦𝑖≤𝑓, (4d) ⎧ ⎪ ⎪ ⎨ ⎪ ⎪ ⎩ 𝑎𝑖1𝑦𝑖1−√𝑎𝑖1𝑎𝑖2𝑦𝑖2+𝑏𝑖1−𝑥𝑖−𝜇𝑖1+𝜈𝑖1= 0, −√𝑎𝑖1𝑎𝑖2𝑦𝑖1+𝑎𝑖2𝑦𝑖2+𝑏𝑖2−𝑥𝑖−𝜇𝑖2+𝜈𝑖2= 0, 0≤𝑦𝑖1⟂𝜇𝑖1≥0,0≤𝑚𝑖1−𝑦𝑖1⟂𝜈𝑖1≥0, 0≤𝑦𝑖2⟂𝜇𝑖2≥0,0≤𝑚𝑖2−𝑦𝑖2⟂𝜈𝑖2≥0, ∀𝑖∈𝑁. (4e) Since the KKT conditions are necessary and sufficient for (2e), the next results immediately follows. Lemma 1. The optimization problem (2) and (4) are equivalent. Proof. See Appendix.□ In the next subsections, we focus on the optimization problem (4) as the equivalence of (2). 3.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. Lemma 2. Consider the optimization problem (4). Suppose that √𝑎𝑖2𝑏𝑖1+√𝑎𝑖1𝑏𝑖2 √𝑎𝑖1+√𝑎𝑖2 > 𝜌. Then, the following statements hold. (I) 𝑦∗ 𝑖1𝑦∗ 𝑖2= 0. (II) If 𝑏𝑖1≤0and 𝑏𝑖2≥0,𝑦∗ 𝑖2= 0. That is the 𝑖th prosumer’s mCHP does not provide flexibility in down-regulation. (III) If 𝑏𝑖1≥0and 𝑏𝑖2≤0,𝑦∗ 𝑖1= 0. That is the 𝑖th prosumer’s HP does not provide flexibility in up-regulation. Proof. See Appendix.□ Operations Research Perspectives 10 (2023) 100276 5 K. Shomalzadeh et al. Motivated by the lemma above, hereafter, we assume that each prosumer has either an HP or mCHP. Therefore, (4e) can be rewritten as 𝑎𝑖𝑦𝑖+𝑏𝑖−𝑥𝑖−𝜇𝑖+𝜈𝑖= 0, 0≤𝑦𝑖⟂𝜇𝑖≥0, 0≤𝑚𝑖−𝑦𝑖⟂𝜈𝑖≥0. (5) Note that to ease the notation, we have dropped 1and 2in 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 𝑥𝑖to (𝑦𝑖, 𝜇𝑖, 𝜈𝑖): (𝑦𝑖, 𝜇𝑖, 𝜈𝑖) = ⎧ ⎪ ⎨ ⎪ ⎩ (0, 𝑏𝑖−𝑥𝑖,0) 𝑥𝑖< 𝑏𝑖, (𝑥𝑖−𝑏𝑖 𝑎𝑖 ,0,0) 𝑏𝑖≤𝑥𝑖≤𝑎𝑖𝑚𝑖+𝑏𝑖, (𝑚𝑖,0, 𝑥𝑖−𝑎𝑖𝑚𝑖−𝑏𝑖)𝑥𝑖> 𝑎𝑖𝑚𝑖+𝑏𝑖. (6) This allows us to rewrite the optimization problem (4) as the following piece-wise quadratic optimization problem: min 𝑥,𝑦,𝜇,𝜈 𝜙(𝑥, 𝑦) = ∑ 𝑖∈𝑁 𝑥𝑖𝑦𝑖+𝑝(𝑓−∑ 𝑖∈𝑁 𝑦𝑖)(7a) subject to  𝜌≤𝑥𝑖≤𝜌, ∀𝑖∈𝑁(7b) ∑ 𝑖∈𝑁 𝑦𝑖≤𝑓, (7c) (𝑦𝑖, 𝜇𝑖, 𝜈𝑖) = ⎧ ⎪ ⎪ ⎨ ⎪ ⎪ ⎩ (0, 𝑏𝑖−𝑥𝑖,0) 𝑥𝑖< 𝑏𝑖, (𝑥𝑖−𝑏𝑖 𝑎𝑖 ,0,0) 𝑏𝑖≤𝑥𝑖≤𝑎𝑖𝑚𝑖+𝑏𝑖, (𝑚𝑖,0, 𝑥𝑖−𝑎𝑖𝑚𝑖−𝑏𝑖)𝑥𝑖> 𝑎𝑖𝑚𝑖+𝑏𝑖, ∀𝑖∈𝑁, (7d) 3.3. 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 𝑖∈𝑁. The following lemma investigates these specific conditions. Lemma 3. Consider the optimization problem (7). Then, the following statements hold. (I) Suppose 𝑏𝑖> 𝜌 for some 𝑖∈𝑁. Then, 𝑥∗ 𝑖∈ [  𝜌, 𝜌],𝑦∗ 𝑖= 0,𝜇∗ 𝑖=𝑏𝑖−𝑥∗ 𝑖 and 𝜈∗ 𝑖= 0. (II) Suppose  𝜌>𝑎𝑖𝑚𝑖+𝑏𝑖for some 𝑖∈𝑁. Then, 𝑥∗ 𝑖=  𝜌,𝑦∗ 𝑖=𝑚𝑖,𝜇∗ 𝑖= 0 and 𝜈∗ 𝑖=𝑥∗ 𝑖−𝑎𝑖𝑚𝑖−𝑏𝑖. Proof. See Appendix.□ The above lemma shows that if 𝑏𝑖> 𝜌 or  𝜌>𝑎𝑖𝑚𝑖+𝑏𝑖for some 𝑖∈𝑁, 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. Example 4. Suppose a two-dimensional case of the problem (7) where 𝑎1=𝑎2= 1,𝑏1=𝑏2= 2,𝑚1=𝑚2= 6,  𝜌= 0,𝜌 = 10,𝑝= 10,𝑓= 30. It is obvious, based on Lemma 3 and the parameters, that this problem has no trivial solutions. Fig. 2 depicts objective function of the problem (7) with these parameters. As can be seen, the objective function is non-convex and consists of several convex quadratic functions. Note that its minimum coincides with the minimum of the convex quadratic problem obtained from (7) by taking 𝑦𝑖=𝑥𝑖−𝑏𝑖 𝑎𝑖 and 𝜇𝑖=𝜈𝑖= 0 with 𝑏𝑖≤𝑥𝑖≤𝑎𝑖𝑚𝑖+𝑏𝑖for 𝑖∈ {1,2}. Motivated by this example, we consider the following convex quadratic problem by taking 𝜇𝑖=𝜈𝑖= 0 for all 𝑖∈𝑁: min 𝑥,𝑦 𝜙(𝑥, 𝑦) = ∑ 𝑖∈𝑁 𝑥𝑖𝑦𝑖+𝑝(𝑓−∑ 𝑖∈𝑁 𝑦𝑖)(8a) subject to  𝜌≤𝑥𝑖≤𝜌, ∀𝑖∈𝑁(8b) ∑ 𝑖∈𝑁 𝑦𝑖≤𝑓, (8c) 𝑦𝑖=𝑥𝑖−𝑏𝑖 𝑎𝑖 , 𝑏𝑖≤𝑥𝑖≤𝑎𝑖𝑚𝑖+𝑏𝑖,∀𝑖∈𝑁. (8d) It appears that a global minimum of the nonconvex problem (7) can be found by solving the convex problem (8). Lemma 5. Assume  𝜌−𝑎𝑖𝑚𝑖≤𝑏𝑖≤𝜌 for all 𝑖∈𝑁. Then, there exists an optimal solution 𝑥∗, 𝑦∗, 𝜇∗and 𝜈∗for (7) such that 𝜇∗=𝜈∗= 0 and the same 𝑥∗and 𝑦∗are also the minimizers of the convex quadratic problem (8). Proof. See Appendix.□ Remark 6. The piece-wise linear constraint (7d) makes the problem (7) a piece-wise quadratic optimization problem with 3𝑛quadratic problems where 𝑛is the number of prosumers. Lemma 5 proves that under the assumption  𝜌−𝑎𝑖𝑚𝑖≤𝑏𝑖≤𝜌 for all 𝑖∈𝑁, one of these 3𝑛 problems always attains the global optimum. Now, we are in a position to state the main results of this paper. Theorem 7. Consider the optimization problem (7). Let 𝛼= {𝑖∈𝑁∣𝑏𝑖> 𝜌},𝛽= {𝑖∈𝑁∣𝑎𝑖𝑚𝑖+𝑏𝑖<  𝜌}and 𝜃= {𝑖∈𝑁∣  𝜌−𝑎𝑖𝑚𝑖≤𝑏𝑖≤𝜌}. Then, 𝑥∗ 𝑖∈ [  𝜌, 𝜌], 𝑦∗ 𝑖= 0,∀𝑖∈𝛼, (9) 𝑥∗ 𝑖=  𝜌, 𝑦∗ 𝑖=𝑚𝑖,∀𝑖∈𝛽, (10) and 𝑥∗ 𝑖, 𝑦∗ 𝑖for all 𝑖∈𝜃are the minimizers of the following convex problem: min 𝑥𝑖,𝑦𝑖 ∀𝑖∈𝜃 𝜙(𝑥, 𝑦) = ∑ 𝑖∈𝜃 𝑥𝑖𝑦𝑖+∑ 𝑖∈𝛽 𝜌𝑚𝑖+𝑝(𝑓−∑ 𝑖∈𝜃 𝑦𝑖−∑ 𝑖∈𝛽 𝑚𝑖)(11a) subject to  𝜌≤𝑥𝑖≤𝜌, ∀𝑖∈𝜃, (11b) ∑ 𝑖∈𝜃 𝑦𝑖≤𝑓−∑ 𝑖∈𝛽 𝑚𝑖,(11c) 𝑦𝑖=𝑥𝑖−𝑏𝑖 𝑎𝑖 , 𝑏𝑖≤𝑥𝑖≤𝑎𝑖𝑚𝑖+𝑏𝑖,∀𝑖∈𝜃. (11d) 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 distributed solution to find the optimum (see [28]), such privacy concerns are not an obstacle for solving the problem (8) or (11). 4. 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 literature [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. Operations Research Perspectives 10 (2023) 100276 6 K. Shomalzadeh et al. Fig. 2. Two-dimensional case example. The optimization problem PP corresponds to the personalized pricing scheme: PP ∶ min 𝑥,𝑦,𝜇,𝜈 𝜙(𝑥, 𝑦) = ∑ 𝑖∈𝑁 (𝑥𝑖−𝑝)𝑦𝑖+𝑝𝑓 (12a) subject to 0 ≤𝑥≤𝜌 ∀𝑖∈𝑁, (12b) ∑ 𝑖∈𝑁 𝑦𝑖≤𝑓, (12c) 𝑦𝑖=𝑥𝑖−𝑏𝑖+𝜇𝑖−𝜈𝑖 𝑎𝑖 ,∀𝑖∈𝑁, (12d) 0≤𝑦𝑖⟂𝜇𝑖≥0,∀𝑖∈𝑁, (12e) 0≤𝑚𝑖−𝑦𝑖⟂𝜈𝑖≥0,∀𝑖∈𝑁. (12f) 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 arbitrary  𝜌. 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 𝑥: UP ∶ min 𝑥,𝑦,𝜇,𝜈 𝜙(𝑥, 𝑦) = ∑ 𝑖∈𝑁 (𝑥−𝑝)𝑦𝑖+𝑝𝑓 (13a) subject to 0 ≤𝑥≤𝜌, (13b) ∑ 𝑖∈𝑁 𝑦𝑖≤𝑓, (13c) 𝑦𝑖=𝑥−𝑏𝑖+𝜇𝑖−𝜈𝑖 𝑎𝑖 ,∀𝑖∈𝑁, (13d) 0≤𝑦𝑖⟂𝜇𝑖≥0,∀𝑖∈𝑁, (13e) 0≤𝑚𝑖−𝑦𝑖⟂𝜈𝑖≥0,∀𝑖∈𝑁. (13f) 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., 𝜙∗ PP ≤𝜙∗ UP. Proof. One can rewrite the problem (13) by replacing 𝑥by 𝑥𝑖and add an extra constraint as 𝑥1=𝑥2=⋯=𝑥𝑛. 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 𝑛PP(𝑁)and 𝑛UP(𝑁)be the number of prosumers who participate in the personalized and uniform pricing scheme, respectively. Then, 𝑛UP(𝑁)≤𝑛PP(𝑁). 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. (I) Let 𝑏𝑖<0for some 𝑖∈𝑁. Then, the optimal solution 𝑦∗ 𝑖is positive for both problems. (II) Let 𝑏𝑖> 𝜌 for some 𝑖∈𝑁. Then, the optimal solution 𝑦∗ 𝑖is zero for both problems. Proof. See Appendix.□ Lemma 11. Consider the optimization problem PP. Suppose that 0≤𝑏𝑖≤ 𝜌 for all 𝑖∈𝑁. If 𝑝>𝑏𝑖, then 𝑦∗ 𝑖>0. Proof. See Appendix.□ 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≤ 𝑏𝑖≤𝜌 for all 𝑖∈𝑁. Also, suppose the sets 𝛾= {𝑖∈𝑁∣𝑦∗ 𝑖>0} and 𝛾 = {𝑖∈𝑁∣𝑦∗ 𝑖= 0} are given. Then, 𝑝>𝑏𝑖for all 𝑖∈𝛾. Proof. See Appendix.□ Remark 13. Note that in Lemma 12,(𝑝−𝑏𝑖)is sign-indefinite for 𝑖∈𝛾. Therefore, we can argue that there exists 𝛾 such that 𝑁 ⊇ 𝛾 ⊇ 𝛾 and 𝑝>𝑏𝑖for all 𝑖∈𝛾. Now, we are in a position to prove Proposition 9. Proof of Proposition 9.Define the set, 𝛼= {𝑖∈𝑁∣𝑏𝑖<0}, 𝛽= {𝑖∈𝑁∣ 0 ≤𝑏𝑖≤𝜌}and 𝜃= {𝑖∈𝑁∣𝑏𝑖> 𝜌}. Due to Lemma 10, 𝑛PP(𝛼) = 𝑛UP(𝛼) = |𝛼|and 𝑛PP(𝜃) = 𝑛UP(𝜃)=0. Now, suppose that 𝑛UP(𝛽) is given. Then, based on Lemma 12,𝑝>𝑏𝑖holds for all 𝑖∈𝛾 where 𝛾 is Operations Research Perspectives 10 (2023) 100276 7 K. Shomalzadeh et al. Table 1 The parameters for different HP technologies. HP type Nominal electricity input power (kW) |𝑏𝑖|(e/kWh) 1 1.1 0.1707 Table 2 The parameters for different mCHP technologies. mCHP type Nominal input power Nominal electricity output power (kW) |𝑏𝑖|(e/kWh) 1 8 1 0.6888 2 4.7 0.8 0.5088 defined in Remark 13. As a result, due to Lemma 11,𝑛PP(𝛽)≥𝑛UP(𝛽). Consequently, we have 𝑛PP(𝑁)≥𝑛UP(𝑁).□ 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. 5. 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-the-art 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 2show the data regarding these types and also their corresponding |𝑏𝑖|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 𝑝for both upand down-regulation is set to 0.7e∕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. Also, we assume that 𝜌 =𝑝= 0.7and  𝜌= 0. 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. 5.1. Computation time and optimality comparison Here, we first define the MIP formulation of the problem (2). This formulation is used as a benchmark to evaluate the computational efficiency of the convex equivalent of the bilevel problem. By introducing dual variables 𝜆1𝑖, 𝜆2𝑖, auxiliary binary variables 𝑧𝑖, 𝑤𝑖and a sufficiently large constant 𝑀, the problem (2) can be turned to an MIP problem as min 𝑤,𝑦,𝑧,𝜆1,𝜆2∑ 𝑖 (𝑎𝑖𝑦2 𝑖+ (𝑏𝑖−𝑝)𝑦𝑖+𝑚𝑖𝜆2𝑖) + 𝑝𝑓 subject to ∑ 𝑖 𝑦𝑖≤𝑓, ⎧ ⎪ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎪ ⎩ 𝑥𝑖=𝑎𝑖𝑦𝑖+𝑏𝑖−𝜆1𝑖+𝜆2𝑖≥0, 𝑥𝑖=𝑎𝑖𝑦𝑖+𝑏𝑖−𝜆1𝑖+𝜆2𝑖≤𝜌, 0≤𝑦𝑖≤𝑀𝑧𝑖, 0≤𝑚𝑖−𝑦𝑖≤𝑀𝑤𝑖, 0≤𝜆1𝑖≤𝑀(1 − 𝑧𝑖), 0≤𝜆2𝑖≤𝑀(1 − 𝑤𝑖), ∀𝑖∈𝑁. Fig. 3. Maximum run time: Convex vs. MIP formulation. 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 𝑎𝑖,𝑚𝑖and 𝑓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. Fig. 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. 5.2. 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 5and all are equipped with mCHPs. The full details of prosumers’ parameters are presented in Table 4. The requested flexibility 𝑓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,4and 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. Operations Research Perspectives 10 (2023) 100276 8 K. Shomalzadeh et al. Table 3 Simulation run time and optimality comparison. Number of prosumers Convex formulation run time MIP formulation run time Number of scenarios with infeasible or non-optimal solution for MIP Average (s) Maximum (s) Average (s) Maximum (s) 10 0.0006 0.0010 0.0016 0.0039 0 100 0.0012 0.0017 0.0032 0.0058 0 1000 0.0038 0.0076 0.0128 0.0371 1 10 000 0.0344 0.0484 0.5548 9.0352 11 20 000 0.0772 0.1231 3.9498 59.1761 27 30 000 0.1161 0.1834 11.1190 161.7937 40 Table 4 The prosumers’ parameters for pricing scheme comparison. Pro. number mCHP type 𝑎𝑖(e/kWh2)𝑏𝑖(e/kWh) 𝑚𝑖(kWh) 1 Type 1 2 0.6888 0.08 2 Type 1 5 0.6888 0.05 3 Type 2 10 0.5088 0.02 4 Type 2 5 0.5088 0.01 5 Type 2 20 0.5088 0.025 Table 5 Optimal price and flexibility: Personalized pricing vs. uniform pricing. Prosumer number Personalized pricing scheme Uniform pricing scheme 𝑥∗ 𝑖(e/kWh) 𝑦∗ 𝑖(kWh) 𝑥∗ 𝑖(e/kWh) 𝑦∗ 𝑖(kWh) 1 0.6944 0.0028 0.5711 0 2 0.6944 0.0011 0.5711 0 3 0.6044 0.0096 0.5711 0.0062 4 0.5588 0.0010 0.5711 0.0100 5 0.6044 0.0048 0.5711 0.0031 Agg. cost (e) 0.0322 0.0335 6. 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 non-convex. We have shown that it suffices to solve a specific convex optimization problem to find the global optimum of the original bilevel optimization problem. In contrast to existing approaches (e.g., MIP), the convex equivalent of the bilevel optimization problem has very low computation time and is therefore preferable in realtime. Low computation time and global optimality are not the only advantages of having a convex equivalent for the bilevel optimization. Centralized aggregator control over the whole community of prosumers can be a difficult task, especially when the number of prosumers is very high. However, having a convex formulation for the balancing problem opens up new horizons in decentralized and distributed control and optimization. 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. CRediT authorship contribution statement Koorosh Shomalzadeh: Conceptualization, Software, Writing – original draft. Jacquelien M.A. Scherpen: Conceptualization, Supervision, Writing – review & editing. M. Kanat Camlibel: Conceptualization, Supervision, Writing – review & editing. Declaration of competing interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. Data availability Data will be made available on request. Acknowledgments This research was funded by the NWO (The Netherlands Organisation for Scientific Research) Energy System Integration project ‘‘Hierarchical and distributed optimal control of integrated energy systems’’ [647.002.002]. Appendix. Proofs of lemmas Proof of Lemma 1.The proof is evident from the fact that the optimization problem (2e) is a convex optimization problem in 𝑦𝑖1and 𝑦𝑖2for any given 𝑥𝑖and the KKT conditions are necessary and sufficient for this problem. □ Proof of Lemma 2.Let 𝑥∗ 𝑖, 𝑦∗ 𝑖1, 𝑦∗ 𝑖2, 𝜇∗ 𝑖1, 𝜇∗ 𝑖2, 𝜈∗ 𝑖1and 𝜈∗ 𝑖2be the optimal solution of the problem (4). I: Suppose, on the contrary, that 𝑦∗ 𝑖1𝑦∗ 𝑖2≠0. Therefore, 𝜇∗ 𝑖1=𝜇∗ 𝑖2= 0 and we have 𝑎𝑖1𝑦∗ 𝑖1−√𝑎𝑖1𝑎𝑖2𝑦∗ 𝑖2+𝑏𝑖1−𝑥∗ 𝑖+𝜈∗ 𝑖1= 0,(A.1) −√𝑎𝑖1𝑎𝑖2𝑦∗ 𝑖1+𝑎𝑖2𝑦∗ 𝑖2+𝑏𝑖2−𝑥∗ 𝑖+𝜈∗ 𝑖2= 0.(A.2) We multiply (A.1) by √𝑎𝑖2and (A.2) by √𝑎𝑖1. By adding these two terms, we get 𝑥∗ 𝑖≥√𝑎𝑖2𝑏𝑖1+√𝑎𝑖1𝑏𝑖2 √𝑎𝑖1+√𝑎𝑖2 , which is a contradiction since 𝑥∗ 𝑖≤𝜌. Therefore, either 𝑦∗ 𝑖1or 𝑦∗ 𝑖2 is zero. II: Since 𝑏𝑖2≥𝑏𝑖1, we have 𝑏𝑖2≥√𝑎𝑖2𝑏𝑖1+√𝑎𝑖1𝑏𝑖2 √𝑎𝑖1+√𝑎𝑖2 > 𝜌. Suppose, on the contrary, that 𝑦∗ 𝑖2>0. Then, based on item I, 𝑦∗ 𝑖1= 0. This point should satisfy the constraints of (4), specifically, 𝑎𝑖2𝑦∗ 𝑖2+𝑏𝑖2−𝑥∗ 𝑖+𝜈∗ 𝑖2= 0, 𝑥∗ 𝑖≤𝜌. The first equality yields to 𝑥∗ 𝑖> 𝑏𝑖2which contradicts 𝑥∗ 𝑖≤𝜌, since 𝑏𝑖2> 𝜌. Therefore, 𝑦∗ 𝑖2= 0. III: The proof is similar to that of the previous statement. □ Proof of Lemma 3. I: Since 𝑏𝑖> 𝜌, for any feasible 𝑥𝑖such that 𝜌 ≥𝑥𝑖≥  𝜌, we can write 𝑏𝑖> 𝜌 ≥𝑥𝑖≥  𝜌. Therefore, 𝑥𝑖< 𝑏𝑖. Then, based on the objective function (7a) and the constraint (7d), we can conclude that 𝑥∗ 𝑖∈ [  𝜌, 𝜌],𝑦∗ 𝑖= 0,𝜇∗ 𝑖=𝑏𝑖−𝑥∗ 𝑖and 𝜈∗ 𝑖= 0.