Differential privacy method for P2P electric energy transaction of smart power grid
By constructing a Markov decision model using Bayesian inference and deep reinforcement learning, and adaptively deploying differential privacy noise, the contradiction between privacy protection and market operation utility in traditional methods is resolved, achieving an adaptive optimal balance in P2P electricity trading.
Patent Information
- Application Number
- CN202511847697.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-03-13
AI Technical Summary
Traditional differential privacy methods cannot adapt to the dynamic and complex market environment in P2P electricity trading, leading to a contradiction between the strength of privacy protection and the utility of market operation. They cannot achieve an adaptive optimal balance and cannot identify the impact of key data features on the decision-making of the policy network model.
An attack assessment module is constructed using Bayesian inference technology. Combined with deep reinforcement learning algorithms, a Markov decision model is formed, which adaptively deploys differential privacy noise. The noise injection strategy is optimized through deep reinforcement learning algorithms to achieve adaptive differential privacy protection.
It achieves an adaptive optimal balance between privacy protection and market operation utility in complex and dynamic environments, provides provable robustness guarantees, and avoids the problems of privacy leakage and market distortion in traditional methods.
Smart Images

Figure CN121659359A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart grid information security and privacy protection technology, and in particular to a differential privacy method for P2P electricity trading in smart grids. Background Technology
[0002] To address climate change and the energy crisis, my country is actively building a new power system based on new energy sources. Against this backdrop, the P2P electricity trading model, supporting direct transactions between producers and consumers, has emerged, significantly enhancing market flexibility and the capacity to absorb clean energy. However, this model relies on open networks to transmit sensitive bidding and electricity consumption data, posing serious privacy and security threats. These threats mainly fall into two categories: intrusive direct attacks and non-intrusive indirect inference attacks. While technologies such as blockchain can effectively defend against the former, the latter, due to its high concealment and ease of implementation, has become the most critical privacy threat. Attackers can analyze publicly available market transaction results to reverse-engineer sensitive information such as users' actual bids and electricity demands, thereby enabling malicious bidding and even the planning of physical crimes.
[0003] To defend against inference attacks, differential privacy is considered one of the most effective technical approaches due to its ability to provide provable and mathematically rigorous privacy guarantees. However, when directly applied to dynamic and complex P2P transaction scenarios, it faces a fundamental dilemma of balancing privacy and utility:
[0004] First, traditional methods employ a fixed privacy budget and a uniform noise addition strategy. In P2P transactions, which require continuous, multi-round data releases (such as multi-round bidding and real-time settlement), a fixed budget faces a dilemma: if the initial budget is set too high, while it can ensure the accuracy of data in a single query, the overall level of privacy protection will drop sharply after multiple rounds of queries, ultimately leading to a substantial leakage of user privacy information. Conversely, if a budget is set too low for long-term considerations and excessive noise is added uniformly, although strong privacy protection is achieved, the transaction data in each round will be severely distorted, leading to distorted market clearing prices, failed transaction matching, and a decline in social welfare, seriously affecting the market's economic efficiency and operational stability. This static, unchanging strategy cannot adapt to the dynamic and long-term nature of the transaction process.
[0005] Secondly, traditional methods (such as the Laplace mechanism) typically employ a single noise perturbation strategy. However, the P2P electricity trading market is a highly uncertain environment: renewable energy output is intermittent and volatile, and user electricity demand is random, leading to rapidly changing market conditions (such as supply and demand relationships and price signals). During peak electricity demand and critical periods of supply and demand tension, the power grid requires extremely high data accuracy to ensure the safe and stable operation of the system; adding excessive noise at these times is undoubtedly dangerous. Conversely, during off-peak periods of electricity demand and oversupply, privacy protection can be appropriately strengthened. Traditional single-noise mechanisms lack the ability to perceive and adapt to this multi-state market environment, making it difficult to achieve a contextualized optimal balance between ensuring system safety and protecting user privacy.
[0006] Meanwhile, traditional trading mechanisms based on optimization theory struggle to capture the pursuit of maximizing individual interests by producers and consumers. Traditional differential privacy methods are "blind" when adding noise, failing to identify which data features are crucial to the policy network model's decisions. Aggressive perturbations may disrupt key patterns and correlations within the data, causing the policy network model to learn suboptimal or even incorrect bidding strategies, ultimately suppressing market activity and hindering optimal resource allocation.
[0007] Therefore, there is an urgent need for an adaptive differential privacy method. Summary of the Invention
[0008] To address the aforementioned technical problems, this invention provides a differential privacy method for P2P electricity trading in smart grids, overcoming the limitations of traditional fixed differential privacy mechanisms and achieving an adaptive optimal balance between privacy protection and market operation utility.
[0009] The first aspect of this invention provides a differential privacy method for P2P electricity trading in smart grids, comprising the following steps: Based on the transaction settlement rules and electricity price sensitivity calculation method of the P2P electricity trading platform, global privacy budget parameters, differential privacy noise mechanism and candidate noise injection location set are set. Based on a pre-defined attack threat model, an attack assessment module is constructed using Bayesian inference techniques to obtain a quantified current privacy breach risk score. The problem of adaptive deployment of differential privacy noise is formalized as a Markov decision model, where the state space is a vector containing the current market state, privacy leakage risk score and remaining budget, and the action space is a composite action containing the candidate noise injection position selected in the current trading cycle, the noise intensity parameter based on the set differential privacy noise mechanism, and the privacy budget allocation ratio. Based on the defined Markov decision model, a deep reinforcement learning algorithm is used to train the policy network model to obtain the optimal or near-optimal policy that can adaptively output the candidate noise injection position and intensity according to each vector in the real-time state space. At the start of the trading cycle, each vector in the current state space is input into the trained policy network model to generate noise parameters. After obtaining the noise injection decision through the set differential privacy noise mechanism, noise is injected at the specified position, liquidation is executed, and the market liquidation result is published. At the same time, the corresponding privacy budget is deducted from the global privacy budget parameter. The attack assessment module is used to reassess the privacy risks of the published market clearing results, calculate new privacy leakage risk scores, construct experience samples based on each vector in the current state space, noise injection decisions and corresponding market transaction results, and update the experience dataset; when the pre-set update rhythm or triggering conditions are met, the trained policy network model is adapted and updated online; the steps at the beginning of the transaction cycle and the privacy risk reassessment steps are repeated until the remaining privacy budget reaches the preset threshold condition.
[0010] Optionally, the sensitivity calculation method is as follows: given the P2P electricity trading clearing rules and the range of price values, assuming that only one trading entity's price changes within the allowed range, calculate the maximum possible change in the clearing price, the transaction volume, and the supply-demand convergence curve caused by this change, and use the maximum change as the clearing price sensitivity parameter, the transaction volume sensitivity parameter, and the supply-demand convergence curve sensitivity parameter, respectively.
[0011] Optionally, the differential privacy noise mechanism includes a Laplace mechanism or a Gaussian mechanism. The P2P electricity trading platform system predefines a set of candidate noise injection locations, which includes the settlement price, the electricity volume of a single transaction, and the position of the supply and demand curve parameters.
[0012] Optional attack threat models include passive eavesdropping attacks, differential attacks, and Bayesian back-inference attacks; The attack assessment module establishes a prior probability distribution based on the unknown bid information Bid, calculates the posterior probability distribution, and calculates the privacy leakage risk score based on the information entropy change or the maximum posterior confidence value of the posterior probability distribution. When the privacy leakage risk score exceeds the set risk threshold, it triggers online adaptation and rolling updates of the policy network model and gives a new noise injection decision.
[0013] Optionally, the differential privacy noise adaptive deployment problem is formalized into a Markov decision model, where the reward function is defined as a weighted sum of transaction efficiency, privacy leakage risk, and privacy budget. The weights of transaction efficiency, privacy leakage risk, and privacy budget are determined through parameter search based on historical market data to reflect the operator's trade-off preferences among market utility, privacy risk score, and privacy sub-budget consumption.
[0014] Optionally, the deep reinforcement learning algorithm employs the soft actor commentator algorithm, which trains the policy network model on historical market data or in a simulation environment, enabling the policy network model to adaptively output noise injection location and intensity based on market state, privacy breach risk score, and remaining budget.
[0015] Optionally, after generating noise parameters and obtaining a noise injection decision through the set differential privacy noise mechanism, the noise is injected at the designated location after verification by the safety guardrail, and the liquidation is performed and the market liquidation results are published. Safety barrier verification includes market rule constraint detection and noise boundary detection: when the intensity or location of noise injection causes the liquidation price to deviate from the preset fair range, action projection is automatically executed to limit the noise injection decision within the feasible range; the qualified noise injection decision is applied to the liquidation execution process, and the noise injection intensity, location, global privacy budget consumption, and noise injection decision version information are recorded in the liquidation log for audit traceability.
[0016] Optionally, the market clearing results are used to reassess privacy risks. After calculating a new privacy breach risk score, it is compared with the historical average. When the privacy breach risk score or budget utilization exceeds the threshold, an online adaptive update mechanism is triggered. By storing the latest experience data in the experience replay pool, the policy network model is fine-tuned in small increments or periodically updated until the budget utilization meets the convergence condition.
[0017] A second aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0018] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described method.
[0019] The technical solution provided by the embodiments of the present invention has the following advantages compared with the prior art: This invention provides a differential privacy method for P2P electricity trading in smart grids. During system initialization, it lays a theoretical foundation for subsequent differentiated resource allocation by determining multi-dimensional sensitivity calculation methods, global privacy budget parameters, a differential privacy noise mechanism, and a set of candidate noise injection locations, overcoming the problem of coarse budget allocation caused by traditional single sensitivity settings. The attack assessment module introduces a privacy leakage risk score based on Bayesian inference, which can dynamically assess the degree of privacy leakage from an information theory perspective (such as changes in the information entropy of the posterior probability distribution), realizing a paradigm shift in protection strategies from experience-driven to evidence-driven. By formalizing the noise deployment problem as a Markov decision process and employing advanced deep reinforcement learning algorithms for policy optimization, it can learn near-optimal policies in a high-dimensional state space. This systematically solves the long-standing problem of dynamically balancing privacy utility under strict differential privacy constraints, and its optimization capability surpasses that of traditional methods based on heuristic rules. Ultimately, through online re-evaluation and rolling policy updates, the system achieves continuous environmental adaptability, realizing the transformation from fixed policies to adaptive learning, and providing provable robustness for long-term privacy protection in complex and dynamic environments. Attached Figure Description
[0020] Figure 1 A flowchart of a differential privacy method for P2P electricity trading in smart grids provided in an embodiment of the present invention; Figure 2 This is a flowchart illustrating the strategy model deployment and security guardrail verification provided in this embodiment of the invention. Detailed Implementation
[0021] The following detailed description of a specific embodiment of the present invention is provided in conjunction with the accompanying drawings. However, it should be understood that the scope of protection of the present invention is not limited to the specific embodiment.
[0022] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the technical solution of this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0023] The present invention will be described below through several specific embodiments. To keep the following description of the embodiments clear and concise, detailed descriptions of known functions and components may be omitted. When any component of an embodiment of the present invention appears in more than one drawing, the component may be represented by the same reference numerals in each drawing.
[0024] like Figure 1 As shown, this embodiment of the invention provides a first aspect of a differential privacy method for P2P electricity trading in smart grids, comprising the following steps: Based on the transaction settlement rules and price sensitivity calculation method of the P2P electricity trading platform, global privacy budget parameters, differential privacy noise mechanism, and candidate noise injection location set are defined. System and market parameter configurations are initialized and applied to the smart grid P2P electricity trading platform, whose market settlement adopts a marginal matching mechanism. Specifically, the P2P electricity trading platform system sorts bids from power suppliers and power consumers in ascending and descending order of price, respectively, and matches power suppliers with bids from low to high with power consumers with bids from high to low sequentially until the cumulative matched electricity volume meets market supply and demand balance. The marginal bid at the time of matching is used as the settlement price. To achieve differential privacy protection, global privacy budget parameters and the global sensitivity of key output variables need to be predefined. The global privacy budget parameters satisfy the following constraints:
[0025] , in, For global privacy budget parameters, The failure probability is set based on the global privacy budget parameter per transaction period. t Divided into several sub-budgets, For the first t Sub-budgets allocated per transaction cycle For the first t The probability of failure corresponding to each trading cycle.
[0026] Based on a pre-defined attack threat model, an attack assessment module is constructed using Bayesian inference techniques to quantify privacy breach risks and provide quantifiable feedback signals for subsequent adaptive decision-making. This module simulates the capabilities of potential attackers and obtains a quantified current privacy breach risk score. The problem of adaptive deployment of differential privacy noise is formalized as a Markov decision model, where the state space is a vector containing the current market state, privacy leakage risk score and remaining budget, and the action space is a composite action containing the candidate noise injection position selected in the current trading cycle, the noise intensity parameter based on the set differential privacy noise mechanism, and the privacy budget allocation ratio. Based on the defined Markov decision model, a deep reinforcement learning algorithm is used to train the policy network model to obtain the optimal or near-optimal policy that can adaptively output the candidate noise injection position and intensity according to each vector in the real-time state space. At the start of the trading cycle, each vector in the current state space is input into the trained policy network model to generate noise parameters. After obtaining the noise injection decision through the set differential privacy noise mechanism, noise is injected at the specified position, liquidation is executed, and the market liquidation result is published. At the same time, the corresponding privacy budget is deducted from the global privacy budget parameter. The attack assessment module is used to reassess the privacy risks of the published market clearing results, calculate new privacy leakage risk scores, construct experience samples based on each vector in the current state space, noise injection decisions and corresponding market transaction results, and update the experience dataset; when the pre-set update rhythm or triggering conditions are met, the trained policy network model is adapted and updated online; the steps at the beginning of the transaction cycle and the privacy risk reassessment steps are repeated until the remaining privacy budget reaches the preset threshold condition.
[0027] This invention provides a differential privacy method for P2P electricity trading in smart grids. During system initialization, it lays a theoretical foundation for subsequent differentiated resource allocation by determining multi-dimensional sensitivity calculation methods, global privacy budget parameters, a differential privacy noise mechanism, and a set of candidate noise injection locations, overcoming the problem of coarse budget allocation caused by traditional single sensitivity settings. The attack assessment module introduces a privacy leakage risk score based on Bayesian inference, which can dynamically assess the degree of privacy leakage from an information theory perspective (such as changes in the information entropy of the posterior probability distribution), realizing a paradigm shift in protection strategies from experience-driven to evidence-driven. By formalizing the noise deployment problem as a Markov decision process and employing advanced deep reinforcement learning algorithms for policy optimization, it can learn near-optimal policies in a high-dimensional state space. This systematically solves the long-standing problem of dynamically balancing privacy utility under strict differential privacy constraints, and its optimization capability surpasses that of traditional methods based on heuristic rules. Ultimately, through online re-evaluation and rolling policy updates, the system achieves continuous environmental adaptability, realizing the transformation from fixed policies to adaptive learning, and providing provable robustness for long-term privacy protection in complex and dynamic environments.
[0028] Optionally, the sensitivity calculation method determines the global sensitivity based on the rate of change of the clearing price or trading volume output function. Regarding the liquidation price Transaction volume Independent sensitivity parameters are set for the three output items: the supply and demand curve, and the P2P electricity trading settlement rules. The sensitivity calculation method involves assuming only one trading entity's price changes within the allowed range, given the P2P electricity trading settlement rules and price range. The maximum possible change in the settlement price, the traded electricity volume, and the supply and demand convergence curve is calculated, and this maximum change is used as the sensitivity parameters for the settlement price, the traded electricity volume, and the supply and demand convergence curve, respectively. For example, stricter requirements are set for the settlement price, while more lenient requirements are set for the supply and demand curve. This provides a reference for selecting noise injection points at different output locations.
[0029] Optionally, the differential privacy noise mechanism includes a Laplace or Gaussian mechanism. The P2P electricity trading platform system predefines a set of candidate noise injection positions, which includes the settlement price, the single transaction volume, and the supply and demand curve parameters. The settlement price, the single transaction volume, and the supply and demand curve parameters are encapsulated into a set of candidate noise injection positions for subsequent adaptive strategies to select from different noise injection positions.
[0030] Optionally, the attack threat model includes passive eavesdropping attacks, differential attacks, and Bayesian back-inference attacks. This attack threat model is a threat scenario model used within the attack assessment module to characterize the capability boundaries of potential attackers. In this embodiment, passive eavesdropping attacks, differential attacks, and Bayesian back-inference attacks are combined from weak to strong to form an attack threat, which can comprehensively represent privacy threats in P2P electricity trading scenarios, thereby enabling further quantification of privacy risks. The attack assessment module establishes a prior probability distribution based on the unknown bidding information Bid. Calculate the posterior probability distribution The privacy leakage risk score is calculated based on the information entropy change of the posterior probability distribution or the maximum posterior confidence value. When the privacy leakage risk score exceeds the set risk threshold, the online adaptation and rolling update of the policy network model are triggered, and a new noise injection decision is given.
[0031] Specifically, the attack assessment module first establishes a reasonable prior probability distribution for the unknown bid information Bid in the market. Once the attacker observes the market's published liquidation output, they use Bayes' theorem to inversely estimate the bidding information and calculate its posterior probability distribution using the following formula. :
[0032] , Based on Bayes' theorem, the bidding information is inversely estimated, and the attack assessment module calculates a quantified current privacy leakage risk score. RThis score characterizes the degree to which the uncertainty of bidding information decreases given a public output. In one embodiment, R The information entropy of the aforementioned posterior probability distribution can be defined by calculating its entropy. A lower entropy value indicates a higher degree of certainty regarding the bidding information, and consequently, a greater privacy risk. In another embodiment, R The risk score can also be calculated based on the maximum a posteriori confidence level of the posterior probability distribution. R As key state variables, they are input into the subsequent Markov decision model. When R When the preset risk threshold is exceeded, the system will trigger an alarm and guide the adaptive strategy to take actions such as increasing the strength of privacy protection or reallocating the privacy budget. This transforms the privacy budget from an abstract concept into a quantifiable metric: "How much has the attacker's uncertainty about the bid been reduced under the current attack capability assumptions?" This allows privacy risks to be calculated and compared in real time. It enables the strategy to truly see privacy risks, supporting adaptive decision-making and online evaluation and updates in subsequent steps.
[0033] Optionally, the differential privacy-preserving noise adaptive deployment problem is formalized as a Markov decision model. This model provides a theoretical framework for deep reinforcement learning algorithms to interact with dynamic market environments. Its core elements include state space, action space, and reward function. The state space corresponds to a vector... Used to characterize the complete state of the system at the start of trading period t. It comprises three key components: market status, privacy breach risk score, and remaining budget. Market status includes real-time market information on clearing price, load demand, and renewable energy output; the privacy breach risk score, calculated by the attack assessment module, directly quantifies the level of privacy threats; and the remaining budget serves as a crucial resource constraint, ensuring the system's long-term sustainability. Action Space The policy network model is defined to make executable decisions in each cycle. This embodiment of the invention defines the action space. Defined as ,in This indicates the candidate noise injection position selected in the current trading period. This refers to the noise intensity parameter based on the established differential privacy noise mechanism. A proportion is allocated to the privacy budget. This hybrid action space design incorporates both discrete choices and continuous adjustments, giving the strategy sufficient flexibility and expressiveness. The reward function is defined as a weighted sum of trading efficiency, privacy leakage risk, and privacy budget. The weights of trading efficiency, privacy leakage risk, and privacy budget are determined through parameter search based on historical market data to reflect the operator's trade-off preferences among market utility, privacy risk score, and privacy sub-budget consumption.
[0034] reward function The design of the reward function is key to guiding the policy network model to learn and achieve multi-objective trade-offs. Constructed as a weighted sum of transaction efficiency, privacy breach risk, and privacy budget, its mathematical expression is: , in, The representative policy network model takes action The market benefits maintained after the noise is added can be specifically calculated in relation to the social welfare or transaction efficiency of the market after the noise is added. This is the next privacy risk score recalculated by the attack assessment module after the action is executed and the noisy result is published. The negative sign before this item means that the policy network model's decision needs to be committed to reducing the future privacy risk score. Indicates the execution of an action The actual privacy budget consumed, α For market benefit weighting parameters, β As a weighting parameter for the privacy breach risk score, γ These are the privacy sub-budget weight parameters, and their specific values are determined through systematic tuning during the offline training phase. The goal is to maximize market benefits, minimize privacy leakage risk, and minimize privacy budget consumption; therefore, the signs are positive and negative. By converting the three objectives into a single reward function, it transforms into a single-objective maximization problem, making it easier to solve and thus ensuring that the decisions made meet multiple needs. These three positive weight parameters reflect the system's relative preference among maximizing market utility, controlling privacy leakage risk, and saving the overall privacy budget. α The larger the value, the more it tends to improve transaction utility. The other two parameters are similar, representing the trade-off preferences of their respective parts. These three parameters are generally predefined and determined through parameter search based on historical market data to reflect the operator's trade-off preferences between market utility, privacy risk score, and privacy sub-budget consumption.
[0035] Optionally, the deep reinforcement learning algorithm employs the soft actor commentator algorithm, which trains the policy network model on historical market data or in a simulation environment, enabling the policy network model to adaptively output noise injection location and intensity based on market state, privacy breach risk score, and remaining budget.
[0036] In this embodiment of the invention, a deep reinforcement learning algorithm is used to train the policy network model offline to obtain an optimal or near-optimal policy that can adaptively handle noise injection decisions. This training phase is conducted in a simulation environment constructed from historical market data, aiming to safely and efficiently teach the policy network model to adapt to the state space. Make precise responses and outputs that conform to the motion space. Defined decision. The policy network model training preferably employs an advanced deep reinforcement learning algorithm suitable for continuous action spaces, designed to receive vectors from the state space. and output motion space The training process is conducted cyclically in a simulated market environment driven by historical P2P transaction data. In each training step, a state transition trajectory is generated based on the interaction between the current strategy and the environment. These interaction data are stored in an experience replay pool for subsequent batch updates of the network parameters. The training objective is to maximize the cumulative discounted reward obtained by the system, the value of which is estimated by the critic network. In this process, hyperparameters such as the learning rate, discount factor, and weights in the reward function are used. All algorithms are optimized using systematic grid search or Bayesian optimization methods to achieve the best performance. Training will continue until the policy performance converges on the validation set, meaning it can stably balance market utility, privacy risk, and budget consumption in the long run.
[0037] The Soft Actor-Critic (SAC) algorithm, compared to traditional reinforcement learning algorithms, is better suited to handle continuous action space problems, including noise intensity parameters and privacy budget allocation ratios, as described in this invention. SAC introduces a policy entropy regularization term into the optimization objective, which helps maintain sufficient exploration within the complex, non-convex trade-off space of "transaction utility – privacy risk – budget consumption," thereby learning a robust near-optimal noise injection strategy. Therefore, using the Soft Actor-Critic algorithm can more stably and efficiently obtain an adaptive differential privacy deployment strategy in the scenario of this invention. The policy network model is first trained offline or in a simulation environment. This is primarily for safety and efficiency, avoiding random noise testing in the real market and ensuring that the online deployment uses a converged strategy, thus preventing repeated trial and error in real transactions and guaranteeing the safety and compliance of market operations.
[0038] Optionally, after generating noise parameters and obtaining a noise injection decision through the set differential privacy noise mechanism, the noise is injected at the designated location after verification by the safety guardrail, and the liquidation is performed and the market liquidation results are published. The safety barrier verification includes market rule constraint detection and noise boundary detection: when the intensity or location of noise injection causes the liquidation price to deviate from the preset fair range, action projection is automatically executed to restrict the noise injection decision within the feasible region. Verified noise injection decisions are applied to the liquidation execution process, and the noise injection intensity, location, global privacy budget consumption, and noise injection decision version information are recorded in the liquidation log for audit traceability. The introduction of safety barrier verification provides strict feasibility boundary constraints for algorithmic decisions, ensuring that all operations meet the basic rules of market operation through mechanisms such as action projection, effectively mitigating potential reliability risks of reinforcement learning in critical infrastructure applications.
[0039] Specifically, at the beginning of each trading cycle, the system calculates the vector of the current state space. The input is then fed into the trained policy network model, which outputs the noise injection decision parameters for the current period, including the noise injection location, noise intensity parameters, and budget allocation ratio.
[0040] See Figure 2 The decision parameters must be validated for legality by the safety barrier verification module. This module performs market rule constraint detection and noise boundary detection: when the predicted injection strength may cause the liquidation price to deviate from the preset fair range or violate the market ranking rules, the system automatically performs an action projection operation to limit the strategy output within the feasible region; at the same time, it verifies whether the budget allocation exceeds the remaining privacy budget. .
[0041] The validated noise injection scheme is applied to the market clearing process. The system injects noise of appropriate intensity at selected locations, performs clearing, and publishes the results. Simultaneously, it calculates the privacy consumption for this round and updates the remaining budget based on the differential privacy budget accounting method. All injection parameters, budget consumption, and strategy version information are recorded in the clearing log, forming a complete audit traceability chain.
[0042] The successful verification of the safety barrier first ensures the safe and compliant operation of the electricity market. The strategy network model is a "black box," which may output excessive noise, causing the settlement price to deviate significantly from cost, resulting in extremely high / low electricity prices, or injecting noise in areas where it is not permitted, thus disrupting market rules such as the monotonicity of supply and demand curves, energy conservation, and price upper and lower limits. The safety barrier verification also ensures the feasibility and stability of differential privacy deployment itself. This is equivalent to providing a layer of protection for the system, guaranteeing its security and robustness in the trading environment.
[0043] Optionally, the market clearing results are used to reassess privacy risks. After calculating a new privacy breach risk score, it is compared with the historical average. When the privacy breach risk score or budget utilization exceeds the threshold, an online adaptive update mechanism is triggered. By storing the latest experience data in the experience replay pool, the policy network model is fine-tuned in small increments or periodically updated until the budget utilization meets the convergence condition.
[0044] Specifically, after publishing the noise-addition cleanup results, the system initiates a closed-loop evaluation and online adaptation process. First, the attack evaluation module reassesses the privacy risks of the published market results and calculates a new privacy risk score. R t+1 The system compares the score with the historical risk average and a preset threshold. When a significant increase in the risk score or a budget utilization rate exceeding the warning level is detected, an online adaptive update mechanism is triggered.
[0045] When the system reaches the preset convergence threshold or the remaining privacy budget When the noise level falls below a safety threshold, the adaptive process terminates, and the system automatically switches to a conservative fixed-parameter noise injection strategy. Through this closed-loop design, the system achieves a long-term dynamic balance between privacy protection strength and market operation utility, forming a complete self-optimizing system.
[0046] By reassessing the privacy risks of the published noise-injection cleanup results and comparing the newly obtained risk score with historical risk levels and budget utilization, this invention can continuously monitor the effectiveness of differential privacy deployment. When the risk of privacy leakage increases significantly or the privacy budget is consumed too quickly, the policy network is triggered to adapt online or periodically update based on empirical datasets, thereby achieving dynamic reconfiguration of noise injection location and intensity. This design transforms differential privacy protection from a one-time static configuration into a closed-loop control process of "output-evaluation-learning-reconfiguration," which, while ensuring global privacy budget constraints, can automatically adjust the strength of privacy protection and budget allocation strategies as the market environment and attack threats evolve.
[0047] The overall process of the differential privacy method for P2P electricity trading in smart grids proposed in this invention mainly includes: system initialization, construction of an attack assessment module, MDP modeling, training of the policy network, online deployment of the policy and security verification execution, and post-deployment privacy risk reassessment and determination of whether the preset convergence / budget threshold has been reached. This closed loop, through the cycle of "assessment-decision-execution-feedback," enables the noise injection location and intensity to adaptively adjust without disrupting market rules, achieving a dynamic trade-off between privacy protection and transaction utility.
[0048] Please see Figure 2This embodiment presents a partial process for single-cycle online execution and safety barrier verification: After inputting the current market state, the strategy model infers the noise injection location and intensity, and sequentially passes market rule constraint detection and noise boundary detection; if all are compliant, the strategy is executed and parameters and logs are recorded; if non-compliant situations exist, the action is projected / limited and re-verified. This process ensures that the strategy output can be directly implemented in actual operation, while controlling the disturbance amplitude and compliance, supporting the stable closed loop of the overall method.
[0049] A second aspect of the present invention provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described above. Another electronic device provided in an embodiment of the present invention may further include: an input port connected to the processor for transmitting multimodal data collected by an external acquisition device to the processor; a display unit connected to the processor for displaying the processor's processing results to the outside world; and a communication module connected to the processor for enabling communication between the electronic device and the outside world. The display unit may be a display panel, a laser scanning display, etc.; the communication method used by the communication module includes, but is not limited to, Mobile High Definition Link (HML), Universal Serial Bus (USB), High Definition Multimedia Interface (HDMI), and wireless connection (including Wi-Fi, Bluetooth, Bluetooth Low Energy, and IEEE 802.11s-based communication technologies).
[0050] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described method.
[0051] The above inventions are merely a few specific embodiments of the present invention. However, the embodiments of the present invention are not limited thereto, and any variations that can be conceived by those skilled in the art should fall within the protection scope of the present invention.
Claims
1. A differential privacy method for P2P electricity trading in smart grids, characterized in that, Includes the following steps: Based on the transaction settlement rules and electricity price sensitivity calculation method of the P2P electricity trading platform, global privacy budget parameters, differential privacy noise mechanism and candidate noise injection location set are set. Based on a pre-defined attack threat model, an attack assessment module is constructed using Bayesian inference techniques to obtain a quantified current privacy breach risk score. The problem of adaptive deployment of differential privacy noise is formalized as a Markov decision model, where the state space is a vector containing the current market state, privacy leakage risk score and remaining budget, and the action space is a composite action containing the candidate noise injection position selected in the current trading cycle, the noise intensity parameter based on the set differential privacy noise mechanism, and the privacy budget allocation ratio. Based on the defined Markov decision model, a deep reinforcement learning algorithm is used to train the policy network model to obtain the optimal or near-optimal policy that can adaptively output the candidate noise injection position and intensity according to each vector in the real-time state space. At the start of the trading cycle, each vector in the current state space is input into the trained policy network model to generate noise parameters. After obtaining the noise injection decision through the set differential privacy noise mechanism, noise is injected at the specified position, liquidation is executed, and the market liquidation result is published. At the same time, the corresponding privacy budget is deducted from the global privacy budget parameter. The attack assessment module is used to reassess the privacy risks of the published market clearing results, calculate new privacy leakage risk scores, construct experience samples based on each vector in the current state space, noise injection decisions and corresponding market transaction results, and update the experience dataset; when the pre-set update rhythm or triggering conditions are met, the trained policy network model is adapted and updated online; the steps at the beginning of the transaction cycle and the privacy risk reassessment steps are repeated until the remaining privacy budget reaches the preset threshold condition.
2. The differential privacy method for P2P electricity trading in smart grids as described in claim 1, characterized in that, The sensitivity calculation method is as follows: given the P2P electricity trading settlement rules and the range of price values, assuming that only one trading entity's price changes within the allowed range, calculate the maximum possible change in the settlement price, the transaction volume, and the supply-demand convergence curve caused by this change, and use the maximum change as the sensitivity parameters for the settlement price, the transaction volume, and the supply-demand convergence curve, respectively.
3. The differential privacy method for P2P electricity trading in smart grids as described in claim 1, characterized in that, The differential privacy noise mechanism includes a Laplace mechanism or a Gaussian mechanism. The P2P electricity trading platform system predefines a set of candidate noise injection locations, which includes the settlement price, the electricity volume of a single transaction, and the position of the supply and demand curve parameters.
4. The differential privacy method for P2P electricity trading in smart grids as described in claim 1, characterized in that, The attack threat model includes passive eavesdropping attacks, differential attacks, and Bayesian back-inference attacks; The attack assessment module establishes a prior probability distribution based on the unknown bid information Bid, calculates the posterior probability distribution, and calculates a privacy leakage risk score based on the information entropy change or the maximum posterior confidence value of the posterior probability distribution. When the privacy leakage risk score exceeds the set risk threshold, it triggers online adaptation and rolling updates of the policy network model and gives a new noise injection decision.
5. The differential privacy method for P2P electricity trading in smart grids as described in claim 1, characterized in that, The differential privacy noise adaptive deployment problem is formalized as a Markov decision model, where the reward function is defined as a weighted sum of transaction efficiency, privacy leakage risk, and privacy budget. The weights of transaction efficiency, privacy leakage risk, and privacy budget are determined through parameter search based on historical market data to reflect the operator's trade-off preferences among market utility, privacy risk score, and privacy sub-budget consumption.
6. The differential privacy method for P2P electricity trading in smart grids as described in claim 1, characterized in that, The deep reinforcement learning algorithm employs the soft actor commentator algorithm, which trains the policy network model on historical market data or in a simulation environment. This enables the policy network model to adaptively output the noise injection location and intensity based on market state, privacy leakage risk score, and remaining budget.
7. The differential privacy method for P2P electricity trading in smart grids as described in claim 1, characterized in that, After generating noise parameters and obtaining noise injection decisions through the set differential privacy noise mechanism, noise is injected at the designated location and liquidation is performed after verification by the safety guardrail, and the market liquidation results are published. The safety barrier verification includes market rule constraint detection and noise boundary detection: when the intensity or location of noise injection causes the liquidation price to deviate from the preset fair range, the action projection is automatically executed to limit the noise injection decision to the feasible range. Verified noise injection decisions are applied to the liquidation execution process, and the noise injection intensity, location, global privacy budget consumption, and noise injection decision version information are recorded in the liquidation log for audit traceability.
8. The differential privacy method for P2P electricity trading in smart grids as described in claim 1, characterized in that, The market clearing results are used to reassess privacy risks. A new privacy leakage risk score is calculated and compared with the historical average. When the privacy leakage risk score or budget utilization exceeds the threshold, an online adaptive update mechanism is triggered. The latest experience data is stored in the experience replay pool, and the policy network model is fine-tuned in small increments or periodically updated until the budget utilization meets the convergence condition.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 8.