Literature
Display
← All papers

Compositional Learning of Dynamical System Models Using Port-Hamiltonian Neural Networks

Cyrus Neary · Ufuk Topcu

· Learning for Dynamics and Control 2023 ↗

Machine learning5 min text · CondensedOriginal paper ↗
Contents

At a glance

Port-Hamiltonian neural networks (PHNNs) learn subsystem energy, dissipation, and input effects, then compose those models through a power-conserving interconnection. When the coupling is known, no composite-system training data are needed; when a constant coupling is unknown, a small regression problem estimates it. Numerical spring–mass–damper experiments demonstrate two-component and ten-component compositions. The evidence concerns state-observed simulated systems, not learned robot control or video observations.

1 Introduction

Learning one model per physical component can reduce the data needed to model new assemblies. The port-Hamiltonian structure supplies a common interface for combining learned and analytical components while maintaining energy-accounting properties. The paper provides training procedures, a composition rule, and a bound relating composite vector-field error to subsystem and coupling errors.

∫Pθ1​(𝒙1,𝒖1)​𝑑t\int P_{\theta_{1}}({\bm{x}}_{1},{\bm{u}}_{1})dtSubmodel 11𝒙1{\bm{x}}_{1}𝒖1{\bm{u}}_{1}Δ​t\Delta t𝒙1′{\bm{x}}_{1}^{\prime}Training Algorithm 11Subsystem 11Training DataRefer to captionHθ1H_{\theta_{1}}, 𝑹θ1{\bm{R}}_{\theta_{1}}, 𝑮θ1{\bm{G}}_{\theta_{1}} Learned Components ⋮\vdots∫Pθk​(𝒙k,𝒖k)​𝑑t\int P_{\theta_{k}}({\bm{x}}_{k},{\bm{u}}_{k})dtSubmodel kk𝒙k{\bm{x}}_{k}𝒖k{\bm{u}}_{k}Δ​t\Delta t𝒙k′{\bm{x}}_{k}^{\prime}Training Algorithm kkSubsystem kkTraining DataRefer to captionHθkH_{\theta_{k}}, 𝑹θk{\bm{R}}_{\theta_{k}}, 𝑮θk{\bm{G}}_{\theta_{k}}Learned Components ∫Pθc​(𝒙c,𝒖c)​𝑑t\int P_{\theta_{c}}({\bm{x}}_{c},{\bm{u}}_{c})dtComposite Model𝒙c{\bm{x}}_{c}𝒖c{\bm{u}}_{c}Δ​t\Delta t𝒙c′{\bm{x}}_{c}^{\prime}Refer to caption[𝑱θc​(𝒙c)−𝑹θc​(𝒙c)]​∇𝒙cHθc​(𝒙c)+𝑮θc​(𝒙c)​𝒖c{\color[rgb]{0.3086,0.207,0.6094}[{\bm{J}}_{\theta_{c}}({\bm{x}}_{c})-{\bm{R}}_{\theta_{c}}({\bm{x}}_{c})]\nabla_{{\bm{x}}_{c}}H_{\theta_{c}}({\bm{x}}_{c})+{\bm{G}}_{\theta_{c}}({\bm{x}}_{c}){\bm{u}}_{c}}𝒙c=(𝒙1,…,𝒙k){\bm{x}}_{c}=({\bm{x}}_{1},\ldots,{\bm{x}}_{k}), 𝒖c=(𝒖1,…,𝒖k){\bm{u}}_{c}=({\bm{u}}_{1},\ldots,{\bm{u}}_{k})Known a Priori or Learned
Figure 1: An illustration of the compositional learning framework. We train separate port-Hamiltonian neural networks (PHNNs) on data generated by individual subsystems, presented in §4. We then compose these submodels to construct another PHNN that models the composite system, presented in §5.

2 Related Work

Neural differential equations and Hamiltonian models incorporate physical structure into learning. Port-Hamiltonian models additionally represent dissipation and external inputs. This work focuses on reusable composition of learned dynamics, whereas much previous work models a single system or learns controllers for already known dynamics. [4], [3], [27].

3 Port-Hamiltonian Systems

The state equation combines a skew-symmetric interconnection matrix, a positive-semidefinite dissipation matrix, the Hamiltonian gradient, and an input map. Skew symmetry conserves internal power; dissipation removes energy; the input–output pair accounts for supplied power. The formulation assumes finite-dimensional states without algebraic constraints.

Equation 1
𝒙˙=[𝑱⁡(𝒙)−𝑹⁡(𝒙)]​∇𝒙H​(𝒙)+𝑮⁡(𝒙)​𝒖,𝒚=𝑮​(𝒙)T​∇𝒙H​(𝒙)\dot{{\bm{x}}}=\left[{\bm{J}}({\bm{x}})-{\bm{R}}({\bm{x}})\right]\nabla_{{\bm{x}}}H({\bm{x}})+{\bm{G}}({\bm{x}}){\bm{u}},\;\;\;{\bm{y}}={\bm{G}}({\bm{x}})^{T}\nabla_{{\bm{x}}}H({\bm{x}})\\ (1)

3.1 An Illustrative Running Example: The Coupled Mass-Spring-Damper

Two separately modeled spring–mass–damper subsystems use spring elongation and momentum as state. Nonlinear damping is cubic in velocity. Their composite Hamiltonian is the sum of subsystem energies, while off-diagonal interconnection terms represent the force and motion coupling between the masses.

m1m_{1}Subsystem 1m2m_{2}𝒖2{\bm{u}}_{2}Subsystem 2m1m_{1}m2m_{2}𝒖2{\bm{u}}_{2}Composite System𝒙1=(Δ​q1,p1){\bm{x}}_{1}=(\Delta q_{1},p_{1}), 𝒙2=(Δ​q2,p2){\bm{x}}_{2}=(\Delta q_{2},p_{2}), 𝒙∥=(𝒙1,𝒙2){\bm{x}}_{\parallel}=({\bm{x}}_{1},{\bm{x}}_{2})Δ​q1\Delta q_{1}Δ​q2\Delta q_{2}
Figure 2: An illustrative coupled spring-mass-damper example. Two subsystems (left), with different spring and damping constants, are connected to obtain the composite system (right).
Equation 2
𝑱i=[01−10],𝑹i​(𝒙i)=[000bi​𝒑i2mi2],𝑮i=[01].{\bm{J}}_{i}=\begin{bmatrix}0&1\\ -1&0\end{bmatrix},\;\;{\bm{R}}_{i}({\bm{x}}_{i})=\begin{bmatrix}0&0\\ 0&b_{i}\frac{{\bm{p}}_{i}^{2}}{m_{i}^{2}}\end{bmatrix},\;\;{\bm{G}}_{i}=\begin{bmatrix}0\\ 1\end{bmatrix}. (2)

4 Port-Hamiltonian Neural Networks

Each subsystem learns only its unknown physical terms, then integrates the resulting differential equation to predict future states.

4.1 Constructing Port-Hamiltonian Neural Networks

A multilayer perceptron parameterizes energy, and automatic differentiation supplies its state gradient. Input maps may be constant parameters or state-dependent networks. Dissipation is represented as a matrix times its transpose to enforce positive semidefiniteness. Subsystem interconnection matrices are assumed known during this learning stage.

Autograd∇𝒙Hθ​(𝒙)\nabla_{{\bm{x}}}H_{\theta}({\bm{x}})Hθ​(𝒙)H_{\theta}({\bm{x}})𝑳θ​(𝒙)​𝑳θ​(𝒙)T{\bm{L}}_{\theta}({\bm{x}}){\bm{L}}_{\theta}({\bm{x}})^{T}𝑹θ​(𝒙){\bm{R}}_{\theta}({\bm{x}})𝑳θ​(𝒙){\bm{L}}_{\theta}({\bm{x}})[𝑱⁡(𝒙)−𝑹θ​(𝒙)]​∇𝒙Hθ​(𝒙)+𝑮θ​(𝒙)​𝒖{\color[rgb]{0,0,0}[{\bm{J}}({\bm{x}})-{\bm{R}}_{\theta}({\bm{x}})]\nabla_{{\bm{x}}}H_{\theta}({\bm{x}})+{\bm{G}}_{\theta}({\bm{x}}){\bm{u}}}PΘ​(𝒙,𝒖)P_{\Theta}({\bm{x}},{\bm{u}})𝑮θ​(𝒙){\bm{G}}_{\theta}({\bm{x}})ControlInput 𝒖{\bm{u}}𝒙{\bm{x}}InputStateODESolve\mathrm{ODESolve}State 𝒙′{\bm{x}}^{\prime} at future timePredictionTime TT
Figure 3: An illustration of the construction and evaluation of a port-Hamiltonian Neural Network.

PHNNs enforce the cyclo-passivity property by construction.

Skew-symmetric interconnection and positive-semidefinite dissipation ensure that the modeled energy increase cannot exceed supplied input power. This is cyclo-passivity; the unconstrained learned Hamiltonian need not satisfy every additional condition required for an ordinary nonnegative storage function.

4.2 Evaluating Port-Hamiltonian Neural Networks

A PHNN predicts a future state by numerically integrating its learned vector field from the observed state. Solver accuracy and cost affect the result; all experiments use fixed-step fourth-order Runge–Kutta integration.

4.3 Training Port-Hamiltonian Neural Networks

Subsystem parameters are fitted by minimizing errors between integrated predictions and observed trajectory transitions. Training differentiates through the model evaluation and may include regularization; the reported experiments use no additional regularization.

Equation 3
ℒ⁡(Θ,𝒟)=∑τl∈𝒟∑(𝒙i,𝒖i,ti)∈τl‖P​H​N​NΘ​(𝒙i,𝒖i,ti,ti+1)−𝒙i+1‖2.\mathcal{L}(\Theta,\mathcal{D})=\sum_{\tau_{l}\in\mathcal{D}}\sum_{({\bm{x}}_{i},{\bm{u}}_{i},t_{i})\in\tau_{l}}\|PHNN_{\Theta}({\bm{x}}_{i},{\bm{u}}_{i},t_{i},t_{i+1})-{\bm{x}}_{i+1}\|^{2}. (3)

5 Composing Port-Hamiltonian Neural Networks

Previously trained subsystem models are combined by assembling their physical terms, with only the inter-subsystem coupling supplied or learned separately.

5.1 Composing Models Using a Known Interconnection Structure

Composition sums subsystem Hamiltonians and places dissipation and input matrices on block diagonals. A skew-symmetric matrix with zero diagonal blocks adds cross-subsystem interactions. Each component energy must depend only on that component’s own state. The composite retains the structural energy-accounting properties.

5.2 Learning Compositions of Port-Hamiltonian Neural Network Submodels

Unknown coupling is learned while holding subsystem parameters fixed. A state-dependent coupling can use a neural parameterization; a constant skew-symmetric coupling gives linear equations from short-time transition data and can be fitted by least squares. The finite-difference approximation requires sufficiently small observation intervals.

Equation 4
𝒙i+1−𝒙iti+1−ti−[𝑱~c−𝑹c,θ​(𝒙c,i)]​∇𝒙cHc,θ​(𝒙c,i)+𝑮c,θ​(𝒙c,i)​𝒖c,i≈𝑪ϕ​∇𝒙Hc,θ​(𝒙c,i),\frac{{\bm{x}}_{i+1}-{\bm{x}}_{i}}{t_{i+1}-t_{i}}-\left[\tilde{{\bm{J}}}_{c}-{\bm{R}}_{c,\theta}({\bm{x}}_{c,i})\right]\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c,i})+{\bm{G}}_{c,\theta}({\bm{x}}_{c,i}){\bm{u}}_{c,i}\approx{\bm{C}}_{\phi}\nabla_{{\bm{x}}}H_{c,\theta}({\bm{x}}_{c,i}), (4)

5.3 Bounding the Errors of Composititions of Port-Hamiltonian Neural Networks

The stated theorem bounds composite vector-field error using subsystem dynamics errors, Hamiltonian-gradient errors, coupling-estimation errors, and coupling norms over prescribed domains. Known coupling removes the coupling-estimation term. This is a conditional error bound, not a guarantee that arbitrary learned energies or long rollout errors are small.

Equation 5
‖Pc𝑪​(𝒙c,𝒖c)−Pc,Θc𝑪ϕ​(𝒙c,𝒖c)‖≤∑i=1k[εi+2​∑j>ik(γi,j+σi,j​ηj)],\left\lVert P_{c}^{{\bm{C}}}({\bm{x}}_{c},{\bm{u}}_{c})-P^{{\bm{C}}_{\phi}}_{c,\Theta_{c}}({\bm{x}}_{c},{\bm{u}}_{c})\right\rVert\leq\sum_{i=1}^{k}\bigl[\varepsilon_{i}+2\sum_{j>i}^{k}(\gamma_{i,j}+\sigma_{i,j}\eta_{j})\bigr], (5)

6 Numerical Experiments

Numerical experiments study nonlinear spring–mass–damper systems with external forcing, using either known or estimated couplings.

6.1 Composing Port-Hamiltonian Neural Networks Using a Known Composition Term

Each of two subsystem models trains on 100 trajectories. Composite predictions use their learned components without composite training data. Plots report median errors and interquartile ranges over ten independent runs, using 20 held-out trajectories per test set.

Figure 4: original colored plot, with complete axes and legend.
Figure 4: Prediction loss values throughout training. The composite model makes accurate predictions without any training data from the composite system itself.

The composite model accurately predicts dynamics without data from the composite system.

Composite prediction error decreases alongside subsystem training error in the reported experiment. The blue curve is evaluation of a composition, not a separately trained composite model. No monolithic baseline is trained in this no-composite-data setting.

6.2 Learning the Interactions Between Subsystem Port-Hamiltonian Neural Networks

With subsystem models already trained, four single-step transitions from random composite states are used to estimate a constant interconnection by least squares. The resulting trajectories track the numerical ground truth closely in the illustrated test.

Figure 5: original colored plot, with complete axes and legend.
Figure 5: The composite PHNN accurately predicts state trajectories, even when the unknown composition term 𝑪ϕ{\bm{C}}_{\phi} is inferred using only four transition datapoints. Left: Predicted subsystem dynamics. Right: Predicted composite system dynamics.
Figure 6: original colored plot, with complete axes and legend.
Figure 6: Time derivative of the system’s Hamiltonian with no external control inputs.

We accurately learn the unknown composition term using a negligible amount of data.

The four-transition result demonstrates economical identification for this small, structured coupling problem. It does not mean the full subsystem dynamics were learned from four data points.

The learned composite model enjoys properties of port-Hamiltonian systems.

Without external forcing, the plotted learned Hamiltonian derivative remains nonpositive along the tested trajectory, consistent with the model’s structural cyclo-passivity.

6.3 Predicting the Dynamics of Ten Interacting Subsystems Without Additional Training

Reusing the two learned subsystem types in a ten-component chain predicts wave-like energy propagation under sinusoidal forcing. Neither subsystem retraining nor ten-component trajectory data are used; the new assembly’s coupling structure is supplied.

Figure 7: original colored plot, with complete axes and legend.
Figure 7: The composite PHNN accurately predicts the dynamics of 1010 interacting subsystems with no additional training.

7 Conclusions

Physics-informed interfaces enable modular reuse and compositions requiring little or no additional system data. Learning from video and using the composed models for feedback control are proposed next steps. The experiments are limited to numerical spring–mass–damper systems.

Appendix A Proof of Theorem 1

The proof separates total error into uncoupled subsystem error and an interaction term. Triangle inequalities and operator norms then bound coupling mismatch and Hamiltonian-gradient mismatch, giving the stated composite vector-field bound. The complete algebra is retained below.

Equations 6–19
‖Pc𝑪​(𝒙c,𝒖c)−Pc,Θc𝑪ϕ​(𝒙c,𝒖c)‖≤∑i=1k[εi+2​∑j>ik(γi,j+σi,j​ηj)],\left\lVert P_{c}^{{\bm{C}}}({\bm{x}}_{c},{\bm{u}}_{c})-P^{{\bm{C}}_{\phi}}_{c,\Theta_{c}}({\bm{x}}_{c},{\bm{u}}_{c})\right\rVert\leq\sum_{i=1}^{k}\bigl[\varepsilon_{i}+2\sum_{j>i}^{k}(\gamma_{i,j}+\sigma_{i,j}\eta_{j})\bigr], (6)
||Pc(𝒙c,\displaystyle||P_{c}({\bm{x}}_{c}, 𝒖c)−Pc,Θc𝑪ϕ(𝒙c,𝒖c)||\displaystyle{\bm{u}}_{c})-P^{{\bm{C}}_{\phi}}_{c,\Theta_{c}}({\bm{x}}_{c},{\bm{u}}_{c})|| (7)
=||[𝑱~c(𝒙c)+𝑪(𝒙c)−𝑹c(𝒙c)]∇𝒙cHc(𝒙c)+𝑮c(𝒙c)𝒖c\displaystyle=||\left[\tilde{{\bm{J}}}_{c}({\bm{x}}_{c})+{\bm{C}}({\bm{x}}_{c})-{\bm{R}}_{c}({\bm{x}}_{c})\right]\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c})+{\bm{G}}_{c}({\bm{x}}_{c}){\bm{u}}_{c} (8)
−[𝑱~c(𝒙c)+𝑪ϕ(𝒙c)+𝑹c,θ(𝒙c)]∇𝒙cHc,θ(𝒙c)+𝑮c,θ(𝒙c)𝒖c||\displaystyle\;\;\;\;\;-\left[\tilde{{\bm{J}}}_{c}({\bm{x}}_{c})+{\bm{C}}_{\phi}({\bm{x}}_{c})+{\bm{R}}_{c,\theta}({\bm{x}}_{c})\right]\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c})+{\bm{G}}_{c,\theta}({\bm{x}}_{c}){\bm{u}}_{c}||
≤||[𝑱~c(𝒙c)−𝑹c(𝒙c)]∇𝒙cHc(𝒙c)+𝑮c(𝒙c)𝒖c\displaystyle\leq||\left[\tilde{{\bm{J}}}_{c}({\bm{x}}_{c})-{\bm{R}}_{c}({\bm{x}}_{c})\right]\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c})+{\bm{G}}_{c}({\bm{x}}_{c}){\bm{u}}_{c} (9)
−[𝑱~c(𝒙c)−𝑹c,θ(𝒙c)]∇𝒙cHc,θ(𝒙c)−𝑮c,θ(𝒙c)𝒖c||\displaystyle\;\;\;\;\;-\left[\tilde{{\bm{J}}}_{c}({\bm{x}}_{c})-{\bm{R}}_{c,\theta}({\bm{x}}_{c})\right]\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c})-{\bm{G}}_{c,\theta}({\bm{x}}_{c}){\bm{u}}_{c}||
+‖𝑪⁡(𝒙c)​∇𝒙cHc​(𝒙c)−𝑪ϕ​(𝒙c)​∇𝒙cHc,θ​(𝒙c)‖\displaystyle\;\;\;+\left\lVert{\bm{C}}({\bm{x}}_{c})\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c})-{\bm{C}}_{\phi}({\bm{x}}_{c})\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c})\right\rVert
≤∑i=1k{||[𝑱i(𝒙i)−𝑹i(𝒙i)](∇𝒙cHc(𝒙c))ℐi+𝑮i(𝒙i)𝒖i\displaystyle\leq\sum_{i=1}^{k}\bigl\{||\left[{\bm{J}}_{i}({\bm{x}}_{i})-{\bm{R}}_{i}({\bm{x}}_{i})\right](\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c}))_{\mathcal{I}_{i}}+{\bm{G}}_{i}({\bm{x}}_{i}){\bm{u}}_{i}\bigr. (10)
−[𝑱i,θ(𝒙i)−𝑹i,θ(𝒙i)](∇𝒙cHc,θ(𝒙c))ℐi+𝑮i,θ(𝒙i)𝒖i||}\displaystyle\bigl.\;\;\;\;\;\;\;\;\;-\left[{\bm{J}}_{i,\theta}({\bm{x}}_{i})-{\bm{R}}_{i,\theta}({\bm{x}}_{i})\right](\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c}))_{\mathcal{I}_{i}}+{\bm{G}}_{i,\theta}({\bm{x}}_{i}){\bm{u}}_{i}||\bigr\}
+‖𝑪⁡(𝒙c)​∇𝒙cHc​(𝒙c)−𝑪ϕ​(𝒙c)​∇𝒙cHc,θ​(𝒙c)‖\displaystyle\;\;\;+\left\lVert{\bm{C}}({\bm{x}}_{c})\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c})-{\bm{C}}_{\phi}({\bm{x}}_{c})\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c})\right\rVert
(∇𝒙cHc​(𝒙c))ℐi=∑j=1k(∇𝒙cHj​(𝒙j))ℐi=∇𝒙iHi​(𝒙i).(\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c}))_{\mathcal{I}_{i}}=\sum_{j=1}^{k}(\nabla_{{\bm{x}}_{c}}H_{j}({\bm{x}}_{j}))_{\mathcal{I}_{i}}=\nabla_{{\bm{x}}_{i}}H_{i}({\bm{x}}_{i}). (11)
‖Pc​(𝒙c,𝒖c)−Pc,Θc𝑪ϕ​(𝒙c,𝒖c)‖\displaystyle||P_{c}({\bm{x}}_{c},{\bm{u}}_{c})-P^{{\bm{C}}_{\phi}}_{c,\Theta_{c}}({\bm{x}}_{c},{\bm{u}}_{c})|| ≤∑i=1k‖Pi​(𝒙i,𝒖i)−Pi,Θ​(𝒙i,𝒖i)‖\displaystyle\leq\sum_{i=1}^{k}||P_{i}({\bm{x}}_{i},{\bm{u}}_{i})-P_{i,\Theta}({\bm{x}}_{i},{\bm{u}}_{i})|| (12)
+‖𝑪⁡(𝒙c)​∇𝒙cHc​(𝒙c)−𝑪ϕ​(𝒙c)​∇𝒙cHc,θ​(𝒙c)‖\displaystyle\;\;\;\;\;+\left\lVert{\bm{C}}({\bm{x}}_{c})\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c})-{\bm{C}}_{\phi}({\bm{x}}_{c})\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c})\right\rVert
≤∑i=1kεi+‖𝑪⁡(𝒙c)​∇𝒙cHc​(𝒙c)−𝑪ϕ​(𝒙c)​∇𝒙cHc,θ​(𝒙c)‖.\displaystyle\leq\sum_{i=1}^{k}\varepsilon_{i}+\left\lVert{\bm{C}}({\bm{x}}_{c})\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c})-{\bm{C}}_{\phi}({\bm{x}}_{c})\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c})\right\rVert. (13)
||𝑪(𝒙c)\displaystyle||{\bm{C}}({\bm{x}}_{c}) ∇𝒙cHc(𝒙c)−𝑪ϕ(𝒙c)∇𝒙cHc,θ(𝒙c)||\displaystyle\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c})-{\bm{C}}_{\phi}({\bm{x}}_{c})\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c})|| (14)
≤‖(𝑪⁡(𝒙c)−𝑪ϕ​(𝒙c))​∇𝒙cHc​(𝒙c)‖+‖𝑪ϕ​(𝒙c)​(∇𝒙cHc​(𝒙c)−∇𝒙cHc,θ​(𝒙c))‖\displaystyle\leq||({\bm{C}}({\bm{x}}_{c})-{\bm{C}}_{\phi}({\bm{x}}_{c}))\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c})||+||{\bm{C}}_{\phi}({\bm{x}}_{c})(\nabla_{{\bm{x}}_{c}}H_{c}({\bm{x}}_{c})-\nabla_{{\bm{x}}_{c}}H_{c,\theta}({\bm{x}}_{c}))|| (15)
≤∑i=1j≠ik{||(𝑪(𝒙c)ℐi,ℐj−𝑪ϕ(𝒙c)ℐi,ℐj)∇𝒙jHj(𝒙j)||\displaystyle\leq\sum_{\begin{subarray}{c}i=1\\ j\neq i\end{subarray}}^{k}\bigl\{||({\bm{C}}({\bm{x}}_{c})_{\mathcal{I}_{i},\mathcal{I}_{j}}-{\bm{C}}_{\phi}({\bm{x}}_{c})_{\mathcal{I}_{i},\mathcal{I}_{j}})\nabla_{{\bm{x}}_{j}}H_{j}({\bm{x}}_{j})||\bigr. (16)
+||𝑪ϕ(𝒙c)ℐi,ℐj(∇𝒙jHj(𝒙j)−∇𝒙jHj,θ(𝒙j))||}\displaystyle\;\;\;\;\;\;\;\;\;\;\bigl.+||{\bm{C}}_{\phi}({\bm{x}}_{c})_{\mathcal{I}_{i},\mathcal{I}_{j}}(\nabla_{{\bm{x}}_{j}}H_{j}({\bm{x}}_{j})-\nabla_{{\bm{x}}_{j}}H_{j,\theta}({\bm{x}}_{j}))||\bigr\} (17)
≤2​∑i=1j>ik{γi,j+‖𝑪ϕ​(𝒙c)‖​‖∇𝒙jHj​(𝒙j)−∇𝒙jHj,θ​(𝒙j)‖}\displaystyle\leq 2\sum_{\begin{subarray}{c}i=1\\ j>i\end{subarray}}^{k}\bigl\{\gamma_{i,j}+||{\bm{C}}_{\phi}({\bm{x}}_{c})||\;||\nabla_{{\bm{x}}_{j}}H_{j}({\bm{x}}_{j})-\nabla_{{\bm{x}}_{j}}H_{j,\theta}({\bm{x}}_{j})||\bigr\} (18)
≤2​∑i=1j>ikγi,j+σi,j​ηj\displaystyle\leq 2\sum_{\begin{subarray}{c}i=1\\ j>i\end{subarray}}^{k}\gamma_{i,j}+\sigma_{i,j}\eta_{j} (19)

Appendix B Additional Experimental Details

The supplement specifies simulation generation, network sizes, optimization, and hardware.

B.1 Simulation Details

Fourth-order Runge–Kutta simulation uses a 0.01-second step. Each training set has 100 trajectories of 500 steps, with initial elongations and momenta sampled from bounded intervals; test sets contain 20 trajectories. Sinusoidal inputs excite the controlled subsystem and composite system. The source’s second damping-parameter entry is malformed, so the explicit matrices and supplied code are preferable for exact reproduction.

Equations 20–21
𝑱i=[01−10],𝑹i​(𝒙i)=[000bi​𝒑i2mi2],𝑮i=[01],{\bm{J}}_{i}=\begin{bmatrix}0&1\\ -1&0\end{bmatrix},\;\;{\bm{R}}_{i}({\bm{x}}_{i})=\begin{bmatrix}0&0\\ 0&b_{i}\frac{{\bm{p}}_{i}^{2}}{m_{i}^{2}}\end{bmatrix},\;\;{\bm{G}}_{i}=\begin{bmatrix}0\\ 1\end{bmatrix}, (20)
𝑱c=[0100−10100−10100−10],𝑹c​(𝒙c)=[00000b1​𝒑12m12000000000b2​𝒑22m22],𝑮c=[00100001].{\bm{J}}_{c}=\begin{bmatrix}0&1&0&0\\ -1&0&1&0\\ 0&-1&0&1\\ 0&0&-1&0\end{bmatrix},\;\;{\bm{R}}_{c}({\bm{x}}_{c})=\begin{bmatrix}0&0&0&0\\ 0&b_{1}\frac{{\bm{p}}_{1}^{2}}{m_{1}^{2}}&0&0\\ 0&0&0&0\\ 0&0&0&b_{2}\frac{{\bm{p}}_{2}^{2}}{m_{2}^{2}}\end{bmatrix},\;\;{\bm{G}}_{c}=\begin{bmatrix}0&0\\ 1&0\\ 0&0\\ 0&1\end{bmatrix}. (21)

B.2 Neural Network Implementations

Energy and dissipation networks use two hidden layers of 32 tanh units; constant input-matrix entries are learned directly. JAX supplies differentiation and compilation. Adam uses learning rate 0.001 and minibatches of 32, with no additional loss regularization.

Concept demonstration

Open image ↗