# Model Predictive Control

Model Predictive Control (MPC) is an optimization technique widely used in Smart Grids and almost all of the smart devices like smart thermostats are based upon MLC. Here's how it works:

Assume t_{c} to be the current time and we are in x_{c} state. The optimization problem can be posed as -

subject to the constraints

and

The sublte difference MPC has from an Linear Quadratic Regulator (LQR) Problem is that an LQR problem is an infinite-horizon problem i.e. the limit of integration in the LQR goes to infinity. In the MPC we only solve the optimal control problem within a very small finite-time horizon, from to where is the prediction horizon. At the next iteration we solve this optimization problem from to . We solve this finite-horizon problem over and over moving ahead in time at each iteration.

There also exist infinite-time horizon MPC (IHMPC) approaches in which the constraints are only active in a particular time-horizon and inactive otherwise. We keep on iterating through the constraints changing the inactive states to active within the time-horizon we are running our optimization algorithm in.

This video from University of Toronto shows MPC in action as the robot tries to stay on the optimal trajectory. The solid line in the map represents the optimal trajectory that MPC was able to find. The length of the line is indicative of the prediction horizon that the robot has.

Since the final state for a given time-horizon becomes the initial state for the next time-horizon, MPC works like a closed loop system. As faster and smaller computers, MPC is now becoming a very powerful tool in optimization domain.

### Some Additional Knowledge

(i) MPC requires the system to linear. This is because the computation is done in MPC based on the current states which either need to be completely observable or we need to tie an observer around the system to 'observe' the system states. Only linear systems have the neat property that actual systems and the observer modules are decoupled from each other (Separation Principle). Non-linear systems have uncontrolled interactions with the observer system and hence the states can not be observed with them.

(ii) MPC needs to be used with extreme caution. MPC optimization can cause the system to drift towards instability because instability is an asymptotic property. Therefore a system may be finding the most optimal solution but even then be going towards instability.