occupancies; and

-   $g(x,u,\tau,\Gamma)$ is a cost function that penalizes total energy consumption and penalizes discomfort based on the occupancy $\Gamma$.

The expectation operator ${\mathbb{E}\left[g\right]}$ in Equation \[eq:firstMpcDef\] reflects that future values of $g$ require predictions of occupancy and of the weather. The optimization yields an optimal sequence of $N$ power commands to the HVAC system, where positive values are heat and negative are cooling; the first command $u_{k}$ is applied, and the rest are discarded. The previous and current occupancy observations are then used to train the occupancy model, and the entire process repeats the next time step (Figure \[fig:Process-flow-during\]).

![\[fig:Process-flow-during\]Process flow during operation.](process)

Two assumptions are made in this presentation. First, we treat the weather forecast as accurate so that we can later omit the expectation operator from $w$. Second, we use a very simple cost function with constant efficiency and a single linear actuator. These assumptions improve clarity but are not required in practice. Where available, weather uncertainty data can be rolled into the cost function in order to improve robustness [@Oldewurtel201215]. Multiple actuators (e.g. radiant and forced air with vastly different response times) or nonlinear actuation (e.g. variable air volume damper position) can be pulled into 