The theory of optimal control is concerned with operating a dynamic system at minimum cost. The case where the system dynamics are described by a set of linear differential equations and the cost is described by a quadratic function is called the LQ problem. One of the main results in the theory is that the solution is provided by the linear–quadratic regulator (LQR), a feedback controller whose equations are given below. The LQR is an important part of the solution to the LQG (linear–quadratic–Gaussian) problem. Like the LQR problem itself, the LQG problem is one of the most fundamental problems in control theory.

## General description

The settings of a (regulating) controller governing either a machine or process (like an airplane or chemical reactor) are found by using a mathematical algorithm that minimizes a cost function with weighting factors supplied by a human (engineer). The cost function is often defined as a sum of the deviations of key measurements, desired altitude or process temperature, from their desired values. The algorithm thus finds those controller settings that minimize undesired deviations. The magnitude of the control action itself may also be included in the cost function.

The LQR algorithm reduces the amount of work done by the control systems engineer to optimize the controller. However, the engineer still needs to specify the cost function parameters, and compare the results with the specified design goals. Often this means that controller construction will be an iterative process in which the engineer judges the "optimal" controllers produced through simulation and then adjusts the parameters to produce a controller more consistent with design goals.

The LQR algorithm is essentially an automated way of finding an appropriate state-feedback controller. As such, it is not uncommon for control engineers to prefer alternative methods, like full state feedback, also known as pole placement, in which there is a clearer relationship between controller parameters and controller behavior. Difficulty in finding the right weighting factors limits the application of the LQR based controller synthesis.

## Finite-horizon, continuous-time LQR

For a continuous-time linear system, defined on ${\displaystyle t\in [t_{0},t_{1}]}$, described by

${\displaystyle {\dot {x}}=Ax+Bu}$

with a quadratic cost function defined as

${\displaystyle J=x^{T}(t_{1})F(t_{1})x(t_{1})+\int \limits _{t_{0}}^{t_{1}}\left(x^{T}Qx+u^{T}Ru+2x^{T}Nu\right)dt}$

the feedback control law that minimizes the value of the cost is

${\displaystyle u=-Kx\,}$

where ${\displaystyle K}$ is given by

${\displaystyle K=R^{-1}(B^{T}P(t)+N^{T})\,}$

and ${\displaystyle P}$ is found by solving the continuous time Riccati differential equation:

${\displaystyle A^{T}P(t)+P(t)A-(P(t)B+N)R^{-1}(B^{T}P(t)+N^{T})+Q=-{\dot {P}}(t)\,}$

with the boundary condition

${\displaystyle P(t_{1})=F(t_{1}).}$

The first order conditions for Jmin are

(i) State equation

${\displaystyle {\dot {x}}=Ax+Bu}$

(ii) Co-state equation

${\displaystyle -{\dot {\lambda }}=Qx+Nu+A^{T}\lambda }$

(iii) Stationary equation

${\displaystyle 0=Ru+N^{T}x+B^{T}\lambda }$

(iv) Boundary conditions

${\displaystyle x(t_{0})=x_{0}}$

and ${\displaystyle \lambda (t_{1})=F(t_{1})x(t_{1})}$

## Infinite-horizon, continuous-time LQR

For a continuous-time linear system described by

${\displaystyle {\dot {x}}=Ax+Bu}$

with a cost functional defined as

${\displaystyle J=\int _{0}^{\infty }\left(x^{T}Qx+u^{T}Ru+2x^{T}Nu\right)dt}$

the feedback control law that minimizes the value of the cost is

${\displaystyle u=-Kx\,}$

where ${\displaystyle K}$ is given by

${\displaystyle K=R^{-1}(B^{T}P+N^{T})\,}$

and ${\displaystyle P}$ is found by solving the continuous time algebraic Riccati equation

${\displaystyle A^{T}P+PA-(PB+N)R^{-1}(B^{T}P+N^{T})+Q=0\,}$

This can be also written as

${\displaystyle {\mathcal {A}}^{T}P+P{\mathcal {A}}-PBR^{-1}B^{T}P+{\mathcal {Q}}=0\,}$

with

${\displaystyle {\mathcal {A}}=A-BR^{-1}N^{T}\qquad {\mathcal {Q}}=Q-NR^{-1}N^{T}\,}$

## Finite-horizon, discrete-time LQR

For a discrete-time linear system described by [1]

${\displaystyle x_{k+1}=Ax_{k}+Bu_{k}\,}$

with a performance index defined as

${\displaystyle J=x_{N}^{T}Qx_{N}+\sum \limits _{k=0}^{N-1}\left(x_{k}^{T}Qx_{k}+u_{k}^{T}Ru_{k}+2x_{k}^{T}Nu_{k}\right)}$

the optimal control sequence minimizing the performance index is given by

${\displaystyle u_{k}=-F_{k}x_{k}\,}$

where

${\displaystyle F_{k}=(R+B^{T}P_{k+1}B)^{-1}(B^{T}P_{k+1}A+N^{T})\,}$

and ${\displaystyle P_{k}}$ is found iteratively backwards in time by the dynamic Riccati equation

${\displaystyle P_{k-1}=A^{T}P_{k}A-(A^{T}P_{k}B+N)\left(R+B^{T}P_{k}B\right)^{-1}(B^{T}P_{k}A+N^{T})+Q}$

from terminal condition ${\displaystyle P_{N}=Q}$. Note that ${\displaystyle u_{N}}$ is not defined, since ${\displaystyle x}$ is driven to its final state ${\displaystyle x_{N}}$ by ${\displaystyle Ax_{N-1}+Bu_{N-1}}$.

## Infinite-horizon, discrete-time LQR

For a discrete-time linear system described by

${\displaystyle x_{k+1}=Ax_{k}+Bu_{k}\,}$

with a performance index defined as

${\displaystyle J=\sum \limits _{k=0}^{\infty }\left(x_{k}^{T}Qx_{k}+u_{k}^{T}Ru_{k}+2x_{k}^{T}Nu_{k}\right)}$

the optimal control sequence minimizing the performance index is given by

${\displaystyle u_{k}=-Fx_{k}\,}$

where

${\displaystyle F=(R+B^{T}PB)^{-1}(B^{T}PA+N^{T})\,}$

and ${\displaystyle P}$ is the unique positive definite solution to the discrete time algebraic Riccati equation (DARE)

${\displaystyle P=A^{T}PA-(A^{T}PB+N)\left(R+B^{T}PB\right)^{-1}(B^{T}PA+N^{T})+Q}$.

This can be also written as

${\displaystyle P={\mathcal {A}}^{T}P{\mathcal {A}}-{\mathcal {A}}^{T}PB\left(R+B^{T}PB\right)^{-1}B^{T}P{\mathcal {A}}+{\mathcal {Q}}}$

with

${\displaystyle {\mathcal {A}}=A-BR^{-1}N^{T}\qquad {\mathcal {Q}}=Q-NR^{-1}N^{T}}$.

Note that one way to solve the algebraic Riccati equation is by iterating the dynamic Riccati equation of the finite-horizon case until it converges.

## References

1. ^ Chow, Gregory C. (1986). Analysis and Control of Dynamic Economic Systems. Krieger Publ. Co. ISBN 0-89874-969-7.
• Kwakernaak, Huibert & Sivan, Raphael (1972). Linear Optimal Control Systems. First Edition. Wiley-Interscience. ISBN 0-471-51110-2.