Physics-informed neural networks via stochastic Hamiltonian dynamics learning

Chandrajit Bajaj, Minh Hoang Nguyen · DOI

TL;DR

NeuralPMP is a new framework that tackles optimal control problems by teaching neural networks to learn the underlying "physics" of a solution. By integrating the classical Pontryagin Maximum Principle (PMP) with stochastic Hamiltonian dynamics and Variational Autoencoders (VAEs), the model learns to navigate complex control tasks more efficiently than standard reinforcement learning methods.

What Problem Does This Paper Address?

In the world of robotics and autonomous systems, "optimal control" is the art of finding a sequence of actions that minimizes a cost (like fuel or time) while following physical laws. Traditionally, this is solved using Reinforcement Learning (RL) or numerical optimization.

However, standard RL often treats the environment as a "black box," ignoring the rich mathematical structure of physics. This can lead to high variance, instability in high-dimensional spaces, and difficulty handling continuous time or unevenly spaced observations. The authors aim to bridge this gap by baking the Pontryagin Maximum Principle—a cornerstone of control theory—directly into the neural network's architecture and loss function.

Methods

The authors introduce NeuralPMP, a two-phase learning framework:

  1. Phase 1: Forward Hamiltonian Learning: Instead of learning a direct mapping from state to action (a policy), the network learns a reduced Hamiltonian $h(q, p)$. Here, $q$ is the state and $p$ is the "adjoint variable" (think of it as a generalized momentum that encodes the optimal control). They use Neural ODEs to simulate the system's trajectory and minimize a loss function derived from PMP conditions.
  2. Phase 2: Stochastic Variational Training: Purely deterministic models often struggle with exploration. To fix this, the authors wrap the Hamiltonian flow in a Variational Autoencoder (VAE).
  3. An Encoder maps the terminal state/adjoint back to a latent space.
  4. A Decoder (using a reverse Hamiltonian flow) reconstructs the initial state.
  5. This "forward-backward" cycle injects stochasticity, allowing the model to explore the "path space" more effectively and generalize better to new starting conditions.

Datasets

The framework was evaluated on three classic continuous-control benchmarks from the OpenAI Gym suite, modified for continuous-time settings:

  • Mountain Car: Controlling acceleration to reach a hilltop.
  • Cart Pole: Balancing a pole on a moving cart.
  • Pendulum: Swinging a pendulum up and maintaining balance.
  • Special LQR: A discrete-time Linear Quadratic Control problem with unevenly spaced time steps to demonstrate the model's flexibility.

Key Insights and Ideas

  • Control as Physics: By shifting the focus from "learning a policy" to "learning Hamiltonian dynamics," the model treats the optimal path as a natural physical flow. The control signal is essentially "hidden" within the adjoint variables.
  • Handling Irregular Time: Because the model is based on differential equations (Hamiltonian flow), it naturally handles uneven time steps—a major hurdle for many discrete-time RL algorithms.
  • The VAE "Aha Moment": The authors found that adding noise to a deterministic Hamiltonian flow usually hurts performance. However, by using a VAE structure for the backward pass, they successfully injected "smart" noise that improves exploration without sacrificing the physical validity of the learned paths.
  • Policy-Free Advantage: The paper demonstrates that for certain problems (like their specific LQR task), a standard state-to-action policy function might not even mathematically exist, whereas the Hamiltonian approach remains robust.

Key Results

NeuralPMP consistently outperformed "Random Hamiltonian" baselines and its own single-phase (forward-only) version across the benchmarks:

  • Mountain Car: Achieved an average end cost of 0.4945, significantly lower than the baseline (0.8285).
  • Cart Pole: Reached a near-perfect balance with a cost of 0.0202 (vs. 0.1924 for the baseline).
  • Pendulum: While the single-phase model was slightly better at the very end of the simulation, NeuralPMP showed a much faster drop in cost during the early stages of the trajectory, indicating more efficient pathfinding.

Limitations and Future Work

  • Black-Box Dependency: Currently, the framework requires access to "black-box" evaluations of the system's dynamics and cost functions during training.
  • Model-Free Ambitions: The authors explicitly state their goal to develop "model-free" versions of NeuralPMP that can learn directly from data without needing prior knowledge of the underlying equations.
  • Scalability: While successful on classic benchmarks, the framework needs to be tested on much larger, higher-dimensional systems (e.g., complex robotics or multi-agent systems) to prove its industrial viability.

Summary updated

BibTeX
@misc{bajaj2021physics,
  author = {Chandrajit Bajaj and Minh Hoang Nguyen},
  title = {{Physics-informed neural networks via stochastic Hamiltonian dynamics learning}},
  year = {2021},
  eprint = {2111.08108},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2111.08108},
}
Figure