arXiv:2609.01680cs.LGSep 2026

Manuscript Offprint

arXiv:2609.01680

Reinforcement Learning and Rule-Based Peer-to-Peer Pricing in Residential PV-BES Communities

Pablo Benalcazar, Maciej Kalka, Wilian Guamán, Jacek Kamiński

Abstract

This paper compares rule-based and learning-based pricing mechanisms for peer-to-peer (P2P) electricity trading in residential photovoltaic communities. The rule-based benchmarks comprise bill-sharing as an ex post allocation mechanism, the mid-market rate, and supply-demand-ratio pricing. The reinforcement-learning (RL) formulation is implemented through a Deep Q-Network and evaluated under multiplier-based and learnable SDR-shaped pricing, with a fixed-parameter SDR variant as a non-learning control. Performance is assessed through community savings together with complementary financial and operational indicators. In the base PV-only configuration, the rule-based benchmarks outperform the best RL policy. With battery energy storage, evaluated for the RL policies only, community savings under the best RL policy increase from €734.23 to €978.52. Across the learning-based modes and in both configurations, SDR-shaped pricing outperforms the multiplier-based parameterization considered. The results indicate that rule-based pricing remains highly competitive wherever the two families are compared directly, and that storage substantially improves the learning-based outcomes under this accounting, while the distribution of benefits remains heterogeneous across households.

Keywords: Peer-to-peer electricity trading, Reinforcement learning, Peer-to-peer pricing mechanisms, Local energy markets, Residential

*Corresponding author.

Email address: benalcazar@min-pan.krakow.pl (Pablo Benalcazar®^{®}) photovoltaic communities, Battery energy storage systems

Nomenclature

Abbreviations
BESBattery energy storage
BSBill-sharing mechanism
DQNDeep Q-Network
MMRMid-market rate
P2PPeer-to-peer
PVPhotovoltaic
RLReinforcement learning
RL-MRL-Multiplier: multiplier-based pricing
RL-SDR-FRL-SDR-Fixed: fixed-parameter SDR-shaped pricing, non-learning control
RL-SDR-LRL-SDR-Learnable: learnable SDR-shaped pricing
SDRSupply-demand ratio
SOCState of charge
SSISelf-sufficiency index
Indices and sets
ttSettlement interval (hourly)
iiHousehold index; also the minibatch sample index in Algorithm 1
kkAction index, k=1,…,Kk = 1, \ldots, K
A\mathcal{A}Discrete action set of the RL agent
KKNumber of actions in A\mathcal{A}
D\mathcal{D}Dataset of days with hourly PV, load, and grid-price profiles
Ttr\mathcal{T}^{\mathrm{tr}}Set of intervals with internal trading
R\mathcal{R}Experience replay buffer
B\mathcal{B}Minibatch sampled from R\mathcal{R}
Energy quantities (kWh)
EtsupE_t^{\mathrm{sup}}Aggregate local surplus available for internal trading
Etsup,pvE_t^{\mathrm{sup,pv}}PV share of the aggregate local surplus
EtdemE_t^{\mathrm{dem}}Aggregate residual internal demand
EttrE_t^{\mathrm{tr}}Internally traded volume, EtrE^{\mathrm{tr}} annual total
EtbuyE_t^{\mathrm{buy}}Energy purchased internally by buyers
EtsellE_t^{\mathrm{sell}}Energy sold internally by sellers
EtpvE_t^{\mathrm{pv}}Community PV generation
EtloadE_t^{\mathrm{load}}Community household consumption
Etgrid,inE_t^{\mathrm{grid,in}}Grid imports, Egrid,inE^{\mathrm{grid,in}} annual total
Etgrid,outE_t^{\mathrm{grid,out}}Grid exports
btb_tCommunity net balance, bt=Etpv−Etloadb_t = E_t^{\mathrm{pv}} - E_t^{\mathrm{load}}
SDRt\mathrm{SDR}_tSupply-demand ratio, Etsup/EtdemE_t^{\mathrm{sup}}/E_t^{\mathrm{dem}} (–)
Prices (€/kWh)
ptbuyp_t^{\mathrm{buy}}Grid import price
ptsellp_t^{\text{sell}}Grid export price
ptMMRp_t^{\text{MMR}}Mid-market rate internal price
ptSDR,sellp_t^{\text{SDR,sell}}SDR benchmark internal sell price
ptSDR,buyp_t^{\text{SDR,buy}}SDR benchmark average buy price
ptp2p,sellp_t^{\text{p2p,sell}}Internal sell price quoted by the RL agent
ptp2p,buyp_t^{\text{p2p,buy}}Internal buy price quoted by the RL agent
pttrp_t^{\text{tr}}Realized internal trading price, pˉtr\bar{p}^{\text{tr}} its average
Costs and economic indicators (€)
CrefC^{\text{ref}}Community cost without internal trading, CirefC_i^{\text{ref}} per household
CpoolC^{\text{pool}}Community cost after internal trading
CiBSC_i^{\text{BS}}Cost assigned to household ii under bill-sharing
BcommB^{\text{comm}}Community benefit, Cref−CpoolC^{\text{ref}} - C^{\text{pool}} (distinct from the minibatch size BB)
ωi\omega_iShare of the community benefit allocated to household ii, ∑iωi=1\sum_i \omega_i = 1 (-)
CusrC^{\text{usr}}User cost
RproR^{\text{pro}}Prosumer revenue
ScommS^{\text{comm}}Community savings
JtbaseJ_t^{\text{base}}Hourly community cost of the no-P2P reference
Jtp2pJ_t^{\text{p2p}}Hourly community cost after P2P clearing and grid settlement
Pricing-mechanism parameters
μkbuy,μksell\mu_k^{\text{buy}}, \mu_k^{\text{sell}}Buy and sell multipliers of action kk under RL-M (-)
α,β\alpha, \betaSell- and buy-price sensitivity of the SDR-shaped rule, 0≤α≤10 \le \alpha \le 1, β≥1\beta \ge 1 (-)
CctrlC_{\text{ctrl}}Half-width of the grid price corridor (€/kWh)
CbalC_{\text{bal}}Midpoint of the grid price corridor (€/kWh)
δ\deltaLog-argument stability constant (-)
Reinforcement-learning parameters
sts_tState vector at interval tt
bˉt\bar{b}_tDiscretized community net balance, nine bins (-)
SOC‾t\overline{\text{SOC}}_tMean battery state of charge across households, as a fraction of capacity (-)
ata_tAction selected at interval tt
rtr_tReward, Jtbase−Jtp2pJ_t^{\text{base}} - J_t^{\text{p2p}} (€)
hth_tHour of the day
QθQ_\thetaAction-value network with parameters θ\theta
Qθ^Q_{\hat{\theta}}Target network with parameters θ^\hat{\theta}
π∗\pi^*Greedy policy obtained after training
γ\gammaDiscount factor (-)
η\etaAdam learning rate (-)
BBMinibatch size (-)
TTTarget-network synchronization period (steps)
EENumber of training episodes (-) (distinct from the energy quantities Et∙E_t^\bullet)
ε\varepsilonExploration rate, from ε0\varepsilon_0 to εmin⁡\varepsilon_{\min} (-)
λ\lambdaExploration decay rate per step (-)