$\dagger$ means $k=i+1\ (\bmod M)$. For example, $P^{\textrm{(\Romannum{1})}}$ takes the form $$P^{(\textrm{\Romannum{1}})}={\mathbb{E}\begin{bmatrix}0 & p_{0}\\
 & 0 & p_{1}\\
 &  & \ddots & \ddots\\
 &  &  & 0 & p_{M-2}\\
p_{M-1} &  &  &  & 0
\end{bmatrix}}.$$ The complete matrix is $$P=\left[\begin{array}{c|c}
P^{\textrm{(\Romannum{1})}} & P^{\textrm{(\Romannum{2})}}\\
\hline {\rule{0pt}{10pt}}P^{\textrm{(\Romannum{3})}} & P^{\textrm{(\Romannum{4})}}
\end{array}\right].$$ The expected occupancy $m$ steps in the future given a current estimate $\Gamma_{k}$ is $${\mathbb{E}\left[\Gamma_{k+j}\mid\Gamma_{k}\right]}=\underbrace{\begin{bmatrix}\Gamma_{k}{\mathbb{1}}_{1\times M}^{k} & (1-\Gamma_{k}){\mathbb{1}}_{1\times M}^{k}\end{bmatrix}}_{\pi_{k}}P^{j}\begin{bmatrix}1_{M\times1}\\
0_{M\times1}
\end{bmatrix}\label{eq:occupancyProjection}$$ where ${\mathbb{1}}_{1\times M}^{k}$ is a vector with the $k$th element set to one and all others left zero.

MPC Formulation
===============

To balance competing demands for occupant comfort and low total energy consumption, we need to avoid conditioning the space when vacancy is expected; the level of comfort should scale with occupancy. To simplify the cost function, we have augmented the building’s state space model with the non-changing temperature setpoint and a weather forecast shift-register system, i.e. $$\underbrace{\begin{bmatrix}x_{k+1}\\
\tau_{k+1}\\
\phi_{k+1}
\end{bmatrix}}_{\tilde{x}_{k+1}}=\tilde{A}\underbrace{\begin{bmatrix}x_{k}\\
\tau_{k}\\
\phi_{k}
\end{bmatrix}}_{\tilde{x}_{k}}+\underbrace{\begin{bmatrix}B_{u}\\
0\\
0
\end{bmatrix}}_{\tilde{B}}u_{k},$$ where $x$ is the building’s thermal state (Equation \[eq:buildingStateEquation\]), $\tau$ is the comfort setpoint, and $\phi$ is a shift-register state that iterates through the weather forecast over the MPC horizon. The augmented matrix $\tilde{A}$ connects the weather forecast to the building thermal model 