General Hamiltonian Neural Networks for Dynamic Modeling: Handling Sophisticated Constraints Automatically and Achieving Coordinates Free
Yanfang Liu,Xu Wang,Yituo Song,Bo Wang,Desong Du
DOI: https://doi.org/10.1109/TNNLS.2024.3409567
2024-09-04
Abstract:Embedding the Hamiltonian formalisms into neural networks (NNs) enhances the reliability and precision of data-driven models, in which substantial research has been conducted. However, these approaches require the system to be represented in canonical coordinates, i.e., observed states should be generalized position-momentum pairs, which are typically unknown. This poses limitations when the method is applied to real-world data. Existing methods tackle this challenge through coordinate transformation or designing complex NNs to learn the symplectic phase flow of the state evolution. However, these approaches lack generality and are often difficult to train. This article proposes a versatile framework called general Hamiltonian NN (GHNN), which achieves coordinates free and handles sophisticated constraints automatically with concise form. GHNN employs two NNs, namely, an HNet to predict the Hamiltonian quantity and a JNet to predict the interconnection matrix. The gradients of the Hamiltonian quantity with respect to the input coordinates are calculated using automatic differentiation and are then multiplied by the interconnection matrix to obtain state differentials. Subsequently, ordinary differential equations (ODEs) are solved by numerical integration to provide state predictions. The accuracy and versatility of the GHNN are demonstrated through several challenging tasks, including the nonlinear simple and double pendulum, coupled pendulum, and real 3-D crane dynamic system.