# TGN: A Temporal Graph Network for Physics Prediction
## 3 Methodology
### Temporal Encoding and State Updating  
Prediction of physical system dynamics is the process of predicting the most probable future sequence of length \(O\) given a past historical time series of length \(I\). LTSF is the prediction of a larger \(O\), which is a long-standing task and currently a major challenge in the field of physical system prediction. To address this problem, we introduce the decomposition schemes used in Autoformer and FEDformer, and with reference to the architecture of Autoformer, we propose Autolinear, a time encoder based on linear models. Briefly, Autolinear is the combination of linear layers with the decomposition blocks used in Autoformer. The decomposition blocks smooth out cyclical fluctuations and highlight long-term trends by adjusting the moving average kernel, which decomposes the input historical time series \(\mathcal{X}_{en}=(\mathbf{z}_{1},\mathbf{z}_{2},\dots,\mathbf{z}_{t})\) into a seasonal component and a trend component  
\[\mathcal{C}^{0},\mathcal{T}^{0}=\text{SeriesDecomp}(\mathcal{X}_{en}). \tag{9}\]  
These two components, respectively, reflect the periodicity and the long-term trend of the input series.  
However, for long-term forecasting, decomposing the input sequence alone is not sufficient as it does not provide information about future time steps. To address this problem, we fuse decomposition blocks and linear models to construct a series of Linear-Decomp blocks. Linear-Decomp blocks capture the periodicity and trend of the intermediate hidden series during the forecasting period, which allows it to extract the stable trend component and remove the disturbing information from the seasonal component. Autolinear uses L Linear-Decomp blocks to alternatively linearly transform and decompose the seasonal components. The equation for the \(l\)-th Linear-Decomp block is:  
\[\mathcal{C}^{l},\mathcal{T}^{l}=\text{SeriesDecomp}(\text{Linear}(\mathcal{C} ^{l-1})+\mathcal{C}^{l-1}),\quad\mathcal{T}^{l}_{f}=\mathcal{T}^{l-1}_{f}+ \mathcal{T}^{l}, \tag{10}\]  
where \(\mathcal{T}^{0}_{f}=\mathcal{T}^{0}\) is for accumulation. \(\text{Linear}(\cdot)\) is divided into three steps. First Linear encodes the features of the bracketed sequences into high dimensions with an MLP; then it linearly combines the sequences in the high dimensional space; and finally reduces to low dimensions with an MLP.  
We use two single-level linear models \(\mathbf{W}_{C}\), \(\mathbf{W}_{T}\in\mathbb{R}^{t}\) on the time axis to perform a weighted sum operation on the seasonal component \(\mathcal{C}^{L}\) and the trend component \(\mathcal{T}_{f}^{L}\) of the last Linear-Decomp block, respectively. Finally, we use an MLP to transform the sum of the two results into output features  
\[\mathbf{P}_{t}=\text{mlp}_{d\epsilon}(\mathbf{W}_{C}\mathcal{C}^{L}+\mathbf{W}_{T} \mathcal{T}_{f}^{L}). \tag{11}\]  
We collectively refer to the process of extracting output features from the input sequence as \(\mathbf{P}_{t}=\text{AutoLinear}(\mathcal{X}_{en})\).  
For velocity and density, we interpret the output feature \(\mathbf{P}_{t}\) as the derivative of the state field \(\mathbf{S}_{t}\) and integrate it using \(\Delta t=1\) to compute the next state field \(\tilde{\mathbf{S}}_{t+1}=\mathbf{S}_{t}+\mathbf{P}_{t}\). The feature \(\mathbf{P}_{t}\) are also used to directly predict the pressure. More information about the feature \(\mathbf{P}_{t}\) in different systems can be found in Appendix A.1.