# Physics-Informed Deep Learning For Traffic State Estimation: A Survey and the Outlook
## 4 PIDL for UQ
### PIDL-UQ for TSE  
#### 4.1.1 Physics-Informed Generative Adversarial Network (PhysGAN)  
One way to formulate the UQ-TSE problem is to use a generative adversarial network (GAN) [87], which imitates the data distribution without specifying an explicit density distribution and can overcome the computational challenge of non-Gaussian likelihood [65], as opposed to using a Gaussian process [93; 94]. Now, we will formulate the UQ problem in the context of conditional GANs. The generator \(G_{\theta}\) learns the mapping from the input \((x,t)\) and a random noise \(z\) to the traffic state \(\mathbf{s}\), \(G_{\theta}:(x,t,z)\rightarrow\mathbf{s}\), where \(\theta\) is the parameter of the generator. The objective of the generator \(G_{\theta}\) is to fool an adversarially trained discriminator \(D_{\phi}:(x,t,\mathbf{s})\rightarrow[0,1]\). The loss functions of the GAN are depicted below:  
\[ \begin{split}&\mathit{Loss}_{\theta}\ (\mathit{generator}\ \mathit{loss})\\ &=\mathbb{E}_{x,t,\mathbf{z}}\big{[}D_{\phi}(x,t,\mathbf{s}) \big{]}\simeq\frac{1}{N_{o}}\sum_{i=1}^{N_{o}}D_{\phi}(x^{(i)},t^{(i)}, \mathbf{s}^{(i)}),\end{split}  \tag{11}\]  
\[ \begin{split}&\mathit{Loss}_{\phi}\ (\mathit{discriminator}\ \mathit{loss})\\ &=-\mathbb{E}_{x,t,\mathbf{z}}\big{[}\ln D_{\phi}(x,t,\mathbf{s}) \big{]}-\mathbb{E}_{x,t,\mathbf{\hat{s}}}\big{[}\ln(1-D_{\phi}(x,t,\mathbf{s}) )\big{]},\\ &\simeq-\frac{1}{N_{o}}\sum_{i=1}^{N_{o}}\ln D_{\phi}(x^{(i)},t^{ (i)}_{o},\mathbf{s}^{(i)})+\ln(1-D_{\phi}(x^{(i)},t^{(i)},\mathbf{s}^{(i)})), \end{split}  \tag{12}\]  
where \(\mathbf{s}^{(i)}=G_{\theta}(x^{(i)},t^{(i)},z^{(i)})\) is the predicted traffic state, and \(\mathbf{\hat{s}}\) is the ground-truth. With physics imposed, the generator loss carries the same form as Equation (10), and the data loss \(L_{o}\) and boundary loss \(L_{b}\) become:  
\[ \begin{split} L_{o}&=\frac{1}{N_{o}}\sum_{i=1}^{N _{o}}D_{\phi}(x^{(i)},t^{(i)},\mathbf{s}^{(i)}),\\ L_{b}&=\frac{1}{N_{b}}\sum_{i=1}^{N_{b}}D_{\phi}(x ^{(i_{b})},t^{(i_{b})},\mathbf{s}^{(i_{b})}).\end{split}  \tag{13}\]  
Different PhysGAN variants adopt different ways of integrating physics into GANs, and the exact form of \(L_{c}\) changes accordingly. Below we will introduce the general structure of the PhysGAN and its four variants. The general structure of the PhysGAN is illustrated in Figure 11. The top blue box encloses the data-driven component, which is a GAN model consisting of a generator \(G_{\theta}\) and a discriminator \(D_{\phi}\). Here, we omit details about how \(\rho\) and \(u\) interact within the generator. These two quantities can be generated sharing the same NN or from separate NNs. The PICG can be encoded with either the LWR or the ARZ equations. **PI-GAN** Refs. [90; 95; 96] calculate the physics loss \(L_{c}\) based on the residual \(r_{c}\), as illustrated in branch \(B_{1}\) of Figure 11a. \(L_{c}\) is added into the loss of the PUNN \(L_{o}\) using the weighted sum. This model was the first and is the most widely used to encode physics into the generator. **PID-GAN** Ref. [91] feeds the residual \(r_{c}\) into the discriminator \(D_{\phi}\) to provide additional information on whether the predictions deviate from the physics equations, which helps the discriminator to distinguish between the prediction and the ground-truth. This way of integrating physics is illustrated in branch \(B_{2}\) of Figure 11a. It is worth mentioning that the PID-GAN and the PI-GAN share the same structure of the data-driven component. They differ in how the physics are incorporated, i.e., informing the generator (branch \(B_{1}\)) or the discriminator (branch \(B_{2}\)). Ref. [91] shows that, by informing the discriminator, PID-GAN can mitigate the gradient imbalance issue of the PI-GAN. The above-mentioned two PhysGAN variants use deterministic physics, that is, the parameters in the physics equations are deterministic. Figure 11: PIDL architecture for UQ-TSE. The PhysGAN (**a**) consists of a generator, a discriminator, and a PICG.