원시데이터 수집 시스템
선정목록으로

Learning the dynamics of particle-based systems with Lagrangian graph neural networks

관련 모빌리티 소재 · (2) 샤무드(인공피혁)

기본 정보

저자
  1. Ravinder Bhattoo — Department of Civil Engineering, Indian Institute of Technology Delhi, Hauz Khas, New Delhi 110016, India
  2. Sayan Ranu — Department of Computer Science and Engineering, Indian Institute of Technology Delhi, Hauz Khas, New Delhi 110016, India|||Yardi School of Artificial Intelligence, Indian Institute of Technology Delhi, Hauz Khas, New Delhi 110016, India
  3. N. M. Anoop Krishnan — Department of Civil Engineering, Indian Institute of Technology Delhi, Hauz Khas, New Delhi 110016, India|||Yardi School of Artificial Intelligence, Indian Institute of Technology Delhi, Hauz Khas, New Delhi 110016, India
DOI
10.1088/2632-2153/acb03e
저널
Machine Learning Science and Technology
발행년도
2023
발행기관
IOP Publishing
피인용수
13
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1088/2632-2153/acb03e
토픽
Fuel Cells and Related Materials
OpenAlex ID
W4313592055

평가 내용

관련도
관련
사업분야
모빌리티 소재 · (2) 샤무드(인공피혁)
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '모빌리티 소재 > 샤무드(인공피혁)' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Abstract Physical systems are commonly represented as a combination of particles, the individual dynamics of which govern the system dynamics. However, traditional approaches require the knowledge of several abstract quantities such as the energy or force to infer the dynamics of these particles. Here, we present a framework, namely, Lagrangian graph neural network ( LGnn ), that provides a strong inductive bias to learn the Lagrangian of a particle-based system directly from the trajectory. We test our approach on challenging systems with constraints and drag— LGnn outperforms baselines such as feed-forward Lagrangian neural network ( Lnn ) with improved performance. We also show the zero-shot generalizability of the system by simulating systems two orders of magnitude larger than the trained one and also hybrid systems that are unseen by the model, a unique feature. The graph architecture of LGnn significantly simplifies the learning in comparison to Lnn with ∼25 times better performance on ∼20 times smaller amounts of data. Finally, we show the interpretability of LGnn , which directly provides physical insights on drag and constraint forces learned by the model. LGnn can thus provide a fillip toward understanding the dynamics of physical systems purely from observable quantities.

본문 37,301자

본문 펼치기
Physical systems are commonly represented as a combination of particles, the individual dynamics of which govern the system dynamics. However, traditional approaches require the knowledge of several abstract quantities such as the energy or force to infer the dynamics of these particles. Here, we present a framework, namely, Lagrangian graph neural network (LGnn), that provides a strong inductive bias to learn the Lagrangian of a particle-based system directly from the trajectory. We test our approach on challenging systems with constraints and drag-LGnn outperforms baselines such as feed-forward Lagrangian neural network (Lnn) with improved performance. We also show the zero-shot generalizability of the system by simulating systems two orders of magnitude larger than the trained one and also hybrid systems that are unseen by the model, a unique feature. The graph architecture of LGnn significantly simplifies the learning in comparison to Lnn with ∼25 times better performance on ∼20 times smaller amounts of data. Finally, we show the interpretability of LGnn, which directly provides physical insights on drag and constraint forces learned by the model.LGnn can thus provide a fillip toward understanding the dynamics of physical systems purely from observable quantities. Introduction Modeling physical systems involves solving the differential equations governing their dynamics [1]. These equations, in turn, assumes the knowledge on the functional form of abstract quantities representing the system such as the forces, energy, Lagrangian or Hamiltonian and parameters associated with them [2]. Recently, it has been shown that these dynamics can learned directly from the data using data-driven and physics-informed neural networks (PINN) [3,4,5,6,7], which significantly simplifies the model development of complex physical systems. Introduction Among PINNs, a particular family of interest is the Lagrangian (Lnns) and Hamiltonian neural networks (Hnns), where a neural network is parameterized to learn the Lagrangian (or Hamiltonian) of the system directly from the trajectory [6,8,9,5,4,10,11]. The dynamics simulated by Lnn and Hnn has been shown to preserve their own energy during roll-out, thereby respecting basic physical laws. Finzi et al. [8] showed that formulating Lnns in Cartesian coordinates with explicit constraints simplifies the learning process. Similarly, Zhong et al. [12,13,14] extended Hnns to dissipitative systems, contacts, and videos making the simulations more realistic. In Lnns, it is assumed that since both the predicted and trained Lnns exhibit energy conservation, their energy do not diverge during the roll-out. However, it has been shown that the energy violation in Lnns and Hnns grow with the trajectory [15]. Moreover, these approaches have been demonstrated on systems where the number of degrees of freedom are not large [6,8,9,15]. The error in energy violation is empirically shown to increase with the system size [15]. Thus, extending these models to realistic systems with large degrees of freedom is posed as a challenging problem. Introduction An approach that has received lesser attention in physical systems is to learn their dynamics based on the topology [7,16]. To this extent, graph-based simulators have been used in physical and molecular systems, successfully [7,16,4,17,18]. Here, the dynamics of a system can be broken down to the dynamics of its individual components, which are then bound together based on their topological constraints. This raises an interesting question: can we learn the dynamics of physical systems directly from their trajectory and infer it on significantly larger ones, while preserving the desirable physical laws such as energy and momentum conservation? Introduction To address this challenge, here, we propose a Lagrangian graph neural network (LGnn), where we represent the physical system as a graph. Further, inspired from physics, we model the kinetic and potential energy at the node and edge levels, which is then aggregated to compute the total Lagrangian of the system. To model realistic systems, we extend the formulation of Lnns to include Pfaffian constraints, dissipative forces such as friction and drag, and external forcescrucial in applications such as robotics, and computer graphics. Our approach significantly simplifies the learning and improves the performance on complex systems and exhibits generalizability to unseen time steps, system sizes, and even hybrid systems. Theory and Architecture Lagrangian formulation of particle systems The Lagrangian formulation presents an elegant framework to predict the dynamics of an entire system, based on a single scalar function known as the Lagrangian L (see Methods section for details). The general form of Euler-Lagrange (EL) equation considering Pfaffian constraints, drag or other dissipative forces, and external force can be written as Lagrangian formulation of particle systems where M = ∂ ∂q ∂L ∂q represents the mass matrix, C = ∂ ∂q ∂L ∂q represents Coriolis-like forces, Π = ∂L ∂q represents the conservative forces derivable from a potential, and A(q) ∈ R k×D represents k velocity constraints (see Supplementary material for details). The acceleration of a particle can then be computed as Lagrangian formulation of particle systems (2) which can be integrated to obtain the updated configurations. Thus, once the Lagrangian of a system is learned, the trajectory of a system can be inferred using the Eq. 16. Lagrangian formulation of particle systems In this work, we employ a Lagrangian graph neural network (LGnn) to learn the Lagrangian of the system directly from its trajectory. An overview of the LGnn framework, along with example systems, is provided in Fig. 1. The graph topology is used to predict the Lagrangian L, and non-conservative forces such as drag Υ. This is combined with the constraints and any external forces in the EL equation to predict the future state. The parameters of the model are learned by minimizing the mean squared error (MSE) over the predicted and true positions across all the particles in the system ( Eq. 7). We next discuss the neural architecture of LGnn to predict the Lagrangian. Neural Architecture of LGnn The neural architecture of LGnn is outlined in Fig. 2. The aim of the LGnn is to directly predict the Lagrangian of a physical system while accounting for its topological features. As such, the creation of a graph structure that corresponds to the physical system forms the most important step. To explain the idea better, we will use the running examples of two systems: (i) a double pendulum and (ii) two balls connected by a spring, that represent two distinct cases of systems with rigid and deformable connections. Graph structure. The state of an n-body system is represented as a undirected graph, G = {U, E}, where nodes u i ∈ U represents the particles, | U |= n, and e ij ∈ E represents edges corresponding to constraints or interactions. In our running examples, the nodes correspond to the pendulum bobs and balls, respectively, and the edges correspond to the pendulum rods and springs, respectively. Note that the edges of the graphs may be predefined as in the case of a pendulum or spring system. The edges may also be defined as a function of the distance between two nodes such as Neural Architecture of LGnn is a distance function over node positions and θ is a distance threshold. This allows a dynamically changing edge set based on a cutoff distance as in the case of a realistic breakable spring. Input features. Each node u i ∈ U is characterized by its type t i , position q i = (x i , y i , z i ), and particle velocity (q i ). The type t i is a discrete variable and is useful in distinguishing particles of different characteristics within a system (Ex. two different types of balls). For each edge e ij , we store an edge weight Neural Architecture of LGnn Finally, we note that the node input features are classified into two: global and local features. Global features are the ones that are not relevant to the topology and hence are not included in message passing. In contrast, local features are the ones that are involved in message passing. In our running example, while particle type is a local feature, particle position and velocity are global features. Pre-Processing: In the pre-processing layer, we construct a dense vector representation for each node u i and edge e ij using MLP em as: Neural Architecture of LGnn squareplus is an activation function. As the acceleration of the particles is obtained using the EL equation, our architecture requires activation functions that are doubly-differentiable and hence, squareplus is an appropriate choice. In our implementation, we use different MLP em s for node representation corresponding to kinetic energy, potential energy, and drag. For brevity, we do not separately write the MLP em s in Equation 3. Neural Architecture of LGnn Kinetic energy and drag prediction. Since the graph uses Cartesian coordinates, the mass matrix is diagonal and the kinetic energy τ i of a particle depends only on the velocityq i and mass m i of the particle. Here, we learn the parameterized masses of each particle type based on the embedding h 0 i . Thus, the τ i of a particle is predicted as τ i = squareplus(MLP τ (h 0 i q i )), where represent the concatenation operator, MLP τ represents an MLP for learning the kinetic energy function, and squareplus represents the activation function. The total kinetic energy of the system is computed as T = n i=1 τ i . The drag of a particle also typically depends linearly or quadratically to the velocity of the particle. Here, we compute the total drag of a system as Υ = n i squareplus(MLP Υ (h 0 i q i )). Note that while T directly goes into the prediction of L, Υ is featured in the EL equation. Potential energy prediction. In many cases, the potential energy of a system is closely dependent on the topology of the structure. To capture this information, we employ multiple layers of message-passing between the nodes and edges. In the l th layer of message passing, the node embedding is updated as: Neural Architecture of LGnn where, N i = {u j ∈ U | (u i , u j ) ∈ E} are the neighbors of u i . W l U is a layerspecific learnable weight matrix. h l ij represents the embedding of incoming edge e ij on u i in the l th layer, which is computed as follows. Neural Architecture of LGnn Similar to W l U , W l E is a layer-specific learnable weight matrix specific to the edge set. The message passing is performed over L layers, where L is a hyperparameter. The final node and edge representations in the L th layer are denoted as z i = h L i and z ij = h L ij respectively. 5 The total potential energy of an n-body system is represented as V = 5 where v i represents the energy of u i due to its position and v ij represents the energy due to interaction e ij . In our running example, v i represents the potential energy of a bob in the double pendulum due to its position in a gravitational field, while v ij represents the energy of the spring connected with two particles due to its expansion and contraction. In 5 Although not used in the present case, sometime v i can be a function of the local features dependent on the topology. For instance, in atomic systems, the charge of an atom can be dependent on neighboring atoms and hence the potential energy due to these charges can be considered as a combination of topology-dependent features along with the global features. In such cases, v i is predicted as 5 where MLP mp represents the node M LP associated with the message-passing graph architecture. Trajectory prediction and training. Based on the predicted V, T , and Υ, the accelerationq i is computed using the EL Equation 16. The loss function of LGnn is on the predicted and actual accelerations at timesteps 2, 3, . . . , T in a trajectory T, which is then back-propagated to train the MLPs. Specifically, the loss function is as follows. The loss function of Here, (q T,t i ) is the predicted acceleration for the i th particle in trajectory T at time t andq T,t i is the true acceleration. T denotes a trajectory from T, the set of training trajectories. It is worth noting that the accelerations are computed directly from the position using the velocity-Verlet update and hence training on the accelerations is equivalent to training on the updated positions. Experimental systems n-Pendulum In an n-pendulum system, n-point masses, representing the bobs, are connected by rigid bars which are not deformable. These bars, thus, impose a distance constraint between two point masses as Experimental systems n-Pendulum where, l i represents the length of the bar connecting the (i − 1) th and i th mass. This constraint can be differentiated to write in the form of a P f af f ian constraint as Experimental systems n-Pendulum Note that such constraint can be obtained for each of the n masses considered to obtain the A(q). 6 The Lagrangian of this system has contributions from potential energy due to gravity and kinetic energy. Thus, the Lagrangian can be written as 6 where g represents the acceleration due to gravity in the y direction. n-spring system 6 In this system, n-point masses are connected by elastic springs that deform linearly with extension or compression. Note that similar to a pendulum setup, each mass m i is connected only to two masses m i−1 and m i+1 through springs so that all the masses form a closed connection. The Lagrangian of this system is given by 6 where r 0 and k represent the undeformed length and the stiffness, respectively, of the spring. Hybrid system The hybrid system is a combination of the pendulum and spring system. In this system, a double pendulum is connected to two additional masses through four additional springs as shown in Figure 1 with gravity in y direction. The constraints as present in the pendulum system are present in this system as well. Hybrid system The Lagrangian of this four-mass system is Hybrid system where m 1 and m 2 represent masses in the double pendulum and m 3 and m 4 represent masses connected by the springs. Hybrid system Theorem 1 In the absence of an external field, LGnn exactly conserves the momentum of a system. Hybrid system A detailed proof is given in Supplementary Material B. As shown empirically later, this momentum conservation in turn reduces the energy violation error in Hybrid system LGnn. Implementation details Dataset generation All the datasets are generated using the known Lagrangian of the pendulum and spring systems, along with the constraints, as described in Section . For each system, we create the training data by performing forward simulations with 100 random initial conditions. For the pendulum and hybrid systems, a timestep of 10 −5 s is used to integrate the equations of motion, while for the spring system, a timestep of 10 −3 s is used. The velocity-verlet algorithm is used to integrate the equations of motion due to its ability to conserve the energy in long trajectory integration. Implementation details All 100 simulations for pendulum and spring system were generated with 100 datapoints per simulation. The was datapoints were collected every 1000 and 100 timesteps for the pendulum and spring systems, respectively. Thus, each training trajectory of the spring and pendulum systems are 10s and 1s long, respectively. It should be noted that in contrast to the earlier approach, here, we do not train from the trajectory. Rather, we randomly sample different states from the training set to predict the acceleration. For simulating drag, the training data is generated for systems without drag and with linear drag given by −0.1q, for each particle. Architecture For Lnn, we follow a similar architecture suggested in the literature [6,8]. Specifically, we use a fully connected feedforward neural network with 2 hidden layers each having 256 hidden units with a square-plus activation function. For Architecture LGnn, all the MLPs consist of two layers with 5 hidden units, respectively. Thus, LGnn has significantly lesser parameters than Lnn. The message passing in the LGnn was performed for two layers in the case of pendulum and one layer in the case of spring. Architecture The kinetic energy term in Lnn is handled as in the earlier case where in the parametrized masses are learned as a diagonal matrix. In the case of Architecture LGnn, the masses are directly learned from the one-hot embedding of the nodes. Interestingly, we observe that the mass matrix exhibits a diagonal nature in Architecture LGnn without enforcing any conditions due to its topology-aware nature. Training details The training dataset is divided in 75:25 ratio randomly, where the 75% is used for training and 25% is used as the validation set. Further, the trained models are tested on its ability to predict the correct trajectory, a task it was not trained on. Specifically, the pendulum systems are tested for 10s, that is 10 6 timesteps, and spring systems for 20s, that is 2 × 10 4 timesteps on 100 different trajectories created from random initial conditions. All models are trained for 10000 epochs with early stopping. A learning rate of 10 −3 was used with the Adam optimizer for the training. The performance of both L 1 and L 2 loss Empirical Evaluations LGnn for n-pendulum and n-spring systems Empirical Evaluations In this section, we evaluate LGnn and establish that, (1) LGnn is more accurate than Lnn in modeling physical systems, and (2) owing to topology-aware inductive modeling, LGnn generalizes to unseen systems, hybrid systems with no deterioration in efficacy for increasing system sizes. In order to evaluate the performance of LGnn, we first consider two standard systems, that has been widely studied in the literature, namely, n-pendulum and n-spring systems [6,8,9,4], with n = (3,4,5). Following the work of [8], we evaluate performance by computing the relative error in (1) the trajectory, known as the rollout error, given by RE(t) = ||q(t) − q(t)|| 2 /(||q(t)|| 2 + ||q(t)|| 2 ) and (2) energy violation error given by ||Ĥ − H|| 2 /(||Ĥ|| 2 + ||H|| 2 ). The training data is generated for systems without drag and with linear drag given by −0.1q, for each particle. The timestep used for the forward simulation of the pendulum system is 10 −5 s with the data collected every 1000 timesteps and for the spring system is 10 −3 s with the data collected every 100 timesteps. The details of the experimental systems, data-generation procedure, the hyperparameters and training procedures are provided in the Methods section. Empirical Evaluations LGnn is compared with (1) Lnn in Cartesian coordinates with constraints as proposed by [8], which gives the state-of-the-art performance. Since, Cartesian coordinates are used, the parameterized masses are learned as a diagonal matrix as performed in [8]. In addition, LGnn is also compared with two other graph-based approaches suggested in [6,5], named as (2) Lagrangian graph network (Lgn), and (3) Graph network simulator (Gns). Lgn exploits a graph architecture to predict the Lagrangian of the physical system, which is then used in the EL equation. Gns uses the position and velocity of the particles to directly predict their updates for a future timestep [4]. For both these approaches, since no details of the exact architecture is provided [6,5], a full graph network is employed [16]. All the simulations and training were performed in the JAX environment [18]. The graph architecture of LGnn was developed using the jraph package [19]. All the codes related to dataset generation and training are available as Supplementary Material. Figure 3 shows the energy violation and rollout error of LGnn and Lnn for pendulum and spring systems with 3, 4, and 5 links without drag on each of the particles. For the pendulum system, LGnn is trained on 3-pendulum and for spring, LGnn is trained on 5-spring systems. The trained LGnn is used to perform the forward simulation on the other unseen systems. In contrast, the Lnns are trained and tested on the same systems. We observe that the Figure 3 shows the energy violation and rollout error of LGnn exhibits comparable rollout error with Lnn for pendulum system, even on unseen systems. Further, LGnn exhibits significantly lower rollout error for spring systems-where the topology plays a crucial role-giving superior performance than Lnns consistently. Due to the chaotic nature of these systems, it is expected that the rollout error diverges. However, energy violation error gives a better evaluation of the realistic nature of the predicted trajectory. Interestingly, we note that the energy violation error is fairly constant for LGnn for both pendulum and spring systems. Moreover, the error on both seen and unseen systems are comparable suggesting a high degree of generalizability for Figure 3 shows the energy violation and rollout error of LGnn. The geometric mean of energy violation error and rollout error of Lnn and LGnn for systems with and without drag are provided in the Supplementary material. Figure 3: Energy violation (left) and rollout error (right) of LGnn (red) and Lnn (blue) for pendulum and spring systems having 3, 4, and 5 links and subjected to linear drag. Note that the LGnns for pendulum and springs are trained on 3 and 5 links, respectively, and tested on all the systems. Lnns are trained and tested separately on each of the systems. Shaded region shows the 95% confidence interval from 100 initial conditions. 11 Figure 4: (a) Energy violation and (b) rollout error for 5, 50, and 500 spring system with LGnn trained on 5 spring system. Shaded region shows the 95% confidence interval from 100 initial conditions. Generalizability Now, we examine the ability of LGnn to push the limits of the current approaches. A regular Lnn uses a feed-forward NN to take the entire q,q as the input and then predicts the Lagrangian. Owing to this design, the number of model parameters grows with the input size. Hence, an Lnn trained on an n-sized system cannot be applied for inference on an n -sized system, where n = n . This makes Lnn transductive in nature. In contrast, LGnn is inductive, wherein the parameter space remains constant with system size. This is a natural consequence of our design where the learning happens at node and edge levels. Hence, given an arbitrary-sized system, we only need to predict the potential and kinetic energies at each node and edge, which we then aggregate to predict the combined energies at a system level. Further, a complex system that is unseen, if divisible into multiple sub-graphs with each sub-graph representing a learned system, the LGnn on 3-spring system. Generalizability overall system can be simulated with zero-shot generalizability. Figure 4 shows the energy and rollout error of spring systems with 5, 50, 500 links using LGnn, Lgn and Gns trained on 5-spring system. We observe that LGnn performs significantly better than the other baselines. Note that the results of Lgn for 500 springs is not included due to significantly increased computational time for the forward simulation in comparison to the other models. In addition to the rollout error, we observe that the energy violation error of Generalizability LGnn remains constant with low values even for systems that are 2 orders of magnitude larger than the training set. This suggests that the LGnn can produce realistic trajectories on large scale systems when trained on much smaller systems. These results also establish the superior nature of LGnn architecture, which exhibits improved performance with higher computational efficiency. The performance of similar systems with drag is provided in the Supplementary Material. Generalizability To test generalizability to an unseen system, we consider a hybrid system with 2-pendulum-4-springs as shown in Figure 1. The LGnns trained on the 5-spring and 3-pendulum systems are used to model the hybrid system. Specifically, the V of the physical system is considered as the union of the V of two subgraphs, one representing the pendulum system and the other representing the spring systems. Then, the computed V is substituted in the EL equation to simulate the forward trajectory. Figure 5 Interpretability and data efficiency The trained Interpretability and data efficiency LGnn provides interpretability, thanks to the graph structure. That is, since the computations of LGnn are carried out at the node and edge levels, the functions learned at these level can be used to gain insight into the behavior of the system. Further, the parameterized masses of the systems are learned directly during the training of LGnn, leading to a diagonal mass matrix. This is in contrast to Lnn where the prior information that mass matrix remains diagonal in the Cartesian coordinates is imposed to make the learning simpler [8]. Figure 5(c) shows the learned drag force as a function of velocity. We observe that the neural network has learned the drag in excellent agreement with the ground truth. Thus, in cases of systems where the ground truth is unknown, the learned drag can provide insights into the nature of dissipative forces in the system. Similarly, the λ learned during the training directly provides insights into the magnitude of the constraint forces. Interpretability and data efficiency Finally, we analyze the efficiency of LGnn to learn from the training data. To this extent, we train both the models on a 3-spring system with (100, 500, 1000, 5000, 10000) datapoints. Figure 5(d) shows the geometric mean of relative error on the trajectory of the system. We observe that LGnn consistently outperforms Lnn, Further, the performance of LGnn saturates with 500 datapoints. In addition, LGnn trained on these 500 datapoints exhibits ∼25 and ∼3 times better performance in terms of geometric relative error than Lnn trained on 500 and 10000 datapoints. This confirms that the topologyaware LGnn can learn efficiently from small amounts of data, still yield better performance than Lnn. Conclusions and outlook Altogether, we demonstrate a novel graph architecture, namely LGnn, which can learn the dynamics of systems directly from the trajectory, while exhibiting superior energy and momentum conservation. We show that the LGnn can generalize to any system size ranging orders of magnitude, when learned on a small system. Further, LGnn can even simulate unseen hybrid systems when trained on the systems independently. Finally, we also show that LGnn exhibits better data-efficiency, learning from smaller amounts of data in comparison to the original Lnn. Conclusions and outlook There are several future directions that the present work opens up. The LGnn, at present, is limited to systems without collisions and other deformations. Extending Conclusions and outlook LGnn to handle elastic and plastic deformations in addition to collisions can significantly widen the application areas. Further, LGnn assumes the knowledge of constraints. Automating the learning of the constraints while training the model using neural networks can provide a new paradigm to learn the constraints along with the Lagrangian. The graph nature of LGnn can potentially supplement the learning of constraints. Although, the message passing in LGnn is translationally and rotationally invariant, the expressive power is limited as only the distance is given as the edge feature. Enhancing the feature representation, and message passing through architectural modifications as in the case of equivariant Gnns can increase the applicability to more complex applications such as atomistic simulations of materials. Data and code availability All the codes related to dataset generation and training are made are available as Supplementary Material. Preliminaries on Learning Dynamical Systems The time evolution or dynamics of the state (q(t),q(t)) of a physical system can be represented asq = F (q,q, t), where q,q ∈ R D is a function of time (t) for a system with D degrees of freedom. The future states or trajectory of the system can be predicted by integrating these equations to obtain q(t + 1) and so on. While there are several physics-based methods for generating the dynamics of the system such as d'Alembert's principle, Newtonian, Lagrangian, or Hamiltonian approaches, all these approaches result in the equivalent sets of equations [20]. Preliminaries on Learning Dynamical Systems The Lagrangian formulation presents an elegant framework to predict the dynamics of an entire system, based on a single scalar function known as the Lagrangian L. The standard form of Lagrange's equation for a system with holonomic constraints is given by d dt ∂L ∂qi − ∂L ∂qi = 0, where, i = 1, 2, 3, . . . , D, and the Lagrangian is L(q,q, t) = T (q,q, t) − V(q, t) with T (q,q, t) and V(q, t) representing the total kinetic energy of the system and the potential function from which generalized forces can be derived. Accordingly, the dynamics of the system can be represented using Euler-Lagrange (EL) equations asq Preliminaries on Learning Dynamical Systems In Lnn, the Lagrangian of a system is learned using a neural network by training on the acceleration of the system. Once trained, the Lnn, along with EL equations, provide the forward trajectory of the system. Lnns are highly desirable for modeling physical systems due to their energy-conserving nature, a consequence of modeling acceleration directly from the EL equations. However, as we demonstrate later, while Lnns conserve the energy of their own trajectory, it is not guaranteed that the predicted energy and ground truth are comparable, even for a well trained Lnn. Lagrangian mechanics with Pfaffian Constraints, and Dissipation The Lnn formulation presented in Section , although powerful, is restricted to systems: (i) without any external forces, (ii) with generalized forces that are derivable from a potential function, (iii) without any dissipation such as friction or drag, and (iv) having holonomic constraints. To address these limitations, we extend the formulation of Lnns as detailed below [20,1]. Pfaffian Constraints. Holonomic constraints restrict the allowable configurations of a system to a smooth hyper-surface that satisfies the constraints. The trajectory of the system is governed by the algebraic constraints in terms of the positions and are enforced by the constraint forces associated with each constraint. For example, the movement of the bob in a 2D-pendulum is restricted by its rod following the equation (x 2 − y 2 ) = l 2 , where (x, y) represents the coordinate of the bob with the pin at the origin and l is the length of the bar. Here, the constraint is enforced by the forces in the bar and represents a holonomic constraint. However, in some cases the constraints may depend not on the position, but on the velocities of system. For example, in multi-fingered grasping, the velocity of two or more fingers are constrained so that the combined geometry formed is able to catch or hold an object. Such constraints, known as Pfaffian constraints, can be expressed as Lagrangian mechanics with Pfaffian Constraints, and Dissipation where, A(q) ∈ R k×D represents k velocity constraints. Note that a holonomic constraint can also be written as a Pfaffian constraint. For instance, the holonomic constraint of a pendulum can be written in the Pfaffian form as xẋ+yẏ = 0. More generally, an integrable Pfaffian constraint is a holonomic constraint, while a non-integrable one is a non-holonomic constraint. Dissipation and external forces. Physical systems are constantly subjected to dissipative forces, Υ such as drag, and friction. For instance, a system through a fluid such as air of water may be subjected to linear (c 1q , Stoke's law) or quadratic (c 2q 2 , air drag) drag forces resulting in energy dissipation. Similarly, a system may be additionally subjected to external forces F at different degrees of freedom due to interactions with the environment. Modified Euler-Lagrange Equation. Considering the additional forces mentioned above, the modified EL equation can be written as: Modified Euler-Lagrange Equation. where A T forms a non-normalized basis for the constraint forces, λ ∈ R k , known as the Lagrange multipliers, gives the relative magnitudes of these force constraints, Υ represents the non-conservative forces, such as friction, which are not directly derivable from a potential, and F represents any external forces acting on the system. This equation can be modified to obtainq as: Modified Euler-Lagrange Equation. where M = ∂ ∂q ∂L ∂q represents the mass matrix, C = ∂ ∂q ∂L ∂q represents Coriolis-like forces, and Π = ∂L ∂q represents the conservative forces derivable from a potential. Differentiating the constraint Equation (13) gives A(q)q +Ȧ(q)q = 0. Solving for λ and substituting in Equation 15, we obtainq as Modified Euler-Lagrange Equation. Thus, for a system subjected to these additional forces, Lnn can be trained by minimizing the loss on the predicted and observed trajectory, where the predicted accelerationq is obtained using the Equation 16. It is worth noting that in this equation, M, C, and Π can be directly derived from the L. Constraints on the systems, drag, and external forces are generally known. Additionally, we demonstrate later that the drag forces can also be learned using this framework if they are unknown. For particle systems in Cartesian coordinates, the mass matrix M (q) remains constant with only diagonal entries m ii . Inducing this as a prior knowledge, wherein the masses are parameterized as a diagonal matrix is shown to simplify the learning process [8]. A Energy violation of Lnn Let the error in dynamics of the Lnn be e(q) = |q t −q t | be bounded such that |e(q)| < nsup|δ i |, where n represents the number of particles in the system and sup|δ i | is the supremum of error in the dynamics of all particles in the system. To obtain the evolution of energy violation ε t , we compute A Energy violation of Lnn The bracketed term represents the error in the EL equation or the rate of change of momentum of the predicted trajectory computed based on the true Lagrangian. If the predicted LagrangianL and true Lagrangian L are close enough, then this error should not diverge. However, even for a well-trained Lnn there is no guarantee that this error is bounded, which agrees with the empirical experiments as well. Further, even if this error is bounded, the energy violation grows with the number of particles and the displacement as demonstrated in Theorem ??. B Momentum conservation of LGnn Consider systems where the energy is a function of the internal interactions only, for instance, n-spring systems or n-pendulum in space without gravity. For such systems, the predicted LagragianL in LGnn exactly conserves the momentum. In other words, the rate of change of momentum as computed by the predictedL on the real trajectory is zero, that is, n i=1 d dt ∂L(qi,t,qi,t) ∂qi,t = 0. B Momentum conservation of LGnn Note that here we use the real trajectory (q,q) and predicted Lagrangian (L) based on the following argument. We know that (q,q) presents a momentum conserving trajectory based on the true L. Thus, if (L) and (L) are equivalent, the predicted trajectory should also be momentum conserving. Conversely, if the time-evolution ofL produces a momentum conserving trajectory andL and L are equivalent, then the (L) should conserve the momentum of the true trajectory as well. B Momentum conservation of LGnn To this extent, the error n i=1δ i,t in the rate of change of momentum as computed using the predicted LagrangianL on the real trajectory (q,q), is given by B Momentum conservation of LGnn Where,L(q i,t ,q i,t ) = B Momentum conservation of LGnn In the absence of an external field, the potential energy is a function of only the internal interaction as represented by the edges. Thus, the nodal potential energy v i , which depends on the actual position, goes to zero. Hence,L(q i,t ,q i,t ) = n i=1 τ i − eij ∈E v ij . Further, the potential energy v ij of edges is a function of the edge features, (|q i − q j |), that is, the edge distance, and the kinetic energy τ i (in Cartesian coordinates) is a function ofq i . If the momentum of the system is exactly conserved, n i=1δ i,t = 0. To prove this, it is enough to prove that, n i=1 d dt ∂L(qi,t,qi,t) ∂qi,t = n i=1 ∂L(qi,t,qi,t) ∂qi,t = 0. B Momentum conservation of LGnn 20 Consider, B Momentum conservation of LGnn Combining, Eqs. (16) and (17), B Momentum conservation of LGnn Thus, we show that B Momentum conservation of LGnn LGnn conserves the momentum exactly on the true trajectory as well. This, in turn, suggests that the error in the energy violation for B Momentum conservation of LGnn LGnn should be lower than that of Lnn. Comparison of LGnn with baselines To compare Comparison of LGnn with baselines LGnn with Lnn, we evaluate the energy violation error and rollout error for both systems with and without drag. In addition, we also evaluate the effect of L 1 vs L 2 loss functions. We observe that the L 2 loss provides better performance for all the models.

섹션 본문 84문단 · 35,017자

(제목 없음)

1Physical systems are commonly represented as a combination of particles, the individual dynamics of which govern the system dynamics. However, traditional approaches require the knowledge of several abstract quantities such as the energy or force to infer the dynamics of these particles. Here, we present a framework, namely, Lagrangian graph neural network (LGnn), that provides a strong inductive bias to learn the Lagrangian of a particle-based system directly from the trajectory. We test our approach on challenging systems with constraints and drag-LGnn outperforms baselines such as feed-forward Lagrangian neural network (Lnn) with improved performance. We also show the zero-shot generalizability of the system by simulating systems two orders of magnitude larger than the trained one and also hybrid systems that are unseen by the model, a unique feature. The graph architecture of LGnn significantly simplifies the learning in comparison to Lnn with ∼25 times better performance on ∼20 times smaller amounts of data. Finally, we show the interpretability of LGnn, which directly provides physical insights on drag and constraint forces learned by the model.LGnn can thus provide a fillip toward understanding the dynamics of physical systems purely from observable quantities.

Introduction

2Modeling physical systems involves solving the differential equations governing their dynamics [1]. These equations, in turn, assumes the knowledge on the functional form of abstract quantities representing the system such as the forces, energy, Lagrangian or Hamiltonian and parameters associated with them [2]. Recently, it has been shown that these dynamics can learned directly from the data using data-driven and physics-informed neural networks (PINN) [3,4,5,6,7], which significantly simplifies the model development of complex physical systems.

3Among PINNs, a particular family of interest is the Lagrangian (Lnns) and Hamiltonian neural networks (Hnns), where a neural network is parameterized to learn the Lagrangian (or Hamiltonian) of the system directly from the trajectory [6,8,9,5,4,10,11]. The dynamics simulated by Lnn and Hnn has been shown to preserve their own energy during roll-out, thereby respecting basic physical laws. Finzi et al. [8] showed that formulating Lnns in Cartesian coordinates with explicit constraints simplifies the learning process. Similarly, Zhong et al. [12,13,14] extended Hnns to dissipitative systems, contacts, and videos making the simulations more realistic. In Lnns, it is assumed that since both the predicted and trained Lnns exhibit energy conservation, their energy do not diverge during the roll-out. However, it has been shown that the energy violation in Lnns and Hnns grow with the trajectory [15]. Moreover, these approaches have been demonstrated on systems where the number of degrees of freedom are not large [6,8,9,15]. The error in energy violation is empirically shown to increase with the system size [15]. Thus, extending these models to realistic systems with large degrees of freedom is posed as a challenging problem.

4An approach that has received lesser attention in physical systems is to learn their dynamics based on the topology [7,16]. To this extent, graph-based simulators have been used in physical and molecular systems, successfully [7,16,4,17,18]. Here, the dynamics of a system can be broken down to the dynamics of its individual components, which are then bound together based on their topological constraints. This raises an interesting question: can we learn the dynamics of physical systems directly from their trajectory and infer it on significantly larger ones, while preserving the desirable physical laws such as energy and momentum conservation?

5To address this challenge, here, we propose a Lagrangian graph neural network (LGnn), where we represent the physical system as a graph. Further, inspired from physics, we model the kinetic and potential energy at the node and edge levels, which is then aggregated to compute the total Lagrangian of the system. To model realistic systems, we extend the formulation of Lnns to include Pfaffian constraints, dissipative forces such as friction and drag, and external forcescrucial in applications such as robotics, and computer graphics. Our approach significantly simplifies the learning and improves the performance on complex systems and exhibits generalizability to unseen time steps, system sizes, and even hybrid systems. Theory and Architecture

Lagrangian formulation of particle systems

6The Lagrangian formulation presents an elegant framework to predict the dynamics of an entire system, based on a single scalar function known as the Lagrangian L (see Methods section for details). The general form of Euler-Lagrange (EL) equation considering Pfaffian constraints, drag or other dissipative forces, and external force can be written as

7where M = ∂ ∂q ∂L ∂q represents the mass matrix, C = ∂ ∂q ∂L ∂q represents Coriolis-like forces, Π = ∂L ∂q represents the conservative forces derivable from a potential, and A(q) ∈ R k×D represents k velocity constraints (see Supplementary material for details). The acceleration of a particle can then be computed as

8(2) which can be integrated to obtain the updated configurations. Thus, once the Lagrangian of a system is learned, the trajectory of a system can be inferred using the Eq. 16.

9In this work, we employ a Lagrangian graph neural network (LGnn) to learn the Lagrangian of the system directly from its trajectory. An overview of the LGnn framework, along with example systems, is provided in Fig. 1. The graph topology is used to predict the Lagrangian L, and non-conservative forces such as drag Υ. This is combined with the constraints and any external forces in the EL equation to predict the future state. The parameters of the model are learned by minimizing the mean squared error (MSE) over the predicted and true positions across all the particles in the system ( Eq. 7). We next discuss the neural architecture of LGnn to predict the Lagrangian.

Neural Architecture of LGnn

10The neural architecture of LGnn is outlined in Fig. 2. The aim of the LGnn is to directly predict the Lagrangian of a physical system while accounting for its topological features. As such, the creation of a graph structure that corresponds to the physical system forms the most important step. To explain the idea better, we will use the running examples of two systems: (i) a double pendulum and (ii) two balls connected by a spring, that represent two distinct cases of systems with rigid and deformable connections. Graph structure. The state of an n-body system is represented as a undirected graph, G = {U, E}, where nodes u i ∈ U represents the particles, | U |= n, and e ij ∈ E represents edges corresponding to constraints or interactions. In our running examples, the nodes correspond to the pendulum bobs and balls, respectively, and the edges correspond to the pendulum rods and springs, respectively. Note that the edges of the graphs may be predefined as in the case of a pendulum or spring system. The edges may also be defined as a function of the distance between two nodes such as

11is a distance function over node positions and θ is a distance threshold. This allows a dynamically changing edge set based on a cutoff distance as in the case of a realistic breakable spring. Input features. Each node u i ∈ U is characterized by its type t i , position q i = (x i , y i , z i ), and particle velocity (q i ). The type t i is a discrete variable and is useful in distinguishing particles of different characteristics within a system (Ex. two different types of balls). For each edge e ij , we store an edge weight

12Finally, we note that the node input features are classified into two: global and local features. Global features are the ones that are not relevant to the topology and hence are not included in message passing. In contrast, local features are the ones that are involved in message passing. In our running example, while particle type is a local feature, particle position and velocity are global features. Pre-Processing: In the pre-processing layer, we construct a dense vector representation for each node u i and edge e ij using MLP em as:

13squareplus is an activation function. As the acceleration of the particles is obtained using the EL equation, our architecture requires activation functions that are doubly-differentiable and hence, squareplus is an appropriate choice. In our implementation, we use different MLP em s for node representation corresponding to kinetic energy, potential energy, and drag. For brevity, we do not separately write the MLP em s in Equation 3.

14Kinetic energy and drag prediction. Since the graph uses Cartesian coordinates, the mass matrix is diagonal and the kinetic energy τ i of a particle depends only on the velocityq i and mass m i of the particle. Here, we learn the parameterized masses of each particle type based on the embedding h 0 i . Thus, the τ i of a particle is predicted as τ i = squareplus(MLP τ (h 0 i q i )), where represent the concatenation operator, MLP τ represents an MLP for learning the kinetic energy function, and squareplus represents the activation function. The total kinetic energy of the system is computed as T = n i=1 τ i . The drag of a particle also typically depends linearly or quadratically to the velocity of the particle. Here, we compute the total drag of a system as Υ = n i squareplus(MLP Υ (h 0 i q i )). Note that while T directly goes into the prediction of L, Υ is featured in the EL equation. Potential energy prediction. In many cases, the potential energy of a system is closely dependent on the topology of the structure. To capture this information, we employ multiple layers of message-passing between the nodes and edges. In the l th layer of message passing, the node embedding is updated as:

15where, N i = {u j ∈ U | (u i , u j ) ∈ E} are the neighbors of u i . W l U is a layerspecific learnable weight matrix. h l ij represents the embedding of incoming edge e ij on u i in the l th layer, which is computed as follows.

16Similar to W l U , W l E is a layer-specific learnable weight matrix specific to the edge set. The message passing is performed over L layers, where L is a hyperparameter. The final node and edge representations in the L th layer are denoted as z i = h L i and z ij = h L ij respectively.

5

17The total potential energy of an n-body system is represented as V =

18where v i represents the energy of u i due to its position and v ij represents the energy due to interaction e ij . In our running example, v i represents the potential energy of a bob in the double pendulum due to its position in a gravitational field, while v ij represents the energy of the spring connected with two particles due to its expansion and contraction. In

19Although not used in the present case, sometime v i can be a function of the local features dependent on the topology. For instance, in atomic systems, the charge of an atom can be dependent on neighboring atoms and hence the potential energy due to these charges can be considered as a combination of topology-dependent features along with the global features. In such cases, v i is predicted as

20where MLP mp represents the node M LP associated with the message-passing graph architecture. Trajectory prediction and training. Based on the predicted V, T , and Υ, the accelerationq i is computed using the EL Equation 16.

The loss function of

21LGnn is on the predicted and actual accelerations at timesteps 2, 3, . . . , T in a trajectory T, which is then back-propagated to train the MLPs. Specifically, the loss function is as follows.

22Here, (q T,t i ) is the predicted acceleration for the i th particle in trajectory T at time t andq T,t i is the true acceleration. T denotes a trajectory from T, the set of training trajectories. It is worth noting that the accelerations are computed directly from the position using the velocity-Verlet update and hence training on the accelerations is equivalent to training on the updated positions.

Experimental systems n-Pendulum

23In an n-pendulum system, n-point masses, representing the bobs, are connected by rigid bars which are not deformable. These bars, thus, impose a distance constraint between two point masses as

24where, l i represents the length of the bar connecting the (i − 1) th and i th mass. This constraint can be differentiated to write in the form of a P f af f ian constraint as

25Note that such constraint can be obtained for each of the n masses considered to obtain the A(q).

6

26The Lagrangian of this system has contributions from potential energy due to gravity and kinetic energy. Thus, the Lagrangian can be written as

27where g represents the acceleration due to gravity in the y direction. n-spring system

28In this system, n-point masses are connected by elastic springs that deform linearly with extension or compression. Note that similar to a pendulum setup, each mass m i is connected only to two masses m i−1 and m i+1 through springs so that all the masses form a closed connection. The Lagrangian of this system is given by

29where r 0 and k represent the undeformed length and the stiffness, respectively, of the spring.

Hybrid system

30The hybrid system is a combination of the pendulum and spring system. In this system, a double pendulum is connected to two additional masses through four additional springs as shown in Figure 1 with gravity in y direction. The constraints as present in the pendulum system are present in this system as well.

31The Lagrangian of this four-mass system is

32where m 1 and m 2 represent masses in the double pendulum and m 3 and m 4 represent masses connected by the springs.

33Theorem 1 In the absence of an external field, LGnn exactly conserves the momentum of a system.

34A detailed proof is given in Supplementary Material B. As shown empirically later, this momentum conservation in turn reduces the energy violation error in

35LGnn.

Implementation details

36Dataset generation All the datasets are generated using the known Lagrangian of the pendulum and spring systems, along with the constraints, as described in Section . For each system, we create the training data by performing forward simulations with 100 random initial conditions. For the pendulum and hybrid systems, a timestep of 10 −5 s is used to integrate the equations of motion, while for the spring system, a timestep of 10 −3 s is used. The velocity-verlet algorithm is used to integrate the equations of motion due to its ability to conserve the energy in long trajectory integration.

37All 100 simulations for pendulum and spring system were generated with 100 datapoints per simulation. The was datapoints were collected every 1000 and 100 timesteps for the pendulum and spring systems, respectively. Thus, each training trajectory of the spring and pendulum systems are 10s and 1s long, respectively. It should be noted that in contrast to the earlier approach, here, we do not train from the trajectory. Rather, we randomly sample different states from the training set to predict the acceleration. For simulating drag, the training data is generated for systems without drag and with linear drag given by −0.1q, for each particle.

Architecture

38For Lnn, we follow a similar architecture suggested in the literature [6,8]. Specifically, we use a fully connected feedforward neural network with 2 hidden layers each having 256 hidden units with a square-plus activation function. For

39LGnn, all the MLPs consist of two layers with 5 hidden units, respectively. Thus, LGnn has significantly lesser parameters than Lnn. The message passing in the LGnn was performed for two layers in the case of pendulum and one layer in the case of spring.

40The kinetic energy term in Lnn is handled as in the earlier case where in the parametrized masses are learned as a diagonal matrix. In the case of

41LGnn, the masses are directly learned from the one-hot embedding of the nodes. Interestingly, we observe that the mass matrix exhibits a diagonal nature in

42LGnn without enforcing any conditions due to its topology-aware nature.

Training details

43The training dataset is divided in 75:25 ratio randomly, where the 75% is used for training and 25% is used as the validation set. Further, the trained models are tested on its ability to predict the correct trajectory, a task it was not trained on. Specifically, the pendulum systems are tested for 10s, that is 10 6 timesteps, and spring systems for 20s, that is 2 × 10 4 timesteps on 100 different trajectories created from random initial conditions. All models are trained for 10000 epochs with early stopping. A learning rate of 10 −3 was used with the Adam optimizer for the training. The performance of both L 1 and L 2 loss

Empirical Evaluations

44LGnn for n-pendulum and n-spring systems

45In this section, we evaluate LGnn and establish that, (1) LGnn is more accurate than Lnn in modeling physical systems, and (2) owing to topology-aware inductive modeling, LGnn generalizes to unseen systems, hybrid systems with no deterioration in efficacy for increasing system sizes. In order to evaluate the performance of LGnn, we first consider two standard systems, that has been widely studied in the literature, namely, n-pendulum and n-spring systems [6,8,9,4], with n = (3,4,5). Following the work of [8], we evaluate performance by computing the relative error in (1) the trajectory, known as the rollout error, given by RE(t) = ||q(t) − q(t)|| 2 /(||q(t)|| 2 + ||q(t)|| 2 ) and (2) energy violation error given by ||Ĥ − H|| 2 /(||Ĥ|| 2 + ||H|| 2 ). The training data is generated for systems without drag and with linear drag given by −0.1q, for each particle. The timestep used for the forward simulation of the pendulum system is 10 −5 s with the data collected every 1000 timesteps and for the spring system is 10 −3 s with the data collected every 100 timesteps. The details of the experimental systems, data-generation procedure, the hyperparameters and training procedures are provided in the Methods section.

46LGnn is compared with (1) Lnn in Cartesian coordinates with constraints as proposed by [8], which gives the state-of-the-art performance. Since, Cartesian coordinates are used, the parameterized masses are learned as a diagonal matrix as performed in [8]. In addition, LGnn is also compared with two other graph-based approaches suggested in [6,5], named as (2) Lagrangian graph network (Lgn), and (3) Graph network simulator (Gns). Lgn exploits a graph architecture to predict the Lagrangian of the physical system, which is then used in the EL equation. Gns uses the position and velocity of the particles to directly predict their updates for a future timestep [4]. For both these approaches, since no details of the exact architecture is provided [6,5], a full graph network is employed [16]. All the simulations and training were performed in the JAX environment [18]. The graph architecture of LGnn was developed using the jraph package [19]. All the codes related to dataset generation and training are available as Supplementary Material.

Figure 3 shows the energy violation and rollout error of

47LGnn and Lnn for pendulum and spring systems with 3, 4, and 5 links without drag on each of the particles. For the pendulum system, LGnn is trained on 3-pendulum and for spring, LGnn is trained on 5-spring systems. The trained LGnn is used to perform the forward simulation on the other unseen systems. In contrast, the Lnns are trained and tested on the same systems. We observe that the

48LGnn exhibits comparable rollout error with Lnn for pendulum system, even on unseen systems. Further, LGnn exhibits significantly lower rollout error for spring systems-where the topology plays a crucial role-giving superior performance than Lnns consistently. Due to the chaotic nature of these systems, it is expected that the rollout error diverges. However, energy violation error gives a better evaluation of the realistic nature of the predicted trajectory. Interestingly, we note that the energy violation error is fairly constant for LGnn for both pendulum and spring systems. Moreover, the error on both seen and unseen systems are comparable suggesting a high degree of generalizability for

49LGnn. The geometric mean of energy violation error and rollout error of Lnn and LGnn for systems with and without drag are provided in the Supplementary material.

Figure 3: Energy violation (left) and rollout error (right) of

50LGnn (red) and Lnn (blue) for pendulum and spring systems having 3, 4, and 5 links and subjected to linear drag. Note that the LGnns for pendulum and springs are trained on 3 and 5 links, respectively, and tested on all the systems. Lnns are trained and tested separately on each of the systems. Shaded region shows the 95% confidence interval from 100 initial conditions. 11 Figure 4: (a) Energy violation and (b) rollout error for 5, 50, and 500 spring system with LGnn trained on 5 spring system. Shaded region shows the 95% confidence interval from 100 initial conditions.

Generalizability

51Now, we examine the ability of LGnn to push the limits of the current approaches. A regular Lnn uses a feed-forward NN to take the entire q,q as the input and then predicts the Lagrangian. Owing to this design, the number of model parameters grows with the input size. Hence, an Lnn trained on an n-sized system cannot be applied for inference on an n -sized system, where n = n . This makes Lnn transductive in nature. In contrast, LGnn is inductive, wherein the parameter space remains constant with system size. This is a natural consequence of our design where the learning happens at node and edge levels. Hence, given an arbitrary-sized system, we only need to predict the potential and kinetic energies at each node and edge, which we then aggregate to predict the combined energies at a system level. Further, a complex system that is unseen, if divisible into multiple sub-graphs with each sub-graph representing a learned system, the LGnn on 3-spring system.

52overall system can be simulated with zero-shot generalizability. Figure 4 shows the energy and rollout error of spring systems with 5, 50, 500 links using LGnn, Lgn and Gns trained on 5-spring system. We observe that LGnn performs significantly better than the other baselines. Note that the results of Lgn for 500 springs is not included due to significantly increased computational time for the forward simulation in comparison to the other models. In addition to the rollout error, we observe that the energy violation error of

53LGnn remains constant with low values even for systems that are 2 orders of magnitude larger than the training set. This suggests that the LGnn can produce realistic trajectories on large scale systems when trained on much smaller systems. These results also establish the superior nature of LGnn architecture, which exhibits improved performance with higher computational efficiency. The performance of similar systems with drag is provided in the Supplementary Material.

54To test generalizability to an unseen system, we consider a hybrid system with 2-pendulum-4-springs as shown in Figure 1. The LGnns trained on the 5-spring and 3-pendulum systems are used to model the hybrid system. Specifically, the V of the physical system is considered as the union of the V of two subgraphs, one representing the pendulum system and the other representing the spring systems. Then, the computed V is substituted in the EL equation to simulate the forward trajectory. Figure 5

Interpretability and data efficiency

55The trained

56LGnn provides interpretability, thanks to the graph structure. That is, since the computations of LGnn are carried out at the node and edge levels, the functions learned at these level can be used to gain insight into the behavior of the system. Further, the parameterized masses of the systems are learned directly during the training of LGnn, leading to a diagonal mass matrix. This is in contrast to Lnn where the prior information that mass matrix remains diagonal in the Cartesian coordinates is imposed to make the learning simpler [8]. Figure 5(c) shows the learned drag force as a function of velocity. We observe that the neural network has learned the drag in excellent agreement with the ground truth. Thus, in cases of systems where the ground truth is unknown, the learned drag can provide insights into the nature of dissipative forces in the system. Similarly, the λ learned during the training directly provides insights into the magnitude of the constraint forces.

57Finally, we analyze the efficiency of LGnn to learn from the training data. To this extent, we train both the models on a 3-spring system with (100, 500, 1000, 5000, 10000) datapoints. Figure 5(d) shows the geometric mean of relative error on the trajectory of the system. We observe that LGnn consistently outperforms Lnn, Further, the performance of LGnn saturates with 500 datapoints. In addition, LGnn trained on these 500 datapoints exhibits ∼25 and ∼3 times better performance in terms of geometric relative error than Lnn trained on 500 and 10000 datapoints. This confirms that the topologyaware LGnn can learn efficiently from small amounts of data, still yield better performance than Lnn.

Conclusions and outlook

58Altogether, we demonstrate a novel graph architecture, namely LGnn, which can learn the dynamics of systems directly from the trajectory, while exhibiting superior energy and momentum conservation. We show that the LGnn can generalize to any system size ranging orders of magnitude, when learned on a small system. Further, LGnn can even simulate unseen hybrid systems when trained on the systems independently. Finally, we also show that LGnn exhibits better data-efficiency, learning from smaller amounts of data in comparison to the original Lnn.

59There are several future directions that the present work opens up. The LGnn, at present, is limited to systems without collisions and other deformations. Extending

60LGnn to handle elastic and plastic deformations in addition to collisions can significantly widen the application areas. Further, LGnn assumes the knowledge of constraints. Automating the learning of the constraints while training the model using neural networks can provide a new paradigm to learn the constraints along with the Lagrangian. The graph nature of LGnn can potentially supplement the learning of constraints. Although, the message passing in LGnn is translationally and rotationally invariant, the expressive power is limited as only the distance is given as the edge feature. Enhancing the feature representation, and message passing through architectural modifications as in the case of equivariant Gnns can increase the applicability to more complex applications such as atomistic simulations of materials.

Data and code availability

61All the codes related to dataset generation and training are made are available as Supplementary Material.

Preliminaries on Learning Dynamical Systems

62The time evolution or dynamics of the state (q(t),q(t)) of a physical system can be represented asq = F (q,q, t), where q,q ∈ R D is a function of time (t) for a system with D degrees of freedom. The future states or trajectory of the system can be predicted by integrating these equations to obtain q(t + 1) and so on. While there are several physics-based methods for generating the dynamics of the system such as d'Alembert's principle, Newtonian, Lagrangian, or Hamiltonian approaches, all these approaches result in the equivalent sets of equations [20].

63The Lagrangian formulation presents an elegant framework to predict the dynamics of an entire system, based on a single scalar function known as the Lagrangian L. The standard form of Lagrange's equation for a system with holonomic constraints is given by d dt ∂L ∂qi − ∂L ∂qi = 0, where, i = 1, 2, 3, . . . , D, and the Lagrangian is L(q,q, t) = T (q,q, t) − V(q, t) with T (q,q, t) and V(q, t) representing the total kinetic energy of the system and the potential function from which generalized forces can be derived. Accordingly, the dynamics of the system can be represented using Euler-Lagrange (EL) equations asq

64In Lnn, the Lagrangian of a system is learned using a neural network by training on the acceleration of the system. Once trained, the Lnn, along with EL equations, provide the forward trajectory of the system. Lnns are highly desirable for modeling physical systems due to their energy-conserving nature, a consequence of modeling acceleration directly from the EL equations. However, as we demonstrate later, while Lnns conserve the energy of their own trajectory, it is not guaranteed that the predicted energy and ground truth are comparable, even for a well trained Lnn.

Lagrangian mechanics with Pfaffian Constraints, and Dissipation

65The Lnn formulation presented in Section , although powerful, is restricted to systems: (i) without any external forces, (ii) with generalized forces that are derivable from a potential function, (iii) without any dissipation such as friction or drag, and (iv) having holonomic constraints. To address these limitations, we extend the formulation of Lnns as detailed below [20,1]. Pfaffian Constraints. Holonomic constraints restrict the allowable configurations of a system to a smooth hyper-surface that satisfies the constraints. The trajectory of the system is governed by the algebraic constraints in terms of the positions and are enforced by the constraint forces associated with each constraint. For example, the movement of the bob in a 2D-pendulum is restricted by its rod following the equation (x 2 − y 2 ) = l 2 , where (x, y) represents the coordinate of the bob with the pin at the origin and l is the length of the bar. Here, the constraint is enforced by the forces in the bar and represents a holonomic constraint. However, in some cases the constraints may depend not on the position, but on the velocities of system. For example, in multi-fingered grasping, the velocity of two or more fingers are constrained so that the combined geometry formed is able to catch or hold an object. Such constraints, known as Pfaffian constraints, can be expressed as

66where, A(q) ∈ R k×D represents k velocity constraints. Note that a holonomic constraint can also be written as a Pfaffian constraint. For instance, the holonomic constraint of a pendulum can be written in the Pfaffian form as xẋ+yẏ = 0. More generally, an integrable Pfaffian constraint is a holonomic constraint, while a non-integrable one is a non-holonomic constraint. Dissipation and external forces. Physical systems are constantly subjected to dissipative forces, Υ such as drag, and friction. For instance, a system through a fluid such as air of water may be subjected to linear (c 1q , Stoke's law) or quadratic (c 2q 2 , air drag) drag forces resulting in energy dissipation. Similarly, a system may be additionally subjected to external forces F at different degrees of freedom due to interactions with the environment.

Modified Euler-Lagrange Equation.

67Considering the additional forces mentioned above, the modified EL equation can be written as:

68where A T forms a non-normalized basis for the constraint forces, λ ∈ R k , known as the Lagrange multipliers, gives the relative magnitudes of these force constraints, Υ represents the non-conservative forces, such as friction, which are not directly derivable from a potential, and F represents any external forces acting on the system. This equation can be modified to obtainq as:

69where M = ∂ ∂q ∂L ∂q represents the mass matrix, C = ∂ ∂q ∂L ∂q represents Coriolis-like forces, and Π = ∂L ∂q represents the conservative forces derivable from a potential. Differentiating the constraint Equation (13) gives A(q)q +Ȧ(q)q = 0. Solving for λ and substituting in Equation 15, we obtainq as

70Thus, for a system subjected to these additional forces, Lnn can be trained by minimizing the loss on the predicted and observed trajectory, where the predicted accelerationq is obtained using the Equation 16. It is worth noting that in this equation, M, C, and Π can be directly derived from the L. Constraints on the systems, drag, and external forces are generally known. Additionally, we demonstrate later that the drag forces can also be learned using this framework if they are unknown. For particle systems in Cartesian coordinates, the mass matrix M (q) remains constant with only diagonal entries m ii . Inducing this as a prior knowledge, wherein the masses are parameterized as a diagonal matrix is shown to simplify the learning process [8].

A Energy violation of Lnn

71Let the error in dynamics of the Lnn be e(q) = |q t −q t | be bounded such that |e(q)| < nsup|δ i |, where n represents the number of particles in the system and sup|δ i | is the supremum of error in the dynamics of all particles in the system. To obtain the evolution of energy violation ε t , we compute

72The bracketed term represents the error in the EL equation or the rate of change of momentum of the predicted trajectory computed based on the true Lagrangian. If the predicted LagrangianL and true Lagrangian L are close enough, then this error should not diverge. However, even for a well-trained Lnn there is no guarantee that this error is bounded, which agrees with the empirical experiments as well. Further, even if this error is bounded, the energy violation grows with the number of particles and the displacement as demonstrated in Theorem ??.

B Momentum conservation of LGnn

73Consider systems where the energy is a function of the internal interactions only, for instance, n-spring systems or n-pendulum in space without gravity. For such systems, the predicted LagragianL in LGnn exactly conserves the momentum. In other words, the rate of change of momentum as computed by the predictedL on the real trajectory is zero, that is, n i=1 d dt ∂L(qi,t,qi,t) ∂qi,t = 0.

74Note that here we use the real trajectory (q,q) and predicted Lagrangian (L) based on the following argument. We know that (q,q) presents a momentum conserving trajectory based on the true L. Thus, if (L) and (L) are equivalent, the predicted trajectory should also be momentum conserving. Conversely, if the time-evolution ofL produces a momentum conserving trajectory andL and L are equivalent, then the (L) should conserve the momentum of the true trajectory as well.

75To this extent, the error n i=1δ i,t in the rate of change of momentum as computed using the predicted LagrangianL on the real trajectory (q,q), is given by

76Where,L(q i,t ,q i,t ) =

77In the absence of an external field, the potential energy is a function of only the internal interaction as represented by the edges. Thus, the nodal potential energy v i , which depends on the actual position, goes to zero. Hence,L(q i,t ,q i,t ) = n i=1 τ i − eij ∈E v ij . Further, the potential energy v ij of edges is a function of the edge features, (|q i − q j |), that is, the edge distance, and the kinetic energy τ i (in Cartesian coordinates) is a function ofq i . If the momentum of the system is exactly conserved, n i=1δ i,t = 0. To prove this, it is enough to prove that, n i=1 d dt ∂L(qi,t,qi,t) ∂qi,t = n i=1 ∂L(qi,t,qi,t) ∂qi,t = 0.

7820 Consider,

79Combining, Eqs. (16) and (17),

80Thus, we show that

81LGnn conserves the momentum exactly on the true trajectory as well. This, in turn, suggests that the error in the energy violation for

82LGnn should be lower than that of Lnn.

Comparison of LGnn with baselines

83To compare

84LGnn with Lnn, we evaluate the energy violation error and rollout error for both systems with and without drag. In addition, we also evaluate the effect of L 1 vs L 2 loss functions. We observe that the L 2 loss provides better performance for all the models.

참고문헌 18건

  1. Hamiltonian Neural Networks arXiv (Cornell University) · Cornell University · 2019 10.48550/arxiv.1906.01563
  2. Deep Lagrangian Networks: Using Physics as Model Prior for Deep Learning 2019
  3. Dissipative SymODEN: Encoding Hamiltonian Dynamics with Dissipation and Control into Deep Learning arXiv (Cornell University) · Cornell University · 2020 10.48550/arxiv.2002.08860
  4. Learning to Simulate Complex Physics with Graph Networks arXiv (Cornell University) · Cornell University · 2020 10.48550/arxiv.2002.09405
  5. Lagrangian Neural Networks arXiv (Cornell University) · Cornell University · 2020 10.48550/arxiv.2003.04630
  6. Modeling System Dynamics with Physics-Informed Neural Networks Based on Lagrangian Mechanics IFAC-PapersOnLine · Elsevier BV · 2020 10.1016/j.ifacol.2020.12.2182
  7. Discovering Symbolic Models from Deep Learning with Inductive Biases arXiv (Cornell University) · Cornell University · 2020 10.48550/arxiv.2006.11287
  8. JAX, M.D. A framework for differentiable physics* Journal of Statistical Mechanics Theory and Experiment · Institute of Physics · 2021 10.1088/1742-5468/ac3ae9
  9. Modeling System Dynamics with Physics-Informed Neural Networks Based on Lagrangian Mechanics IFAC-PapersOnLine · Elsevier BV · 2020 10.1016/j.ifacol.2020.12.2182
  10. Accurate and scalable graph neural network force field and molecular dynamics with direct force architecture npj Computational Materials · Nature Portfolio · 2021 10.1038/s41524-021-00543-3
  11. Physics-informed machine learning Nature Reviews Physics · Nature Portfolio · 2021 10.1038/s42254-021-00314-5
  12. JAX, M.D. A framework for differentiable physics* Journal of Statistical Mechanics Theory and Experiment · Institute of Physics · 2021 10.1088/1742-5468/ac3ae9
  13. Deconstructing the Inductive Biases of Hamiltonian Neural Networks arXiv (Cornell University) · Cornell University · 2022 10.48550/arxiv.2202.04836
  14. Extending Lagrangian and Hamiltonian Neural Networks with Differentiable\n Contact Models arXiv (Cornell University) · Cornell University · 2021 10.48550/arxiv.2102.06794
  15. Hamiltonian Graph Networks with ODE Integrators arXiv (Cornell University) · Cornell University · 2019 10.48550/arxiv.1909.12790
  16. Unsupervised Learning of Lagrangian Dynamics from Images for Prediction\n and Control arXiv (Cornell University) · Cornell University · 2020 10.48550/arxiv.2007.01926
  17. Simplifying Hamiltonian and Lagrangian Neural Networks via Explicit\n Constraints arXiv (Cornell University) · Cornell University · 2020 10.48550/arxiv.2010.13581
  18. Benchmarking Energy-Conserving Neural Networks for Learning Dynamics\n from Data arXiv (Cornell University) · Cornell University · 2020 10.48550/arxiv.2012.02334