## 3 Methodology
### Pinn
Then, a generalized form is to solve the following optimization problem:  
\[\min_{\widetilde{\theta}_{q}}\ell(\widetilde{\theta}_{q}) \tag{4}\]  
where  
\[\ell(\widetilde{\theta}_{q})=MSE_{u_{q}}(\{x_{u_{q}}^{i}\}_{i=1}^{N_{u_{q}}} ;\widetilde{\theta}_{q})+MSE_{f_{q}}(\{x_{f}^{i}\}_{i=1}^{N_{f_{q}}}; \widetilde{\theta}_{q}) \tag{5}\]  
The following flow conservation equation helps to combine the individual links and thus to find the traffic state over the entire network;  
\[\sum_{i=1}^{N_{l_{q}}}Q_{q}=\sum_{i=1}^{N_{l_{q}}}Q_{q},\,Q_{q}=V(\rho) \tag{6}\]  
\(Q\) represents the link flow which is a speed density function, and \(i,j\in\Omega\) are the inward and outward traffic flow links, respectively, represented by \(q^{+}\) and \(q^{-}\), at any intersection I. Using the above set of Equation (6), the proposed neural network framework aims to predict the traffic state over the entire traffic network. The link-wise defined loss functions  
Figure 2: Illustration of network, Links, and Intersections. are extended for the whole network by connecting individual links using a connectivity matrix subject to the relevant flow continuity and conservation equations. Thus, the loss function for a \(q\)th link is given by:  
\[\ell(\widetilde{\theta}_{q})=W_{u_{q}}MSE_{u_{q}}(\{x^{i}_{u_{q}}\}_{i=1}^{N_{u_ {q}}};\widetilde{\theta}_{q})+W_{f_{q}}MSE_{f_{q}}(\{x^{i}_{f_{q}}\}_{i=1}^{N_{ f_{q}}};\widetilde{\theta}_{q})+W_{l_{q}}MSE_{I}(\{x^{i}_{l_{q}}\}_{i=1}^{N_{l_{q}}}; \widetilde{\theta}_{q}) \tag{7}\]  
where \(W_{u_{q}}\), \(W_{f_{q}}\), and \(W_{l_{q}}\) represent the weights assigned to errors related to the training data, residual, and intersection points, respectively. At this stage, the weights are assigned manually, though they can be chosen dynamically for faster convergence, this will increase the computational load. The mean-squared errors (MSEs) are given by Equation (8). \[MSE_{u_{q}}(\{x^{i}_{u_{q}}\}_{i=1}^{N_{u_{q}}};\widetilde{\theta}_{q})=\frac{ 1}{N_{u_{q}}}\sum_{i=1}^{N_{u_{q}}}|\rho^{(i)}-\hat{\rho}(x^{i}_{u_{q}}; \widetilde{\theta}_{q})|^{2} \tag{8}\] \[\partial_{t}\rho+\partial_{x}(\rho v)=0;\;v=V(\rho) \tag{1}\]0 \[\partial_{t}\rho+\partial_{x}(\rho v)=0;\;v=V(\rho) \tag{1}\]1  
The term \(MSE_{u}\) and \(MSE_{f}\) are the \(MSE\) for data discrepancy (PUNN part) and physics discrepancy (PINN part) for the link \(q\), respectively. In addition, the following flow continuity condition could be integrated into the loss function:  
\[\partial_{t}\rho+\partial_{x}(\rho v)=0;\;v=V(\rho) \tag{1}\]2  
The \(MSE_{c}\) corresponds to the residual continuity condition at a common point of two connected links given by two different neural networks. The continuity condition is a special case of flow conservation where there is only one inward flow and one outward flow link. The continuity condition can be useful where the physical characteristics of the road change like the number of lanes, etc., and it is desired to split the link to separately model their traffic flow. The \(MSE_{I}\) is the residual flux conservation condition at the intersection given by different neural networks of the links \(q^{+}\) and \(q^{-}\). The superscript \(+\) over \(q\) represents the inward flow links and \(-\) over \(q\) represents the outward flow links at the intersections. The flow conservation ensures that the flow information from the incoming links is propagating to the outward flow links at the intersection. The term \(\hat{f}(x^{i}_{f_{q}};\widetilde{\theta}_{q})\) represents the residual of the governing PDE of the \(q\)th link which is given by Equation (10). \[\partial_{t}\rho+\partial_{x}(\rho v)=0;\;v=V(\rho) \tag{1}\]3  
We find \(\widetilde{\theta}_{q}\)\({}^{*}\) to minimize the loss function \(\ell\left(\widetilde{\theta}_{q}\right)\) for each link. A good solution can be obtained for the whole network by wisely designing the network's architecture and providing sufficient training data points. Several optimization algorithms can be used to minimize the loss function.