Source-linked AI summary

Symplectic ODE-Net: Learning Hamiltonian Dynamics with Control

Yaofeng Desmond Zhong, Biswadip Dey, Amit Chakraborty

arXiv:1909.12077v5cs.LGeess.SYphysics.comp-phstat.ML

TL;DR

The paper addresses learning controlled physical dynamics from trajectories while improving generalization and handling non-Euclidean coordinates or unavailable momentum. It introduces SymODEN, a physics-informed Neural ODE that enforces Hamiltonian structure and supports energy-based control. Across tasks, SymODEN achieves better prediction with fewer training samples and yields interpretable, physically consistent models, though extrapolation beyond the trained angle range is limited.

  • Problem

    Learning physical dynamics from trajectories must accommodate controlled systems, improve generalization with limited data, and handle embedded angle observations or velocity without generalized momentum.

  • Method

    SymODEN integrates Hamiltonian dynamics with control into a differentiable Neural ODE using structured parameterizations for physical quantities and energy-based control.

  • Results

    SymODEN achieves better predictions with fewer training samples, conserves learned energy more consistently than baseline models in reported tasks, and supports physically consistent state-space modeling.

  • Takeaways & Limitations

    The learned interpretable dynamics can provide physical insight and support model-based controller synthesis, including systems with embedded angles or velocity-only observations.

  • Takeaways & Limitations

    When angles are represented directly as q, learned functions do not extrapolate well outside the training range q ∈ [−π, 3π].

Abstract

from arXiv · show

In this paper, we introduce Symplectic ODE-Net (SymODEN), a deep learning framework which can infer the dynamics of a physical system, given by an ordinary differential equation (ODE), from observed state trajectories. To achieve better generalization with fewer training samples, SymODEN incorporates appropriate inductive bias by designing the associated computation graph in a physics-informed manner. In particular, we enforce Hamiltonian dynamics with control to learn the underlying dynamics in a transparent way, which can then be leveraged to draw insight about relevant physical aspects of the system, such as mass and potential energy. In addition, we propose a parametrization which can enforce this Hamiltonian formalism even when the generalized coordinate data is embedded in a high-dimensional space or we can only access velocity data instead of generalized momentum. This framework, by offering interpretable, physically-consistent models for physical systems, opens up new possibilities for synthesizing model-based control strategies.

1 INTRODUCTION

The paper argues that physics-based inductive bias can improve neural-network generalization for physical systems while exposing interpretable system properties. SymODEN combines Hamiltonian dynamics with data-driven learning and supports model-based control.

  • Motivation: Physics-based computation graphs can improve neural-network generalization when physical laws shape system behavior.The paper links this inductive bias to more accurate future-state prediction and improved out-of-sample behavior.
  • Interpretability: The learned model exposes physical properties including inertia, potential energy, and total conserved energy.These properties provide insight into the system beyond state prediction.
  • Relation to prior work: The framework targets dynamics learning and control while remaining more expressive than rigid parametric system-identification techniques.Related work contrasts neural-network approximations with more rigid parametric approaches.
  • Contribution: SymODEN encodes Hamiltonian dynamics with an external control term to learn structured physical-system dynamics.The framework is presented as a generalization of Hamiltonian dynamics for controlled systems.

2 PRELIMINARY CONCEPTS

Hamiltonian dynamics represents physical evolution in phase space through a scalar energy function, while controlled extensions model external energy exchange. Learned energy structure can then support energy-shaping control toward reference configurations.

  • Hamiltonian dynamics: Hamiltonian dynamics tracks system states in phase space using generalized coordinates q and momenta p.This treats coordinates and momenta symmetrically in the equations of motion.
  • Hamiltonian dynamics: The Hamiltonian H(q, p) is a scalar function that, in almost all physical systems, equals total energy.It can be expressed using kinetic energy determined by the mass matrix and potential energy V(q).
  • Controlled dynamics: For zero control, classical Hamiltonian dynamics conserves total energy; nonzero control enables dissipation-free energy exchange with the environment.The controlled formulation adds an external input acting through the input matrix g(q).
  • Control via energy shaping: Energy shaping modifies the potential-energy landscape so the desired Hamiltonian has a minimum at the reference configuration (q⋆, 0).Additional damping is used to ensure trajectories converge toward that configuration.
  • Control via energy shaping: Underactuated systems require kinetic-energy shaping in addition to potential-energy shaping to reach a desired configuration.Potential-energy shaping alone is insufficient when the system lacks actuation in some dimensions.

3 SYMPLECTIC ODE-NET

SymODEN embeds Hamiltonian dynamics with control into a differentiable Neural ODE, using structured neural approximators for mass, potential energy, and actuation. The architecture also accommodates constant-forcing training, embedded angles, hybrid spaces, and physical constraints.

  • 3.1 TRAINING NEURAL ODE WITH CONSTANT FORCING: Neural ODE learning approximates an unknown ODE right-hand side with a neural network and backpropagates through the differentiable solver.Short-horizon prediction is introduced because errors can accumulate over long trajectories and make training difficult.
  • 3.1 TRAINING NEURAL ODE WITH CONSTANT FORCING: Constant control creates a dimension mismatch for directly applying controlled dynamics to Neural ODE, so the method augments the dynamics with control evolution.The trained model can later generate trajectories under time-varying control.
  • 3.2 HAMILTONIAN DYNAMICS: SymODEN parameterizes inverse mass, potential energy, and the input matrix with neural networks, then feeds the resulting Hamiltonian vector field into Neural ODE.Automatic differentiation supplies derivatives required by the structured dynamics.
  • 3.3 LEARNING FROM EMBEDDED ANGLE DATA: Embedded angle data uses (cos q, sin q) with velocity instead of generalized momentum, reflecting the S1 geometry and common data-access setting.The angle-aware method learns the dynamics of the embedded coordinates and velocity.
  • 3.4 LEARNING ON HYBRID SPACES Rn × Tm: The hybrid-space architecture extends the approach to generalized coordinates on Rn × Tm, combining translational and angular coordinates.This targets systems such as robotics models containing both positions and orientations.
  • 3.5 POSITIVE DEFINITENESS OF THE MASS MATRIX: Positive definiteness of the learned inverse mass matrix is enforced through a lower-triangular parameterization with positive diagonal elements.Adding a small constant to the diagonal makes the mass matrix invertible and stabilizes training.

4 EXPERIMENTS

Across four controlled dynamical-system tasks, SymODEN learns physically consistent Hamiltonian dynamics, generalizes with fewer samples, and supports prediction and control from embedded or velocity-only observations.

  • Experimental setup: SymODEN is evaluated on pendulum, embedded-angle pendulum, CartPole, and Acrobot tasks, alongside structured and naive baseline models.The experiments cover learning on R1, S1, R1 × S1, and T2.
  • Experimental setup: Training data combine randomly generated initial states with five constant controls and trajectories integrated for 20 time steps.The training set scales from 16 to 1024 initial state conditions.
  • Task 1: pendulum with generalized coordinate and momentum data: In Task 1, SymODEN learns energy-conserved trajectories and functions matching the ground-truth input map and inverse mass, while potential energy differs only by an acceptable constant.The baseline does not conserve energy, whereas SymODEN and its unstructured variant do.
  • Task 2: pendulum with embedded data: Without generalized momentum data in Task 2, learned functions match the ground truth after scaling by β = 0.357, while the learned dynamics still support prediction and control.The model controls the pendulum to the inverted position despite using control magnitudes up to 7.5 versus 2.0 during training.
  • Results across tasks: SymODEN yields better generalization in every task, often outperforming other models in train and prediction error with smaller training sets.On CartPole, the Geometric Baseline has lower train error but less accurate predictions, indicating overfitting.
  • Results across tasks: On unseen initial conditions, baseline MSE diverges faster, while SymODEN preserves Hamiltonian level-set behavior and provides short-term Acrobot predictions despite chaotic motion.The Acrobot cannot be predicted reliably over the long term, but SymODEN remains reasonably accurate in the short term.

5 CONCLUSION

SymODEN incorporates Hamiltonian dynamics with control into a deep-learning framework for interpretable, physically consistent system identification. It supports embedded angle data and settings where only velocity, rather than generalized momentum, is available.

  • 5 CONCLUSION: SymODEN systematically incorporates prior knowledge of Hamiltonian dynamics with control into deep learning.The framework is designed to learn structured state-space models from physical-system data.
  • 5 CONCLUSION: The learned model provides better prediction with fewer training samples while remaining interpretable and physically consistent.The conclusion links the structured model to improved sample efficiency and interpretability.
  • 5 CONCLUSION: SymODEN can operate with embedded angle data or when only velocity is available instead of generalized momentum.The paper identifies these as supported data settings and proposes them as extensions of the framework.
  • 5 CONCLUSION: Future work includes port-Hamiltonian systems, embedded 3D orientations, and combining energy shaping with interpretable end-to-end learning.These directions extend the framework to broader physical-system classes and richer control formulations.

A EXPERIMENT IMPLEMENTATION DETAILS

The implementation uses fully connected networks with Tanh activations and compares models across tasks with differing input dimensions and parameter counts. SymODEN uses substantially fewer parameters than the listed baseline and unstructured variants in the provided architectures.

  • Architecture: All listed experiment architectures are fully connected and use Tanh activations to keep differentiated computation smooth.Because differentiation appears in the computation graph, nonsmooth activations could create discontinuous derivatives and ODE right-hand sides.
  • Architecture: SymODEN has the lowest total parameter count among the architectures used for the experiments.The appendix states this overall comparison before listing task-specific architectures.
  • Architectures: For one listed architecture, SymODEN uses 0.13M parameters, compared with 0.36M for the baseline and 0.20M for Unstructured SymODEN.These values belong to the architecture listing associated with the corresponding task input configuration.
  • Task 2: Pendulum with embedded data: Task 2 uses 3 state dimensions and 1 action dimension as input.The task is identified as pendulum with embedded data.

Task 4:Acrobot

The energy-based controller combines potential-energy shaping with damping and proportional-derivative terms. Its appendix formulation interprets the resulting control as PD control augmented by energy compensation.

  • Energy-based control: The energy-based controller has the form u(q, p) = β(q) + v(p), separating potential shaping from damping injection.β(q) shapes potential energy, while v(p) supplies damping according to the referenced controller equations.
  • Energy-based control: A quadratic desired potential energy is used to derive a specialized controller expression.The provided passage introduces the quadratic choice but does not include the resulting displayed expression.
  • PD controller with energy compensation: The corresponding external forcing combines energy compensation with proportional and derivative control terms.The first term compensates energy, while the second and last terms are proportional and derivative terms.
  • PD controller with energy compensation: The resulting control can be viewed as a PD controller with an additional energy-compensation term.This is the appendix’s explicit interpretation of the specialized energy-based controller.

C ABLATION STUDY OF DIFFERENTIABLE ODE SOLVER

The ablation compares HNN with Unstructured SymODEN, which both approximate the Hamiltonian but differ in how gradients are used for trajectory learning. Unstructured SymODEN performs better because differentiable ODE integration avoids the gradient-estimation pathway used by HNN.

  • Method: SymODEN avoids true-gradient or finite-difference-gradient targets by integrating the estimated gradient with differentiable ODE solvers.The model is trained through trajectory integration rather than direct matching to gradient observations.
  • Experimental setup: The comparison sets the time horizon to τ = 1 and uses Task 1 because HNN lacks angle-aware design.A larger τ would correspond to higher-order gradient estimates.
  • Experimental setup: The experiment uses 25 training trajectories with 45 time steps each, while the prediction error covers 90 time steps.The table caption defines train error over 45 steps and prediction error over 90 steps.
  • Results: Unstructured SymODEN performs better than HNN on train and prediction error per trajectory.The paper attributes the difference to error accumulation when HNN integrates estimated symplectic gradients into state predictions.
  • Results: HNN’s energy drifts instead of remaining constant, whereas its periodically zero MSE can reflect phase lag or lead rather than accurate prediction.The reported energy drift is attributed to inaccurate finite-difference approximation.

D EFFECTS OF THE TIME HORIZON τ

Longer time horizons produce better models because they penalize poor long-term predictions, but they require more training time. RK4 is selected because Euler is inaccurate and dopri5 offers similar errors at higher cost.

  • RK4 is chosen because Euler is insufficiently accurate, while dopri5 has similar errors but requires more training time.
  • Longer time horizons lead to better models by penalizing worse long-term predictions.
  • Longer time horizons require more time to train the models.

E FULLY-ACTUATED CARTPOLE AND ACROBOT

The learned model controls fully-actuated CartPole and Acrobot systems toward target configurations. CartPole reaches the inverted position and cart origin, while Acrobot reaches the upward position with q2 slightly offset from zero.

  • The experiments use fully-actuated versions of CartPole and Acrobot, although both original systems are underactuated.Control of underactuated systems is identified as future work.
  • The fully-actuated CartPole is controlled from a pole-below-horizon initial condition to the inverted position and cart origin.
  • Figures 8 and 10 show trajectory snapshots, while Figures 9 and 11 show state variables and control inputs over time.The figures use 0.3-second intervals for CartPole snapshots and 1-second intervals for Acrobot snapshots.
  • The fully-actuated Acrobot is controlled from the downward position to the upward position, with final q2 slightly away from zero.The model was learned using only 64 different initial state conditions.

F TEST ERRORS OF THE TASKS

The paper reports train, test, and prediction errors per trajectory across four tasks, using unseen initial conditions for testing and zero inputs for prediction evaluation.

  • Train, test, and prediction errors are reported per trajectory for all four tasks.
  • Training and testing use 64 initial state conditions with five constant inputs, while prediction uses the same training conditions with zero inputs.Each trajectory contains 20 steps, and test conditions are previously unseen initial states.
  • The comparison includes a geometric baseline alongside unstructured and Symplectic-ODE models.
Loading 1909.12077v5…