# Reconstruction of Epidemiological Data in Hungary Using Stochastic Model Predictive Control
## 3 Optimization-Based Reconstruction of Past Epidemiological Data  
_State-Space Model Representation and Problem Statement_  
In Section 2.1, we presented the dynamic Equation (1) of the epidemic spread. We introduced a possible vaccination model in Section 2.2, where \(\mathbf{V}_{k}\) acts as a _measured disturbance_ input of the dynamical model. In Section 2.3, we explained why parameter \(\beta_{k}\) can be considered as an _unknown input_ of the system. Finally, in Section 2.4, we proposed to consider the hospitalization data (\(\mathbf{H}\)) as the model output. These \"ingredients\" allowed us to embed the epidemic spread model into the following discrete-time state-space representation:  
\[x_{k+1}=f(x_{k},u_{k},\theta,v_{k}),\quad y_{k}=Cx_{k}, \tag{6}\]  
where \(x_{k}=\left(\mathbf{S}_{k},\mathbf{L}_{k},\mathbf{P}_{k},\mathbf{I}_{k}, \mathbf{A}_{k},\mathbf{H}_{k},\mathbf{R}_{k},\mathbf{D}_{k},\mathbf{U}_{k} \right)\in\mathbb{R}^{n}\) is the state, \(u_{k}=\beta_{k}\in\mathbb{R}^{m}\) is the unknown input, \(\theta=\left(\alpha,\zeta,\rho_{I},\rho_{A},\lambda,\delta,\gamma,\eta,\mu,\
u \right)\in\mathbb{R}^{p}\) is the vector of model parameters, \(v_{k}=\mathbf{V}_{k}\in\mathbb{R}^{q}\) is a measured disturbance, and \(y_{k}=\mathbf{H}_{k}\in\mathbb{R}^{g}\) is the output with \(C=(0\,0\,0\,0\,1\,0\,0\,0)\). In [22], we presented two possible linear time-invariant (LTI) methods to reconstruct the past states \(x_{k+1}\) and the unknown inputs \(u_{k}\) using the measured output \(y_{k}\), \(k=\mathbb{I}_{0}^{T-1}\). Both techniques in [22] rely on the dynamic inversion of the LTI subsystem of Model (1). In this paper, we revisited the unknown input filtering problem and reformulated it as an optimal predictive tracking control problem. Namely, we computed an optimal input sequence \(u_{k}\), \(k=\mathbb{I}_{0}^{T-1}\) such that the output \(y_{k}\) of the system follows the reference signal \(r_{k}=\mathbf{H}_{k}^{\text{Off}}\), which contains the past output measurements, i.e., the daily number of hospitalized patients (\(\mathbf{H}_{k}^{\text{Off}}\)). The simultaneous unknown input and state reconstruction can be formulated as the following optimization task. **Problem 1** (NMPC for epidemiological data reconstruction with fixed model parameters). : _Given the dynamical model (6) with initial condition \(x_{0}\), a vector of constants \(\theta\), a measured disturbance \(v_{k}\), and a reference output trajectory \(r_{k+1}\) to track (\(k\in\mathbb{I}_{0}^{T-1}\)), we looked for a sequence of inputs \(u_{k}\) and states \(x_{k+1}\) that solve the state recursion (6), satisfy the constraint \(u_{k}\in\mathcal{U}\), and minimize the following weighted cost function:_  
\[J(X,\mathcal{U})=\sum_{k=0}^{T-1}\lVert Cx_{k+1}-r_{k+1}\rVert_{Q}^{2}+\sum_{ k=0}^{T-2}\lVert u_{k+1}-u_{k}\rVert_{R}^{2}, \tag{7}\]  
_where \(X=\big{(}x_{1}\,\dots\,x_{T}\big{)}\) and \(\mathcal{U}=\big{(}u_{0}\,\dots\,u_{T-1}\big{)}\) collect the free decision variables of the optimization, \(Q\), \(R\) are positive definite weight matrices, and \(\mathcal{U}\) is a closed subset of the input space \(\mathbb{R}^{m}\)._  
In Problem 1, we formulated a _data assimilation_ problem in the form of a _nonlinear model predictive controller_ (NMPC) computation. The available numerical optimization tools [40; 41; 42; 43] make it possible to solve Problem 1 precisely in a reasonable time. From an epidemiological point of view, the first term of the cost function (7) minimizes the deviation of the computed number of hospitalized patients from the official data, whereas the second term minimizes the slope of the transmission rate of the pathogen. In this way, the NMPC design provides an optimal _smooth_ solution for the unknown transmission rate function \(\beta:\{0,\dots,T-1\}\to\mathcal{U}=[0.06,1]\), which does not have sudden changes. **Remark 1**. : _The daily transmission rate of the disease \(\beta_{k}\) is an unknown time-dependent (but, supposedly not abruptly varying) parameter.