Abstract
Reinforcement learning (RL) offers significant potential for optimizing complex energy systems, yet ensuring strict adherence to physical constraints remains a challenge. Traditional approaches like soft penalties or post-hoc clipping often fail to provide safety guarantees or hinder the learning process. This paper introduces PROF (PROjected Feasibility), a framework that integrates differentiable projection layers directly into RL policies. By differentiating through a convex optimization problem that enforces constraints, PROF enables the policy to become "constraint-aware" during training. Evaluated on building climate control and power grid inverter management, PROF achieves 100% constraint satisfaction and improves energy efficiency by 4% compared to state-of-the-art RL methods.
Introduction
Reinforcement learning has emerged as a powerful paradigm for controlling complex, dynamic systems. However, its application in safety-critical infrastructure, such as smart grids and building energy management, is limited by the difficulty of enforcing hard physical constraints. In these domains, actions must stay within strict operational boundaries—for instance, maintaining room temperatures within a comfort range or preventing voltage spikes in a distribution feeder.
Existing methods for handling constraints in RL typically fall into two categories: soft penalties and post-hoc clipping. Soft penalties add a cost to the reward function for violations, which encourages but does not guarantee safety. Post-hoc clipping ensures safety by projecting illegal actions onto the feasible set after they are chosen, but this leaves the agent "blind" to the constraints during the learning process, often leading to poor convergence and suboptimal policies.
The PROF Framework
The core innovation of this work is the PROjected Feasibility (PROF) framework, which treats constraint enforcement as a differentiable layer within the neural network policy.
As illustrated in Figure 4, the policy $\pi_\theta$ consists of a standard neural network $\hat{\pi}_\theta$ followed by a differentiable projection layer. This layer solves a convex optimization problem: finding the action $u$ closest to the network's output that satisfies a set of linearized physical constraints $\hat{\mathcal{C}}_k$. By utilizing the Implicit Function Theorem, the authors enable backpropagation through this optimization step. This allows the network to learn how its "illegal" impulses are corrected, making it inherently aware of operational boundaries.
Figure 6 visualizes how this projection affects the learning signal. Unlike clipping, which provides no gradient information regarding the constraint boundary, the differentiable projection provides a clear direction for policy updates, steering the network toward the feasible region $\mathcal{C}$. To further incentivize the network to remain within the safe zone, an auxiliary loss term is introduced that penalizes the distance between the raw network output and the projected (safe) output.
Experimental Setup
The PROF framework was evaluated on two distinct simulated environments:
- Building Climate Control: A high-fidelity EnergyPlus (E+) model of a 600m² multi-functional space. The model used Typical Meteorological Year (TMY3) data for pre-training and actual 2017 weather data from Pittsburgh for testing.
- Power Grid Inverter Control: The IEEE 37-bus feeder system, a standard benchmark for power distribution. This was paired with 1-second resolution solar irradiance and load data from a neighborhood in California, totaling over 600,000 samples.
Key Results and Insights
The experimental results demonstrate the superiority of PROF in both efficiency and safety:
- Efficiency Gains: In the building operation task, PROF achieved 4% energy savings over state-of-the-art RL methods and 10% savings over traditional P-controllers, while maintaining strict thermal comfort.
- Guaranteed Safety: In the inverter control task, PROF maintained 100% constraint satisfaction over the entire test period. In contrast, standard industry heuristics violated voltage constraints 22.3% of the time.
- Emergent Behavior: A significant insight was the emergence of "constraint-aware" strategies. For example, in building management, PROF learned to "pre-heat" rooms in the early morning to avoid violating comfort constraints during peak hours—a sophisticated behavior it was never explicitly programmed to perform.
- Real-time Feasibility: Although the projection layer adds computational overhead (~8.6ms per action), it is significantly faster than solving full non-linear AC Optimal Power Flow problems, making it viable for real-time control.
Conclusion and Future Work
PROF provides a robust middle ground between the flexibility of RL and the rigor of classical control. By making the projection step differentiable, the framework ensures that policies are not only safe but also highly optimized.
Future research will address the computational cost of solving optimization problems during every training step, potentially through specialized solvers. Additionally, the dependency on accurate linearized models suggests a need for online model-learning techniques to ensure the "safe set" remains valid as physical systems age or change.
Summary updated