# Experimental Validation of a Guaranteed Nonlinear Model Predictive Control
## 3 Guaranteed Controller Design via Validated Simulation
### Validated Nonlinear Model Predictive Control
#### 3.2.2 Interval Cost Function Formulation  
Since the feasible intervals of inputs are computed fulfilling different constraints, the optimization procedure is required to find the optimal control box and then the punctual input that we inject into the actuator's control unit \(u_{1}\). The continuous cost function can be expressed over the prediction horizon \(T_{p}=T_{c}\times N_{p}\) as  
\[J(y_{t},u_{t})=\int_{t}^{t+T_{p}}F(y(\tau),u(\tau))d\tau \tag{11}\]  
where \(F\) is in general a quadratic function that minimizes the norm of the inputs and the error between the predicted outputs \(y\) and the reference \(y_{r}\). \(F\) can be expressed in the following quadratic form:  
\[F(y(\tau),u(\tau))=(y(\tau)-y_{r})^{\mathsf{T}}\mathbf{Q}(y-y(\tau)_{r})+u( \tau)^{T}\mathbf{R}u(\tau) \tag{12}\]  
where \(\mathbf{Q}\) and \(\mathbf{R}\) are both positive semi-definite weighting matrices. The continuous objective function (11) then takes the form  
\[ \begin{split} J(y_{t},u_{t})&=\int_{t}^{t+T_{p}} \Bigl{[}(y(\tau)-y_{r})^{\mathsf{T}}\mathbf{Q}(y(\tau)-y_{r})+u(\tau)^{T} \mathbf{R}u(\tau)\Bigr{]}d\tau\\ &=\sum_{k=1}^{N_{p}}\int_{t+(k-1)T_{c}}^{t+kT_{c}}\Bigl{[}(y(\tau )-y_{r})^{T}\mathbf{Q}(y(\tau)-y_{r})\Bigr{]}d\tau+\sum_{k=1}^{N_{p}}\int_{t+(k -1)T_{c}}^{t+kT_{c}}u(\tau)^{T}\mathbf{R}u(\tau)d\tau\end{split}  \tag{13}\]  
The purpose is to express the cost function (13) in a discrete form using interval analysis methods. Since the control signal is constant along the input sampling period \(\{t+(k-1)T_{c},t+kT_{c}\}\), the second integral can be simplified as  
\[J(y_{t},u_{t}) =\sum_{k=1}^{N_{p}}\int_{t+(k-1)T_{c}}^{t+kT_{c}}\Bigl{[}(y(\tau) -y_{r})^{T}\mathbf{Q}(y(\tau)-y_{r})\Bigr{]}d\tau+\ T_{c}\sum_{k=1}^{N_{p}} \Bigl{[}u_{k}^{T}\mathbf{R}u_{k}\Bigr{]} \tag{14}\]A validated simulation method generates a list of tight enclosures\({}^{\prime}\)\([\mathbf{y}_{0}],[\mathbf{y}_{1}],\ldots,[\mathbf{y}_{n}]\) solutions of the IVP-ODEs (5) from the initial conditions \([\mathbf{y}_{0}]\) and \([\mathbf{u}_{0}]\). Therefore, each solution \(y\) can be enclosed into a box thanks to the validated methods (i.e., \(\forall t\in[t+(k-1)T_{c},t+kT_{c}],\;\;y(t)\in[\mathbf{y}_{t}]\)). Hence, one useful consequence of the Rectangle Property is that it allows us to bound the first integral of the cost (14) between two bounds as can be defined below:  
\[\sum_{k=1}^{N_{p}}\int_{t+(k-1)T_{c}}^{t+kT_{c}}\Big{[}(y(\tau)-y_{ \tau})^{T}\mathbf{Q}(y(\tau)-y_{\tau})\Big{]}d\tau \in T_{c}\sum_{k=1}^{N_{p}}\Big{[}([\mathbf{y}_{t}]-y_{\tau})^{T} \mathbf{Q}([\mathbf{y}_{t}]-y_{\tau})\Big{]} \tag{15}\]  
By exploiting (15), the interval cost function can be approximated as  
\[ \begin{array}{rcl}J(y_{t},u_{t})&\in&T_{c}\sum_{k=1}^{N_{p}}\Big{[}([ \mathbf{y}_{t}]-y_{\tau})^{T}\mathbf{Q}([\mathbf{y}_{t}]-y_{\tau})\;+\;[ \mathbf{u}_{k}]^{T}\mathbf{R}[\mathbf{u}_{k}]\Big{]}\\ &\leq&ub\Bigg{\{}T_{c}\sum_{k=1}^{N_{p}}\Big{[}([\mathbf{y}_{t}]-y_{ \tau})^{T}\mathbf{Q}([\mathbf{y}_{t}]-y_{\tau})\;+\;[\mathbf{u}_{k}]^{T}\mathbf{ R}[\mathbf{u}_{k}]\Big{]}\Bigg{\}}\end{array}  \tag{16}\]  
where \(ub\) signifies the upper bound of the interval (\(lb\) denotes its lower bound). Algorithm 2 recaps the optimization procedure to determine the inputs boxes allowing for minimizing the cost function (16). It returns the sub-optimal solutions that minimize the formulated cost function. It is based on consecutive bisections of the first input interval \([\mathbf{u}_{1}]\) until achieving a small width value \(tol\). The punctual and guaranteed input value \(u_{1}\) that we send to the DC motor represents the smaller value of the upper and lower bound of this interval.