# Reconstruction of Epidemiological Data in Hungary Using Stochastic Model Predictive Control
## 5 Results and Discussion  
In this section, we present the numerical results we obtained through the MPC-based reconstruction of the unknown epidemiological data. The results were computed in the MATLAB environment with the Control System Toolbox [70]. For algorithmic differentiation, we used CasADi [40, 41]. To solve nonlinear MPC problems, we used IPOPT [42], an interior point line search algorithm, with the MUltifrrontal Massively Parallel sparse direct Solver (MUMPS) [71, 72]. The MPC implementations are available online in the public repository [73]. To compute the unknown epidemiological data, we followed the operations of Algorithm 1 to find a pseudo-optimal solution for the \(\mu\Sigma\)-NMPC in Problem 2. On 1 March 2020 (\(k=0\)), we assumed a susceptible and almost healthy population, with a small uncertainty as follows:  
\[\mu_{0}^{x}=(\mathbf{N}-40\ \ 10\ \ 10\ \ 10\ \ 10\ \ 0\ \ 0\ \ 0)^{\top},\ \Sigma_{0}^{x}=\text{diag}(7,1,1,1,1,1,1,0). \tag{22}\]  
We note that the effect of the initial number of infected people on the reconstructed state vanishes after a transient period due to the stability properties of the compartmental model (1). Furthermore, we considered pairwise independent random parameters with \(\mu^{\theta}\) and a diagonal \(\Sigma^{\theta}\) as presented in Table 1. We fixed the initial value for \(\beta\) to \(\mu_{0}^{u}=1/3\)[21]. We solved the ordinary NMPC in Problem 1 to find the candidate mean functions for \(\hat{x}\) and \(\hat{u}\). Then, we computed the gain matrices and the variances of the joint distribution (13). Using the obtained _feasible_ solution as an initial guess, we solved the \(\mu\Sigma\)-NMPC in Problem 2. We learned that the local optimum \((M^{*},S^{*},V^{*})\) found for Problem 2 is qualitatively the same as the initial guess \((M,S,V)\). The relative difference in the cost obtained by the optimal and the pseudo-optimal solution is negligible, namely:  
\[\frac{I(M,S,V)-I(M^{*},S^{*},V^{*})}{I(M^{*},S^{*},V^{*})}\approx 7.1\times 1 0^{-7},\text{ where }J(M^{*},S^{*},V^{*})\approx 17,075.129. \tag{23}\]If \(\mathfrak{X},\mathfrak{X}^{*}\in\mathbb{R}^{(n+m+np+n(n+1)/2)\cdot T-1}\) denote the vectors of independent variables of \((M,S,V)\) and \((M^{*},S^{*},V^{*})\), respectively, the relative difference between \(\mathfrak{X}\) and \(\mathfrak{X}^{*}\) is:  
\[\|\mathfrak{X}-\mathfrak{X}^{*}\|\ /\ \|\mathfrak{X}^{*}\|\approx 2.86\times 10^{ -11},\ \text{where}\ \|\mathfrak{X}^{*}\|\ \approx 3.1978\times 10^{11}. \tag{24}\]  
In Table 2, we present the dimensional differences between the ordinary NMPC and the \(\mu\Sigma\)-NMPC if the length of time window is \(T=487\) d. In Figure 2, we illustrate the computed marginal distributions of the transmission rate of the pathogen and the daily numbers of people in the different stages of the disease. The expectation for the states are presented in Plot 1 of Figure 2, which were computed through the ordinary NMPC design in Problem 1. In each of Plots 2-12 of Figures 2 and 3, the time evolution of the marginal distributions of scalar quantities are visualized, such that the shaded dark and light areas highlight the \(1\sigma\) and \(1\sigma\) confidence intervals, respectively. The shape of the epidemic curves clearly show the three waves of the epidemic until summer 2021. As was noted in Remark 1, the daily transmission rate becomes uncertain when the number of infectious people reduces significantly. In this case, the input constraint with the computed gain \(K_{k}\) may be violated; therefore, we increased the input weight \(\mathbf{R}_{k}^{\text{LQR}}\) to obtain a lower gain \(K_{k}\). These heuristic operations to compute an admissible gain were relevant only when the third wave of the epidemic suddenly dropped after the end of April 2021. The scaled logarithm of the input weights on each day \(k\) are illustrated in Plot 2 of Figure 2. In Plot 3 of Figure 2, we present the reconstructed number of hospitalized patients in comparison with the official (i.e., reference) data.