Optimal Control
Solution to Optimal Control Problem
The general form of the optimal control problem and its solution involves minimizing the cost function J over a time horizon T. Given the system dynamics and initial state, the control inputs ut are optimized.
The cost function to be minimized is:
min<em>u</em>0,…,u<em>T−1∑</em>t=0T−1x<em>tTQx</em>t+u<em>tTRu</em>t+x<em>TTQ</em>fxT
Subject to the constraints:
x<em>t+1=Ax</em>t+But
x0 is given.
The solution often takes the form of a linear state feedback:
u<em>t=F</em>txt
where F<em>t is a gain matrix. This control policy makes the closed-loop system robust. The emergence of this gain F</em>t is a key feature.
Open-Loop Alternative
Consider a case where T=2 and the initial state x0 is given.
x<em>1=Ax</em>0+Bu0
x<em>2=Ax</em>1+Bu<em>1=A2x</em>0+ABu<em>0+Bu</em>1
This approach assumes that the system evolves exactly according to the nominal, noise-free dynamics. The cost function can be written as:
J(u<em>0,u</em>1)=x<em>0TQx</em>0+u<em>0TRu</em>0+x<em>1TQx</em>1+u<em>1TRu</em>1+x<em>2TQ</em>fx2
Expanding this, we have:
J(u<em>0,u</em>1)=x<em>0TQx</em>0+u<em>0TRu</em>0+(Ax<em>0+Bu</em>0)TQ(Ax<em>0+Bu</em>0)+u<em>1TRu</em>1+(A2x<em>0+ABu</em>0+Bu<em>1)TQ</em>f(A2x<em>0+ABu</em>0+Bu1)
In this formulation, all terms are constant except for u<em>0 and u</em>1.
J(u<em>0,u</em>1) can be expressed in a quadratic form:
J(u<em>0,u</em>1)=[u<em>0 u</em>1]TH[u<em>0 u</em>1]+2[x<em>0 u</em>0 u1]Th+c
Where:
H=[R+BTQB+BTATQ<em>fABBTATQ</em>fB BTATQ<em>fBR+BTQ</em>fB]
h=[BTQAx<em>0+BTATQ</em>fA2x<em>0 BTQ</em>fA2x0]
c=x<em>0T(Q+ATQA+ATATQ</em>fA2)x0
Thus, J(u) is quadratic in u and linear in x0.
To minimize J(u), we calculate the gradient and set it to zero:
∇J(u)=2Hu+2h=0
u∗=−H−1h
This open-loop control lacks robustness because there is no feedback or dependence on x or time t.
A MATLAB demo might visualize this optimization.
Beyond LQR
The general form of the optimal control problem is:
min<em>u</em>0,…,u<em>T−1∑</em>t=0T−1l(x<em>t,u</em>t,t)
Subject to:
x<em>t+1=f(x</em>t,ut,t)
x0 is given.
In general, an analytic solution to this problem is unknown, so we no longer have the worry of a feedback emerging from the analytic solution.
We can still solve this as an open-loop optimization problem:
x<em>1=f(x</em>0,u0,0)
x<em>2=f(f(x</em>0,u<em>0,0),u</em>1,1)
x<em>3=f(f(f(x</em>0,u<em>0,0),u</em>1,1),u2,2)
and so on. Plug these into the cost:
J(u<em>0,…,u</em>T−1;x<em>0)=∑</em>t=0T−1l(x<em>t,u</em>t,t)=l(x<em>0,u</em>0,0)+l(f(x<em>0,u</em>0,0),u<em>1,1)+…+l(f(…f(x</em>0,u<em>0,0),…),u</em>T−1,T−1)
This can be fed into a general-purpose optimization solver. Failure is possible.
Problems with the Open-Loop Approach
This open-loop approach has at least two problems:
- Lack of Robustness: It is sensitive to disturbances and model inaccuracies.
- High Computational Complexity: The complexity can be very high for large T.
Model Predictive Control (MPC)
One solution is Model Predictive Control (MPC).
MPC involves solving an optimal control problem over a moving window (a.k.a. Receding Horizon Control):
min<em>u</em>t∣t,…,u<em>t+T</em>win−1∣t∑<em>k=0T</em>win−1l(x<em>t+k∣t,u</em>t+k∣t)
Subject to:
x<em>k+1=f(x</em>k,uk,k)
x0 is given.
Apply u<em>t∣t to the real system (not the model), measure x</em>t+1 (including noise), and repeat. The window recedes as new measurements are incorporated.
Even though MPC solves an open-loop problem for each window, it creates closed-loop (feedback) behavior. This imparts robustness to the system.
MPC vs. Open-Loop
| Feature | MPC (Closed-Loop) | Open-Loop |
|---|
| Feedback | Yes | No |
| Robustness | High | Low |
| Implementation | Complex | Simpler |