Download as pdf or txt
Download as pdf or txt
You are on page 1of 47

Explicit constrained nonlinear MPC

Tor A. Johansen
Norwegian University of Science and Technology, Trondheim, Norway

Main topics

Approximate explicit nonlinear MPC based on orthogonal search trees

Approximate explicit nonlinear MPC based on local mp-QP solutions

Discussion and summary

Explicit constrained nonlinear MPC

1
Part I

Approximate explicit constrained nonlinear MPC


based on orthogonal search trees

Nonlinear Constrained MPC formulation

Theory: Stability, optimality, convexity

Approximate mp-NLP via search tree partitioning

Example

Explicit constrained nonlinear MPC

2
MPC formulation

Nonlinear system:

       
Optimization problem (similar to Chen and Allg öwer (1998)):


  
                 


with          subject to    and
        
           
  
           
      
Explicit constrained nonlinear MPC

3
MPC formulation, assumptions

A1.     .

A2.      and      .

A3. The function  is twice continuously differentiable, with     .

The compact and convex terminal set is defined by

     
where   and    will be specified shortly.

Explicit constrained nonlinear MPC

4
Terminal set

Similar to Chen and Allgöwer (1998):

A4.    is stabilizable, where


 
     
 
Let  denote the associated LQ optimal gain matrix, such that      
is strictly Hurwitz.

Lemma 1. If    is such that    is strictly Hurwitz, the Lyapunov


equation

             
has a unique solution  .

Explicit constrained nonlinear MPC

5
Terminal set, cont’d
Lemma 2. Let satisfy the conditions in Lemma 1. Then there exists a
constant    such that       satisfies

1.               .

2. The autonomous nonlinear system


       
is asymptotically stable for all   , i.e. is positively invariant.

3. The infinite-horizon cost for the system in 2, given by


 
 
       

satisfies   for all  .

Explicit constrained nonlinear MPC

6
Multi-parametric nonlinear program (mp-NLP)

This and similar optimization problems can be formulated in a concise form

        subject to     
This defines an mp-NLP, since it is an NLP in  parameterized by  .

Define the set of -step feasible initial states as follows

         for some    
We seek an explicit state feedback representation of the solution function
   to this problem: Implementation without real-time optimization!

Explicit constrained nonlinear MPC

7
How to represent   and  ?

mp-LP/mp-QP: Exact piecewise linear (PWL) solution, on a polyhedral parti-


tion of  .

mp-NLP: No structural properties that can be exploited to determine a finite


representation of the exact solution.

Keep the PWL representation as an approximation, as it is convenient to work


with!

Explicit constrained nonlinear MPC

8
Orthogonal partitioning via a search tree

PWL approximation is flexible and leads to highly efficient real-time search.

How to construct the partition, and local linear approximations?


Explicit constrained nonlinear MPC

9
PWL approximate mp-NLP approach

How to construct the partition, and local linear approximations?

Construct feasible local linear approximation to the mp-NLP solution from NLP
solutions at a finite number of samples in every region of the partition.

Construct the partition such that the approximate solution has a cost close to
the optimal cost for all   .

This is easier under convexity assumptions.

Explicit constrained nonlinear MPC

10
mp-NLP and convexity

A5.  and  are jointly convex for all      , where      


is the set of admissible inputs.

The optimal cost function   can now be shown to have some regularity prop-
erties (Mangasarian and Rosen, 1964):

Theorem 1.  is a closed convex set, and    is convex and


continuous. ¾

Convexity of  and   is a direct consequence of A5, while continuity of  


can be established under weaker conditions (Fiacco, 1983).

Explicit constrained nonlinear MPC

11
Optimal cost function bounds

Consider the vertices        of any bounded polyhedron 


 . Define the affine function        as the solution to the
following LP:
 
     subject to         for all       
 ¼¼
Likewise, define the convex PWL function
 
            
  

Theorem 2. Consider any bounded polyhedron   . Then   


      for all  . ¾

These bounds can be computed by solving  NLPs.

Explicit constrained nonlinear MPC

12
Feasible local linear approximation

Similar to Bemporad and Filippi (2003):

Lemma 3. Consider any bounded polyhedron   with vertices      .


If  and  solve the convex NLP (   arbitrary):
 
 
              
¼¼ 
subject to               
then 
     is feasible for the mp-NLP for all  . ¾

Can be computed from the solution of the same NLPs as above...

Explicit constrained nonlinear MPC

13
Sub-optimality bound

Since 
  defined in Lemma 3 is feasible in   , it follows that

      
is an upper bound on    in  such that for all  

  
    !
where
 
!      
¼

Explicit constrained nonlinear MPC

14
Approximate mp-NLP algorithm
1. Initialize the partition to the whole hypercube, i.e.   . Mark the hypercube as
unexplored.

2. Select any unexplored hypercube ¼  . If no such hypercube exists, the algorithm


terminates successfully.

3. Solve the NLP for fixed to each of the vertices of the hypercube  ¼ (some of these NLPs
may have been solved in earlier steps). If all solutions are feasible, go to step 4. Otherwise,
compute the size of ¼. If it is smaller than some tolerance, mark  ¼ explored and infeasible.
Otherwise, go to step 8.

4. If   ¼ , choose ¼   and go to step 5 . Otherwise, go to step 6.


5. If ¼ , mark ¼ as explored and go to step 2. Otherwise, go to step 8.

6. Compute a feasible affine state feedback ¼ , as an approximation to be used in  ¼. If no


feasible solution was found, go to step 8.

7. Compute the error bound  ¼. If ¼ , mark ¼ as explored and feasible, and go to step
2.

8. Split the hypercube  ¼ into two hypercubes ½ and ¾ using some heuristic rule. Mark
both unexplored, remove  ¼ from , add ½ and ¾ to and go to step 2.

Explicit constrained nonlinear MPC

15
Example, Chen and Allgöwer (1998)

     "
 
     "
 
The origin is an unstable equilibrium point, with a stabilizable linearization.
We discretize this system using a sampling interval #   . The control
objective is given by the weighting matrices
#
    #
The terminal penalty is given by the solution to the Lyapunov equation
 
   

   
and a positively invariant terminal region is
     
The prediction horizon is  "#  .
Explicit constrained nonlinear MPC

16
Example, partition with 105 regions
1

0.8

0.6

0.4

0.2
2

0
x

−0.2

−0.4

−0.6

−0.8

−1
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
x
1

Real-time computations: 14 arithmetic operations per sample.


Explicit constrained nonlinear MPC

17
Example, solution and cost

2
2

1 1
u (x ,x )

u(x ,x )
1 2

1 2
0 0
*

−1 −1

1
−2 −2 1
−1 −1
0.5 0.5
−0.5 −0.5
0 0
0 0
−0.5 −0.5
0.5 0.5

1 −1 x2 1 −1 x2
x1 x1

Optimal solution  to the left and approximate solution  to the right.

50 50

40 40
V (x ,x )

V(x1,x2)
1 2

30 30

20 20
*

10 10

0 1 0 1
−1 −1
0.5 0.5
−0.5 −0.5
0 0
0 0

0.5 −0.5 0.5 −0.5

1 −1 1 −1
x2 x2
x1 x1

Optimal cost function   to the left and sub-optimal cost  to the right.
Explicit constrained nonlinear MPC

18
Example, simulations
0 0.1 2.5

0
−0.1

−0.1 2
−0.2
−0.2

−0.3
−0.3 1.5
x1(t)

x2(t)

u(t)
−0.4 −0.4

−0.5 1
−0.5

−0.6
−0.6
−0.7 0.5

−0.7
−0.8

−0.8 −0.9 0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
t t t

Explicit constrained nonlinear MPC

19
Properties of the algorithm

The PWL approximation generated is denoted     , where  is


the union of hypercubes where a feasible solution has been found. It is an
inner approximation to  and the approximation accuracy is determined by
the tolerance in step 3.

Theorem 3. Assume the partitioning rule in step 8 guarantees that the error
decreases by some minimum amount or factor at each split. The algorithm
terminates with an approximate solution function 
 that is feasible and satis-
fies

          !
for all  . ¾

Explicit constrained nonlinear MPC

20
Stability

The exact MPC will make the origin asymptotically stable (Chen and Allg öwer,
1998) . We show below that asymptotic stability is inherited by the approxi-
mate MPC under an assumption on the tolerance !:

A6. Assume the partition  generated by Algorithm 1 has the property that
for any hypercube    that does not contain the origin

!  $   
¼
where $    is given.

Theorem 4. The origin is an asymptotically stable equilibrium point, for all


   . ¾

Explicit constrained nonlinear MPC

21
Non-convex problems

If convexity does not hold, global optimization is generally needed if theoretical


guarantees are required:

1. The NLPs must be solved using global optimization in steps 3 and 6.

2. The computation of the error bound ! in step 7 must rely on global opti-
mization, or convex underestimation.

3. The heuristics in step 8 may be modified to be efficient also in the non-


convex case.

Explicit constrained nonlinear MPC

22
Key references
T. A. Johansen, Approximate Explicit Receding Horizon Control of Constrained Nonlinear
Systems, submitted for publication, 2002

H. Chen and F. Allgöwer, A quasi-infinite horizon nonlinear model predictive control scheme
with guaranteed stability, Automatica, Vol. 34, pp. 1205-1217, 1998

A. V. Fiacco, Introduction to sensitivity and stability analysis in nonlinear programming, Or-


lando, Fl: Academic Press, 1983

T. A. Johansen and A. Grancharova, Approximate explicit constrained linear model predictive


control via orthogonal search tree, IEEE Trans. Automatic Control, accepted, 2003

A. Grancharova and T. A. Johansen, Approximate Explicit Model Predictive Control Incorpo-


rating Heuristics, IEEE Conf. Computer Aided Control Design, Glasgow, 2002

A. Bemporad and C. Filippi, Suboptimal explicit RHC via approximate quadratic programming,
J. Optimization Theory and Applications, Vol. 117, No. 1, 2003

Explicit constrained nonlinear MPC

23
Part II

Approximate explicit constrained nonlinear MPC


based on local mp-QP solutions.

Nonlinear Constrained MPC formulation

Multi-parametric Nonlinear Programming (mp-NLP)

An approximate mp-NLP algorithm

Example: Compressor surge control

Explicit constrained nonlinear MPC

24
Nonlinear Constrained Model Predictive Control

Nonlinear dynamic optimization problem

   #   #   
    %  & #  # 

subject to the inequality constraints for    #

     
     
and the ordinary differential equation (ODE) given by
%
     
%
with given initial condition     .

Explicit constrained nonlinear MPC

25
Multi-parametric Nonlinear Programming

The input   is assumed to be piecewise constant and parameterized by a


vector    such that    '      is piecewise continuous.

The solution to the ODE is   (   , and the problem is reformu-


lated as:

    
 (    '    %  & ( #   # 

subject to


   
          
  
This is an NLP in  parameterized by , i.e. an mp-NLP. Solving the mp-
NLP amounts to determining an explicit representation of the solution function
  .
Explicit constrained nonlinear MPC

26
Explicit solution approach

mp-LP and mp-QP solvers are well established:    is piecewise linear


(PWL).

In mp-NLPs (unlike mp-QPs) there are no structural properties to exploit, such


that we seek only an approximation to the solution   .

Main idea: Locally approximate the mp-NLP with a convex mp-QP. Iteratively
sub-partition the space until sufficient agreement between the mp-QP and
mp-NLP solutions is achieved.

This leads to a PWL approximation, which allows MPC implementation with a


PWL function evaluation rather than solving an NLP in real time.

Explicit constrained nonlinear MPC

27
Assumptions

Consider any    , and solution candidate  with associated Lagrange


multipliers ) and optimal active set  .

Assumption A1.  and  are twice continuously differentiable in a neighbor-


hood of   .

Assumption A2. The sufficient first- and second-order conditions (Karush-


Kuhn-Tucker) for a local minimum at  hold.

Assumption A3. Linear independence constraint qualification (LICQ) holds,


i.e. the active constraint gradients   ¼    are linearly independent.

Assumption A4. Strict complementary slackness holds, i.e. )   ¼  .

Explicit constrained nonlinear MPC

28
Basic result (Fiacco, 1983)
The optimal solution    depends in a continuous manner on : It may be
meaningful with a PWL approximation to   !

Theorem 1. If A1 - A3 holds, then

1.  is a local isolated minimum.

2. For in a neighborhood of , there exists a unique continuous function


   satisfying      and the sufficient conditions for a local mini-
mum.

3. Assume in addition A4 holds, and let be in a neighborhood of . Then


   is differentiable and the associated Lagrange multipliers )   exists,
and are unique and continuously differentiable. Finally, the set of active con-
straints is unchanged, and the active constraint gradients are linearly inde-
pendent at   .
Explicit constrained nonlinear MPC

29
Local mp-QP Approximation

Minimize

        *   
 +  ,       -  
subject to

     .    #
The cost and constraints are defined by the matrices
¼  ¾  ¼ ¼  ¼  ¾  ¼ ¼  ¼    ¼ ¼ 
   ¼ ¼ 
 ¼ ¼ 
 ¼ ¼
¼      ¼      ¼     ¼ 
  ¼  
¼  ¼  ¼  ¼    ¼ ¼  ¼  ½¾  ¼  ¾ ¼  ¼  ¼

Explicit constrained nonlinear MPC

30
KKT conditions

Let the PWL solution to the mp-QP be denoted   with associated La-
grange multipliers ) :
 
*      ,    +   )   
 
diag )         .    #  
)   
 
      .    #  

Assumption A5. For an optimal active set , the matrix  has full row
rank (LICQ) and / * /  , where the columns of / is a basis for
null  .

Explicit constrained nonlinear MPC

31
QP-solution for fixed active set

Theorem 2. Let  be a polyhedral set with    . If assumption A5 holds,


then there exists a unique solution to the mp-QP and the critical region where
the solution is optimal is given by the polyhedral set

     )   
      .    #
Hence,      and )   )  if   , and
the solution  is a continuous, PWL function of defined on a polyhedral
partition of  .

Explicit constrained nonlinear MPC

32
Comparing mp-QP and mp-NLP solutions

Local quadratic approximation makes sense!

Theorem 3. Let    and suppose there exists a  satisfying assump-


tions A1 - A4. Then for in a neighbourhood of 

          
)   )      

Explicit constrained nonlinear MPC

33
Approximation criteria

How small neighborhoods    are necessary?

The solution error bound is defined as (0 is a weight)

1   0 '     '    


¼
The cost error bound is defined as

!   
¼
      

The maximum constraint violation is (2 is a weight)

Æ   2
¼
   

Explicit constrained nonlinear MPC

34
Optimal cost function bounds

Consider the vertices        of any bounded polyhedron .



Define the affine function       as the solution to the LP
 
     
 ¼¼
subject to

        for all       


Likewise, define the convex piecewise affine function
 
    
 
       

Theorem 4. If  and  are jointly convex (in  and ) on the bounded


polyhedron , then          for all   .

Explicit constrained nonlinear MPC

35
Optimal cost function bounds

Theorem 4 gives the following bounds on the cost function error

!         !
where
 
!         
¼
 
!       
¼

Explicit constrained nonlinear MPC

36
Approximate mp-NLP algorithm
Step 1. Let    .

Step 2. Select  as the Chebychev center of , by solving an LP.

Step 3. Compute      by solving a NLP.

Step 4. Compute the local mp-QP problem at   .

Step 5. Estimate the approximation errors !, 1 and Æ on .

Step 6. If !  !, 1  1, or Æ  Æ , then sub-partition  into polyhedral


regions.

Step 7. Select a new  from the partition. If no further sub-partitioning is


needed, go to step 8. Otherwise, repeat Steps 2-7 until the tolerances !, 1
and Æ are respected in all polyhedral regions in the partition of  .

Step 8. For all sub-partitions , solve the mp-QP.


Explicit constrained nonlinear MPC

37
Example: Compressor surge control

Consider the following 2nd-order compressor model with being normalized


mass flow,  normalized pressure and  normalized mass flow through a
close coupled valve in series with the compressor

   !     

   

The following compressor and valve characteristics are used
    
!   3"  *         
4 4

   $ sign   
with $  ,   , *  , 3"   and 4   , (Gravdahl and
Egeland, 1997).

Explicit constrained nonlinear MPC

38
Example, cont’d

The control objective is to avoid surge, i.e. stabilize the system. This may be
formulated as

           
&         
with    1   and the setpoint   ,    corresponds to
an unstable equilibrium point.

We have chosen   ,  , and   . The horizon is chosen as


#   , which is split into  5   equal-sized intervals.

Valve capacity requires the constraint       to hold, and the pres-
sure constraint      avoids operation too far left of the operating
point.

Explicit constrained nonlinear MPC

39
Partition of the state space
R2 R4
R7 R23
R19
R15 RR26
R25
R21
R2024
R17
R16
R9 R10
R3 R7R4 R3 R2 R87
R6 R11R4R1 R13 R1 R2
R6 R1 R1 R1 R85
0.7 R3
R5
R3
R8
R2
R6 R1
0.7 R99 R98 R100
R14R12 R5 R2 R86
R1 R19 R18 R18
R22 R12 R5
R6 R9 R15
R17
R13
R16
R14R11 R3 R2R6 R73 R66R64 R65R101 R97
R17
R11R7 R2 R8 R10
R14
R16
R15
R12
R9
R11 R4R7 R4 R9 R11 R7 R10 R6 R4 R93 R95 R45
R42
R4 R6 R6 R9 R1 R7 R3 R2 R94
R92 R91 R39 R67 R71 R96
R2 R1 R7 R6 R1 R1
0.6 R5R4
R2
R4 R3
R1 R4
R5
R3
R8R3 R3
R12
R8 R1 0.6 R49 R90 R88
R44
R41 R69
R72
R63
R5 R3
R8 R5 R10 R13
R2 R1 R10
R11 R5 R6R2 R5R10R2R5 R9
R4
R8 R5
R3 R89 R43 R68
R70
R17
R15
R13 R7 R12 R7 R6
R6 R9 R4 R2 R78R76
R9R6R10R2
R16
R14
R11
R12
R5
R11
R10
R9
R7 R5 R4 R5
R4
R3 R12
R15R7 R5
R15R81
R83R79
R80
R2 R4R5 R1 R10
R13
R16 R3
R82
R84
R2 R1 R48 R77 R74
0.5 R1 R3 R2 R3
R6 R1
R8
R11
R14R5
R3 R1 R1 0.5 R50 R13
R75
R1 R6
R8 R5
R9 R1
R4 R1 R5R4 R2
R1 R25
R8 R2 R6R4R2R3
R1 R5 R2
R3 R14
0.4 R4 R3 R2 R2 R3 R4 0.4 R24
2

R3 R8 R6 R7 R4

x2
R12
R11 R7 R5
R10
x

R10 R6 R9 R11
R8R5 R7
R5
R2 R5 R3R6 R3 R60
R58
R1 R1 R1 R2 R7 R7 R57 R46 R47 R38
R1
0.3 R3 R2
R5R8
R2R4R9
R16R10
R14
R15
R12
0.3 R36
R62
R59
R34 R51 R37
R13 R8 R6
R1 R4 R3 R2 R1 R2 R9 R5 R30 R17
R1 R2 R2 R4
R6 R1 R2 R4 R6 R2 R29 R16
R4 R3 R6 R3 R5
0.2 R3R7
R9 R4
R6
R3
R4
R7R5
R8
R11 R5
R6
R7
R10
R5 R7
R4
R4 R8
R10 R1 0.2 R31
R33
R35 R22
R21
R18
R8 R5 R1 R55
R5 R2 R3 R7
R1 R1 R54 R53 R19 R20
R2 R1R3R4
R8 R4 R3 R2 R56
R4R6 R6 R5 R3
0.1 R1
R2 R1 R3
R8
R9
R2R4R7
R6
R5 R12
R13 R9R5
R8R3
R11
0.1 R1
R23
R4
R3R12
R11
R8
R11 R5 R3 R10 R28 R10 R6
R6 R1
R14 R7
R10
R13 R4 R2 R4 R27 R2 R9
R17
R4 R6 R1
R15 R16 R7
R9
R12 R18
R2 R5 R2 R1 R7 R4 R26
0 R19 R3 0
0 0.2 0.4 0.6 0.8 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
x x1
1

The PWL mapping with 379 regions can be represented as a binary search
tree with 329 nodes, of depth 9. Real-time evaluation of the controller there-
fore requires 49 arithmetic operations, in the worst case, and 1367 numbers
needs to be stored in real-time computer memory.
Explicit constrained nonlinear MPC

40
Optimal solution and cost
Approximate solution Exact solution

0.3 0.3

u (x1,x2)
0.2 0.2
u(x1,x2)

0.1

*
0.1

0 0

0.6 0.6
0.8 0.8
0.4 0.6 0.4 0.6
0.2 0.4 0.2 0.4
0.2 0.2
0 0 0 0
x x1 x2 x1
2

2.5 2.5

2 2

V (x1,x2)
V(x1,x2)

1.5 1.5

1 1
*

0.5 0.5

0 0
0.8
1
0.6 1
1 0.8
0.4
0.5 0.6
0.5 0.2 0.4
0.2
0 0
0 0
x2 x1 x2 x
1

Explicit constrained nonlinear MPC

41
Simulation with controller activated at   
0.8 0.9 0.35

0.8 0.3
0.6 0.7
0.25
0.6
0.4 0.2

x (t)
0.5
x (t)

u(t)
0.15
1

0.4
0.2 0.1
0.3
0.05
0 0.2

0.1 0

−0.2 0 −0.05
0 10 20 30 40 50 60 0 10 20 30 40 50 60 0 10 20 30 40 50 60
t t
t

Explicit constrained nonlinear MPC

42
Key references
T. A. Johansen, On Multi-parametric Nonlinear Programming and Explicit Nonlinear Model
Predictive Control, IEEE Conf. Decision and Control, Las Vegas, NV, 2002

A. V. Fiacco, Introduction to sensitivity and stability analysis in nonlinear programming, Or-


lando, Fl: Academic Press, 1983

P. Tøndel, T. A. Johansen and A. Bemporad, An algorithm for multi-parametric quadratic pro-


gramming and explicit MPC solutions, Automatica, accepted, March, 2003

A. Bemporad and M. Morari and V. Dua and E. N. Pistikopoulos, The Explicit Linear Quadratic
Regulator for Constrained Systems, Automatica, Vol. 38, pp. 3-20, 2002

P. Tøndel, T. A. Johansen and A. Bemporad, Evaluation of Piecewise Affine Control via Binary
Search Tree, Automatica, accepted, May, 2003

A. Bemporad and C. Filippi, Suboptimal explicit RHC via approximate quadratic programming,
J. Optimization Theory and Applications, Vol. 117, No. 1, 2003

Explicit constrained nonlinear MPC

43
Part III – Discussion and summary

Explicit linear MPC (including robust/hybrid)

Solved using mp-LP/mp-QP/mp-MILP

Exact piecewise linear representation

Solvers efficient for constrained MPC problems with a few states and in-
puts and reasonable horizons

Real-time implementation as binary search tree: 's computation times


using fixed-point arithmetic

Explicit constrained nonlinear MPC

44
Discussion and summary, cont’d

Explicit non-linear MPC - emerging mp-NLP theory/technology based on mp-


QP/mp-LP and NLP solvers.

Bad news: Non-convexity is challenging (not unexpected...)

Good news: i) Approximation theory (including stability) seems to be fairly


straightforward to establish. ii) Real-time computational complexity of PWL
approximation is comparable to linear MPC!

Explicit constrained nonlinear MPC

45
Advantages and disadvantages

+ Efficient real-time computations for small problems


+ Simple real-time SW implementation: Verifiability, reliability, safety-critical
applications, small systems
+ Fixed-point arithmetic sufficient

- Requires more real-time computer memory


- Does not scale well to large problems
- Reconfigurability is not straightforward

Explicit solution is probably most interesting for nonlinear MPC problems:


They are often smaller scale, and SW reliability and computational complexity
issues are more pronounced.

Explicit constrained nonlinear MPC

46
Applications

Embedded systems - low-level control, small systems, may be safety-


critical (automotive, medical, marine etc.)

Control allocation problems - static/quasi-dynamic, over-actuated mechan-


ical systems (aerospace, marine, MEMS,...)

Low-level process control - MPC-like functionality at unit-process level


replacing PID-loops???

Explicit constrained nonlinear MPC

47

You might also like