1. Introduction
With the substantial advancements in the global energy transition and the explosive growth of power-consuming devices, the relationship between the supply and demand sides of electric power is undergoing profound restructuring. Meanwhile, the increasing integration of renewable energy sources, such as wind and solar power, has significantly changed the operational characteristics of power systems. Due to the intermittent and uncertain nature of renewable generation, higher renewable energy penetration increases operational uncertainty and the pressure of maintaining supply–demand balance, and may even lead to renewable energy curtailment [
1,
2]. Moreover, the large-scale integration of renewable energy poses greater challenges to electricity market operation and pricing mechanisms [
3,
4]. Therefore, more flexible pricing mechanisms and active demand-side participation are required to effectively accommodate the fluctuations of renewable energy resources. In the traditional model, fixed electricity prices are always adopted, which gives consumers no economic incentive to shift their usage away from peak hours, resulting in a sharp rise in peak loads and idle resources during off-peak periods and thus providing no price-based guidance for consumers to adjust their usage patterns. In contrast, smart grids, supported by advanced digital information networks, enable two-way real-time interaction between power suppliers and consumers; i.e., consumers can adjust their electricity usage in response to dynamic prices, while suppliers can optimize generation based on demand signals, thereby forming a flexible, price-driven regulatory closed loop [
5,
6,
7,
8].
Power demand response management is central to the operational efficiency of smart grids. Real-time pricing (RTP) is widely recognized as the most economically efficient mechanism, as it can accurately reflect the instantaneous marginal cost of supply and demand in forward-looking transactions [
9,
10,
11]. Existing studies on RTP in smart grids mainly fall into three categories.
The first is the social welfare maximization model (SWMM), which achieves social optimality by maximizing the difference between total consumer utility and total power supply cost, with the shadow price serving as the real-time price [
12,
13,
14,
15]. Li et al. [
14] formulated a constrained optimization model for commercial users, used a smoothing cosh function to replace the KKT complementarity conditions, and proposed a smoothing Newton algorithm. Gao [
15] determined the electricity price as the Lagrange multiplier of the SWMM and examined the role of the lower bound of power supply, verifying that the simplified model remains applicable to the online dual method.
The second category adopts a game-theoretic perspective. Since electricity markets involve multiple self-interested participants, including power generation companies, grid operators, and end-users, whose decisions are mutually dependent and strategically interconnected, game theory provides a natural framework for characterizing interactions among market participants. By modeling competitive and cooperative behaviors under dynamic pricing mechanisms, game-theoretic approaches can effectively describe market equilibrium and participants’ responses to price signals [
16]. In this framework, the relationship between suppliers and consumers is reconstructed as one between equal decision-makers under a “game equilibrium” framework, thereby aligning distributed individual rationality with centralized social welfare through price signals [
17,
18,
19,
20]. Zhang et al. [
17] considered a supplier and multiple residential consumers, establishing a nested game model with a Stackelberg game between the supplier and the user group and an evolutionary game among users. Dai et al. [
19] constructed a multi-leader–follower Stackelberg game model based on RTP, where retailers maximize profits and users compete for optimal consumption, and solved for the Stackelberg equilibrium via Lagrange multipliers.
The third category leverages artificial intelligence, employing reinforcement learning and deep learning to handle high-dimensional uncertainties and complex user behaviors, representing the most cutting-edge direction [
21,
22,
23,
24]. Wang et al. [
21] proposed a bilevel RTP model where the upper level maximizes supplier profit using Q-learning and the lower level optimizes each user’s consumption via a Markov decision process. Liu et al. [
24] preprocessed data with weighted grey relational projection, improved a bidirectional LSTM model with an attention mechanism, and combined it with XGBoost using reciprocal error weighting.
However, to the best of our knowledge, most existing studies focus on improving overall operational efficiency and tend to overlook the balance of demands among multiple stakeholders. A sustained decline in any party’s welfare may affect its willingness to participate, thereby posing potential challenges to the long-term robustness and sustainable development of the system. Moreover, the convergence of some heuristic algorithms such as particle swarm optimization and genetic algorithms often depends on parameter settings and problem structures, and always lack unified theoretical guarantees. To address these issues, a real-time pricing model for multi-type users in smart grids based on the load–utility equilibrium is proposed. The upper-level model is oriented toward social equity, aiming to narrow the welfare gap among power generation enterprises, grid companies, and consumers, thereby promoting fairness in interest distribution. The lower-level model is designed to improve the economic efficiency of the system, with the objective of maximizing total social welfare, which includes power generation costs, grid operation costs, and users’ utility from electricity consumption. The two layers of the model are coupled through electricity price variables, together forming a preliminary framework for collaborative interest optimization. To solve this constrained bi-level programming problem, the KKT conditions are adopted. Based on these, the model is transformed into an equivalent single-level optimization model with smooth equality constraints. Furthermore, the CHKS smoothing function and the pseudo-Huber function are introduced to handle the complementarity conditions and the absolute value objective, respectively, and a modified rolling penalty function algorithm is developed for numerical solution. Finally, simulation results support the feasibility of the proposed model and algorithm to some extent.
Table 1 summarizes the differences between the existing literature and this study in terms of research scope and methodology.
The contributions of this paper are as follows:
- (1)
A tripartite welfare equilibrium model is proposed, involving power plants, the grid company, and end-users. In this model, the upper-level problem minimizes the absolute welfare gaps among the three parties to ensure fairness, while the lower-level problem maximizes the total social welfare.
- (2)
Differentiated utility functions for residential and industrial users are incorporated into the proposed bilevel tripartite framework to characterize user heterogeneity, thereby enhancing the practicality and adaptability of the pricing strategy.
- (3)
The bilevel programming problem is transformed into a single-level optimization problem with complementarity constraints using the Karush–Kuhn–Tucker (KKT) conditions. Smoothing functions and the pseudo-Huber function are employed to handle the complementarity conditions and the absolute-value objective, respectively. Furthermore, a modified rolling penalty function algorithm incorporating a central-difference scheme is developed to solve the resulting single-level problem, and the existence and uniqueness of the solution are proved.
- (4)
Simulation results demonstrate that the proposed model significantly reduces the welfare gaps among the three parties while maintaining the total social welfare almost unchanged. It effectively lowers the peak-to-average load ratio, thereby achieving peak shaving and valley filling. Compared with the traditional social welfare maximization model (SWMM), the proposed approach exhibits superior performance in terms of fairness of benefit distribution and long-term system stability.
The outline of the paper is as follows. In
Section 2, an equilibrium model is constructed based on the two-tier planning framework. In
Section 3, the two-layer planning is transformed into an equivalent single-layer optimization problem via the KKT condition. In order to approximate the complementarity condition associated with the KKT condition, a smoothing function is constructed, which further transforms the original two-layer planning into a single-layer optimization problem containing the smoothing equation. In
Section 4, a modified rolling penalty function algorithm is proposed to solve the converted equivalent single-lever optimization problem. In
Section 5, the simulations show the effectiveness of the proposed algorithm and model.
2. System Model
Consider a smart power system comprising an electricity supplier, a grid company, and several users. Suppose the power supply and all users are connected with each other through an information communication infrastructure. Divide the whole cycle into periods and let as the set of users requiring electricity, where is the set of residential users, is the set of industrial users, and is the power consumption demand of residential users and industrial users at time slot of the i- users respectively. Denote as the capacity for residential user, as the generation capacity of industrial user, and as the total generation capacity at the slot t.
2.1. User Model
In smart grid systems, electricity consumers constitute the core entities on the demand side. According to microeconomics, consumer electricity usage behavior can be characterized by a corresponding utility function. Denoting this utility function as , it possesses the following properties:
- (i)
The utility function is nondecreasing, i.e.,
- (ii)
The marginal utility is decreasing, i.e.,
In economics, utility functions are typically employed to measure the degree of satisfaction consumers derive from the consumption of goods or activities. The utility function
examined herein takes electricity demand
x as its independent variable, serving to characterise the quantitative relationship between electricity consumption and user utility. Specifically, this paper consider two types of utility functions: for residential users, we adopted the utility function, namely [
22]
and for commercial users, we adopted the utility function, namely [
25]
where
are non-negative parameters describing the distinct electricity preference types of different users;
are pre-determined constants characterizing the saturation properties of the utility function.
Based on the user utility function for time slot
t, the user’s benefit function at the time slot
t is obtained and expressed as follows:
where
and
denote the purchase prices for residential and commercial users respectively.
2.2. Grid Company Model
In smart grid systems, the grid company serves as the intermediary entity connecting the electricity supply side with the demand side. It formulates real-time electricity tariffs based on the consumption patterns of the demand side, which constitutes both a key mechanism for maintaining the supply–demand equilibrium of the power system and the primary source of revenue for the grid company. Consequently, the revenue function of the grid company during time period t can be calculated based on the electricity consumption of various user categories and the corresponding tariffs during that period, as expressed in the following equation:
where
and
denote the procurement prices of the electricity company.
2.3. Electricity Supplier Model
Define as the electricity supplier’s generation cost, representing the cost of supplying electricity in the t-th time period, subject to two assumptions:
- (i)
The cost function is strictly increasing;
- (ii)
The cost function is strictly convex.
Thus, functions satisfying these conditions include piecewise linear functions and quadratic functions. To simplify the objective function solution, a quadratic function is adopted here as the electricity supplier’s cost function, namely
where
and
are the generation cost parameters, and
and
.
Electricity suppliers generate revenue by setting corresponding purchase prices based on the grid company’s procured electricity volume. Therefore, the revenue function for electricity suppliers at time period
t is as follows:
2.4. Welfare Equilibrium Model of Real-Time Electricity Price
Reference [
27] established a social welfare maximization model (SWMM) based on the utility benefits of all entities within the power grid system. Solving this model yields the optimal electricity consumption for users across all time intervals. Furthermore, by designing and solving the corresponding Lagrange multiplier, the corresponding real-time electricity prices can be obtained. Consequently, it has been widely applied in research on real-time electricity pricing for smart grids. The model is as follows:
As shown in Equation (
4), while the traditional social welfare maximization model achieves overall maximization of user utility and minimization of production costs, it fails to address the issue of revenue equilibrium among users, grid companies, and electricity suppliers.
Figure 1 summarizes the overall research workflow and technical route of this paper, including bilevel pricing model formulation, equivalent transformation, algorithm design and simulation verification.
3. RTP Formulation and the Equivalent Single-Level Optimization
The above analysis demonstrates that while real-time electricity pricing mechanisms based on social welfare maximization models can achieve optimal overall social welfare, they struggle to ensure balanced welfare distribution among the three parties within the power system: consumers, grid operators, and electricity suppliers. From an operational perspective, simultaneously minimizing welfare disparities among these three parties and maximizing overall social welfare in real-time pricing optimization is crucial for maintaining the long-term stability and coordinated development of the power system. Therefore, this section proposes a bi-level equilibrium model based on the social welfare maximization model.
In the proposed bi-level equilibrium model, the upper-level structure minimizes welfare differences among the three parties, while the lower-level structure maximizes social welfare. The formula is as follows:
Consider each period
, the model (
5) can be expressed as an optimization:
The lower-level problem is a concave function with linear constraints. According to convex optimization theory, this constitutes a convex programming problem. Therefore, we may utilize the Karush–Kuhn–Tucker (KKT) conditions to transform the original bi-level problem into a single-level optimization problem [
28]. The KKT conditions for the lower-level problem are as follows:
Replacing lower-level with Equation (
7), the primal bilevel programming problem is transformed into the following single-level optimization problem:
The above transforms the primal bilevel programming into a single-level optimization problem (
8). However, there are complementary conditions in the constraint (
7). According to the nonlinear complementary theory [
29], they are equal to non-smooth equations, which makes problem (
8) difficult to solve. In order to lower the difficulty to solve the optimization problem, smooth functions are constructed to approximate the complementary conditions in Equation (
7), and then problem (
8) is transformed into a single-level optimization with only smooth equality constraints.
First, owing to
where
Next, smooth functions are used to approximate the equation. Consider the CHKS smoothing function [
30] of the “min” function such that
where
is a very small positive number,
, and the function has a strongly Jacobian consistency. Ref. [
30] demonstrates the strong Jacobian consistency of the smooth function CHKS.
The smooth approximation of function
with different values of parameter
is shown in
Figure 2.
Here,
denotes the CHKS smoothing function, and we set
and
respectively. It can be intuitively observed from
Figure 2 that the smoothing function
exhibits favorable convergence performance and gradually approximates
as parameter
decreases.
Let
Replacing Equation (
7) with
, Equation (
7) is turned into the equivalent smooth equations as follows:
Substituting Equation (
9) for Equation (
7), problem (
8) is transformed into the following optimization with only smooth equality constraints:
The objective function in problem (
10) is an absolute value function, which is non-smooth. Here, we adopted the pseudo-Huber function as the smoothing one of the absolute value function [
31,
32]. It is such that
where
is the positive smoothing parameter. For all
, it has properties as follows.
- (i)
is continuously differentiable everywhere;
- (ii)
;
- (iii)
The approximation error is bounded, i.e., .
The smooth approximation of function
with different values of parameter
is shown in
Figure 3.
Here,
denotes the pseudo-Huber smoothing function, and we set
and
respectively. It can be intuitively observed from
Figure 3 that the smoothing function
exhibits favorable convergence performance and gradually approximates
as parameter
decreases.
Substituting the pseudo-Huber function into problem (
10), we obtain the transformed formulation as follows.
4. Rolling Penalty Function Algorithm
In this section, we give a modified rolling penalty function algorithm for problem (
12).
Denote
and
as the constraint condition for the problem (
12).
Then, we construct the penalty function corresponding to problem (
12) as follows:
We next present the following theorem, which characterizes the relationship between the smoothed and original problems under the above assumptions.
Theorem 1.
Let be the smoothing penalty function of problem (12) with CHKS () and pseudo-Huber () smoothing functions. is the penalty function of the non-smooth single-level problem (8)’ they are bounded on , and . Then, it holds thatwhere is a constant independent of . Further, if is the optimal solution of ε of , it is the optimal solution of of . Proof. According to the above description, the penalty functions of the non-smooth problem (
8) and the smooth problem (
11) are respectively:
where
denotes the original objective function containing absolute values,
represents the objective function smoothed by the pseudo-Huber function,
refers to the original complementarity constraint, and
denotes the equality constraint smoothed via the CHKS smoothing method.
By virtue of the triangle inequality,
By the smooth approximation property of the pseudo-Huber function, there exists a constant
such that
By virtue of the complementarity constraint approximation property of the CHKS smoothing function, the constraint function is uniformly bounded over the feasible region. Hence, there exists a constant
such that
Let
; then, for any
, we have
and, taking the minimum with respect to
z, we obtain
Suppose that
satisfies
; then
and thus
is a
-optimal solution to the original problem. □
Remark 1.
Theorem 1 above proves that the error between the optimal value of the penalty function after dual smoothing with CHKS and pseudo-Huber functions and that of the original non-smooth penalty function can be uniformly controlled by the smoothing parameters μ and η. Meanwhile, it indicates that the approximate optimal solution of the smoothed problem can serve as the approximate optimal solution to the original non-smooth problem. This provides a theoretical convergence guarantee for transforming the non-smooth bilevel optimization problem into a numerically solvable smooth single-level optimization problem.
We now propose the following rolling penalty function method as follows.
Remark 2.
Algorithm 1, developed here, is similar to the rolling penalty function algorithm reported in [33]. Nevertheless, for gradient computation, we adopt the central difference approximation, as elaborated in Step 2 of Algorithm 1. Such a modification endows the algorithm with higher computational accuracy, smaller numerical errors, and stronger numerical stability throughout the iterative solution process. Accordingly, the convergence property and robustness of the overall optimization algorithm are effectively improved. | Algorithm 1: Rolling Penalty Function Method |
Step 0 Initialization. Choose parameters tolerance , penalty factor multiplier , smoothing coefficient , initial penalty factor , choose initial point , set , , , tolerance . Step 1 Stopping criterion. If , then stop; otherwise, go to Step 2. Step 2 Gradient update. Compute:
where is the unit vector, h represents the step size of central difference. Step 3 Set the step size. The step size is determined using the following formula as the line search rule. Step 4 Convergence Check. If , set , return to Step 5; otherwise, set , go to Step 2. Step 5 Update penalty factors. Set , return to Step 1. |
The convergence of the algorithm is obvious by virtue of Ref. [
34]; we present the global convergence theorem and local convergence theorem below.
Theorem 2
(Global convergence). Let be a global minimizer of , where the penalty parameters are monotonically increasing to infinity. Then, every limit point of the sequence is a global minimizer of the original problem.
Theorem 3
(Local convergence)
. Let the objective function and the constraint functions () be continuously differentiable. Let be a positive sequence such that and . In Algorithm 1, the solution to the unconstrained optimization problem satisfies Moreover, for any limit point of , the setis linearly independent. Then is a KKT point of the equality-constrained optimization problemandwhere is the Lagrange multiplier corresponding to the constraint . Here, denotes the quadratic penalty function: 5. Numerical Evaluation
In this section, simulation is conducted to demonstrate the effectiveness of the proposed RTP scheme.The numerical experiments are conducted in MATLAB R2023a on a AMD Ryzen 7 5700U with Radeon Graphics and 16 GB RAM.
Considering the smart grid system in a small area, we present numerical simulation results within a 24 h time pattern as an evaluation of daily operations. The system comprises an electricity supplier, a grid company, six residential users, and two commercial users. Residential users’ electricity demand
is randomly selected from the interval [2, 6], where
. Commercial users’ electricity demand
is randomly selected from the interval [5, 10], where
. In the utility function,
and
, the cost function employs parameters
and
[
13,
26]. The initial electricity purchase prices from the grid company for residents are set as
and
, whilst the grid company’s purchase prices from suppliers are set as
and
. Additionally, the initial electricity supply quantities are
and
. To improve the accuracy of the experimental results, all numerical experimental results in this section are averaged from ten independent replicate runs.
First, we verify the iterative convergence performance of the proposed algorithm for the pricing model, as shown in
Figure 4. In the early stage of iteration, the real-time electricity price of each time slot fluctuates sharply. As the iteration continues, the price fluctuation gradually weakens and the range narrows, and the price eventually converges steadily to a unique equilibrium price.
Figure 5 illustrates the procurement and retail electricity prices for residential and commercial users over a 24 h period. The left-hand figure shows the prices at which residential and commercial users purchase electricity from the grid company, while the right-hand figure presents the prices at which the grid company procures electricity from power generation plants.
Figure 6 presents the peak-to-average ratio (PAR) for both models. Shown as 1, 2, and 3 are the PAR values for residential users, commercial users, and the total PAR within the bilevel model. Then, 4, 5, and 6 represent the PAR values for residential users, commercial users, and the total PAR within the SWMM model. It is evident that the PAR values for our bilevel model are lower than those for SWMM, indicating that our model effectively reduces peak-period loads.
Figure 7 and
Figure 8 illustrate the benefits to electricity suppliers, grid companies, and users, and the overall societal benefit under both the bilevel model and SWMM. The numerical results demonstrate that the differences in benefits among electricity suppliesr, grid companies, and users are smaller in the bilevel model than in SWMM, while the overall societal benefit gap between the two models is negligible. This demonstrates that the bilevel model not only achieves a more balanced distribution of benefits among the electricity suppliers, grid companies, and users, but also maintains overall societal benefits to a certain extent. Consequently, it promotes a fairer allocation of interests among all societal stakeholders, thereby fostering the long-term healthy development of society.
Figure 9,
Figure 10 and
Figure 11 present the comparison results of power plant welfare, power utility welfare, user welfare and total social welfare between the bilevel model and the SWMM model, in a scenario expanded to 30 residential users and three commercial users. The results show that, with the enlarged user scale, the welfare of power plants and power utilities under the bilevel model both increase compared with the SWMM model, while user welfare decreases slightly. This effectively narrows the welfare gap among the three stakeholders. In addition, the total social welfare of the two models is generally close. It demonstrates that the bilevel model achieves welfare equilibrium among multiple participants of the power system while maintaining a stable level of total social welfare.
6. Conclusions
In this paper, we consider the inherent trade-off between equitable benefit allocation and operational efficiency in real-time electricity pricing for power systems involving generators, grid operators, and end-users. To tackle the drawbacks of traditional pricing mechanisms—including skewed benefit distribution across stakeholders and potential social welfare inefficiencies—we develop a bilevel optimization framework for real-time price setting that centers on tripartite equilibrium coordination. The upper-tier model is designed to minimize inter-stakeholder welfare inequity to uphold distributional fairness, whereas the lower-tier model optimizes total social welfare to preserve the economic viability of the power system. Through the incorporation of KKT optimality conditions, smoothing approximation techniques, and a penalty function-based solution algorithm, the intractable bilevel optimization problem is reformulated into a numerically solvable single-level program. Empirical simulations confirm that the proposed pricing framework substantially reduces benefit disparities among the three core participants while preserving the overall level of social welfare, thus enhancing the fairness and stability of the electricity market. However, the present study is constrained to a single-source power supply configuration and does not incorporate the complexities of multi-source power systems, such as the integration of distributed energy resources and multi-agent competitive dynamics. Additionally, practical implementation faces additional challenges while new-type power systems continue to evolve with increasing penetration of renewable energy and more complex grid operations. The uncertainty introduced by wind and solar power, along with physical constraints such as transmission losses, voltage drops, and equipment wear and tear in real-world grids, may affect the performance of the proposed equilibrium model. Therefore, we will extend our framework by incorporating renewable energy uncertainty and grid physical constraints to enhance its applicability and robustness in practical power systems in our future work.