Вы находитесь на странице: 1из 6

18th IEEE International Conference on Control Applications Part of 2009 IEEE Multi-conference on Systems and Control Saint Petersburg, Russia, July 8-10, 2009

A Ge n er i c D yn am i c Progr amm i n g Matl ab Fun c ti on

O lle S und s to m a nd L ino G u zze lla

Abstract T h i s p ap er i n t rodu ces a gen eri c d yn ami c p ro- grammi n g f un ct i on for M at l ab. T h i s f un ct i on sol ves d i scret e- t i me op t i mal - con t rol p rob l ems u si n g B ell man s d yn ami c p ro- grammi n g al gori t h m. T h e f un ct i on i s i mp l emen t ed su ch t h at t h e u ser on l y n eed s t o p rovi d e t h e ob j ect ive f un ct i on and t h e mod el equ at i on s. T h e f un ct i on i n cl ud es several op t i on s for sol vi n g op t i mal - con t rol p rob l ems. T h e mod el equ at i on s can i n cl ud e several st at e vari ab l es and i npu t vari ab l es. F u rt h ermore, t h e mod el equ at i on s can b e t i me- vari an t and i n cl ud e t i me- vari an t st at e and i npu t con st rai n t s. T h e syn t ax of t h e f un ct i on i s exp l ai n ed u si n g t wo examp l es. T h e rst i s t h e w ell - kn ow n L ot k a- Vol t erra sh ery p rob l em and t h e second i s a p arall el hyb ri d - el ect ri c veh i cl e op t i mi zat i on p rob l em.

I . I N T R ODU C T I ON

Wh e n d eve lop ing ca u sa l subop tim a l c on tr o lle r s it is a n

a dva n ta g e if th e op tim a l c on tr o lle r is know n , eve n if th is c on -

tr o lle r is no t ca u sa l. I n m a ny ca se s, su c h op tim a l c on tr o lle r s

ca n b e f ound u sing th e d e te r m in istic dyn a m ic p r og r a mm ing

( D P) a lgo r ith m in tr odu ce d in [ 1] . O f c ou r se , th is op tim a l c on tr o lle r ca n b e f ound on ly if a ll f u tu r e d istu r b a n ce a nd

r e f e r e n ce inpu ts a r e know n . I n th is se n se , th is so lu tion is no t ca u sa l. N eve r th e le ss, th is op tim a l so lu tion is ve r y u se f u l, b eca u se it ca n b e u se d a s a b e n c h m a r k to w h ic h a ll o th e r

ca u sa l c on tr o lle r s ca n b e c o m p a r e d to . M a ny ex ce lle n t tex t book s h ave b ee n pub lish e d on th e sub jec t o f D P th e o r y, a m ong th e m [ 2] a nd [ 3] . A n ove r v iew o f th e h isto r y a nd d eve lop m e n t o f dyn a m ic p r og r a mm ing is show n in [ 4] . I n te r e ste d r ea d e r s a r e r e f e rr e d to th e se

r e f e r e n ce s f o r a d e ta ile d d isc u ssion o f th e b a sic id ea s o f

D

P. Wh e n im p le m e n ting th e d e te r m in istic D P a lgo r ith m on

a

c o m pu te r th e r e a r e m a ny nu m e r ica l issu e s th a t a r ise th a t

h

ave , so fa r, no t y e t r ece ive d su fc ie n t a tte n tion . A lso , sin ce

th e c o m pu ta tion a l c o m p lex ity o f eve r y D P a lgo r ith m is ex -

pon e n tia l in th e nu m b e r o f sta te s a nd inpu ts, sp ec ia l a tte n tion

m u st b e g ive n to m in im iz ing th e ove r a ll c o m pu ta tion a l c o st.

T h e im p le m e n ta tion o f su ita b le nu m e r ica l a lgo r ith m s th a t

e fc ie n tly so lve a g ive n D P p r ob le m is, th e r e f o r e , a non tr iv ia l

p a r t o f a d e sign p r o ce ss. T h is p a p e r p r e se n ts a M a tla b f un c tion th a t e fc ie n tly

so lve s d e te r m in istic D P p r ob le m s. T h e f o c u s lie s on th e op ti-

m a l c on tr o l o f non - lin ea r, tim e - va r ia n t, c on str a in e d , d isc r e te - tim e a pp r ox im a tion s o f c on tinuou s- tim e dyn a m ic m od e ls.

O n e a r ea w h e r e su c h D P too ls h ave b ee n u se d su cce ssf u lly is

th e e n e rgy m a n a g e m e n t p r ob le m in hyb r id - e lec tr ic ve h ic le s

[ 5] , [ 6] .

O . S unds tro¨ m , D epartm ent of Mechanical and P rocess E ngineering ET H Z urich, 8092 Z urich, S w itzerland and E m pa, S w iss F ederal L aboratories for Materials Tes ting and Res earch, 8600 D ub¨ endorf, S w itzerland, s und- s troem @im rt. m avt. ethz. ch L . G uzzella, D epartm ent of Mechanical and P rocess E ngineering ET H Z urich, 8092 Z urich, S w itzerland, guzzella@im rt. m avt. ethz. ch

T h e c la ss o f op tim a l c on tr o l p r ob le m s th a t ca n b e so lve d u sing th e p r opo se d M a tla b f un c tion ca n b e w r itte n a s:

( 1 )

min J (u (t ))

u( t)

s .t.

x˙ (t ) = F (x(t ), u (t ), t ) x(0 ) = x 0

x(t f ) [x f , m in , x f , m ax ]

x(t ) X (t ) R n u (t ) U (t ) R m

(

(

(

(

(

2

3

4

5

6

)

)

)

)

)

w h e r e

J (u (t )) = G(x(t f )) + t f H (x(t ), u (t ), t )dt

0

(

7

)

is th e c o st f un c tion a l. T h e im po r ta n t c h a r ac te r istic s o f th e c on sid e r e d op tim a l- c on tr o l p r ob le m s a r e th e tim e - va r ia n t c on str a in ts on th e inpu t a nd th e sta te , th e c on str a in e d n a l sta te , a nd th e tim e - va r ia n t m od e l e qu a tion . T h e se p r ob le m s a r e in g e n e r a l d ifc u lt to so lve . H ow eve r, th e se p r ob le m s ca n b e so lve d u sing Be llm a n s D P [ 1] , p r ov id e d th a t th e c ond ition s sta te d in th e n ex t sec tion a r e sa tise d .

II . DYNA M I C P R OG R A MM I NG A L GO R I T H M

T h is sec tion g ive s a b r ie f ove r v iew o f th e d e te r m in istic D P a lgo r ith m a s it is im p le m e n te d in th e dpm f un c tion . Sin ce D P is u se d h e r e to so lve a c on tinuou s- tim e c on tr o l p r ob le m , th e c on tinuou s- tim e m od e l ( 2 ) m u st b e d isc r e tize d in tim e r st. L e t th e d isc r e te - tim e m od e l b e g ive n by

( 8 )

w ith th e sta te va r ia b le x k X k a nd th e c on tr o l sign a l u k U k .

A. Basic Algorithm

c on tr o l po licy. Fu r th e r le t

th e d isc r e tize d c o st o f ( 7 ) u sing π w ith th e in itia l sta te x(0 ) = x 0 b e

x k +1 = F k (x k , u k ),

k = 0 , 1 ,

, N 1

L e t π = { µ 0 , µ 1 ,

µ N 1 } b e a

J π (x 0 ) = g N (x N ) + φ N (x N )

N 1

+

h k (x k , µ k (x k )) + φ k (x k ),

( 9 )

k

=0

w h e r e g N (x N ) + φ N (x N ) is th e n a l c o st. T h e r st g N (x N ) r e p r e se n ts th e n a l c o st in ( 7 ) . T h e sec ond

te r m te r m

is a n a dd ition a l p e n a lty f un c tion φ N (x N ) th a t ca n b e u se d to e n f o r ce a c on str a in t on th e n a l sta te ( 4 ) . T h e f un c tion h k (x k , µ k (x k )) is th e c o st o f a pp ly ing th e c on tr o l µ k (x k ) a t x k , acc o r d ing to H (x(t ), u (t ), t ) in ( 7 ) . T h e sta te c on - str a in ts ( 5 ) a r e e n f o r ce d by th e p e n a lty f un c tion φ k (x k )

978-1-4244-4602-5/09/$25.00 ©2009 IEEE

1625

f o r k = 0 , 1 ,

po licy th a t m in im ize s J π

, N 1. T h e op tim a l c on tr o l po licy π o is th e

J o (x 0 ) = min J π (x 0 ),

π Π

( 10 )

w h e r e Π is th e se t o f a ll a d m issib le po lic ie s. Ba se d on th e p r in c ip le o f op tim a lity [ 1] , th e D P a lgo r ith m eva lu a te s th e op tim a l c o st- to - go 1 f un c tion J k (x i ) a t eve r y nod e in th e d isc r e tize d sta te - tim e sp ace 2 by p r o cee d ing backward in tim e :

1 ) E nd c o st ca lc u la tion ste p

J N (x i ) = g N (x i ) + φ N (x i )

(

11 )

2 ) I n te r m e d ia te ca lc u la tion ste p f o r k = N 1 to 0

J k (x i ) = min k { h k (x i , u k ) + φ k (x i )

u k U

+J k +1 (F k (x i , u k ))} ( 12 )

T h e op tim a l c on tr o l is g ive n by th e a rgu m e n t th a t m in im ize s th e r igh t- h a nd sid e o f e qu a tion ( 12 ) f o r eac h x i a t tim e ind ex k o f th e d isc r e tize d sta te - tim e sp ace . T h e c o st- to - go f un c tion J k +1 (x) u se d in ( 12 ) is eva lu a te d on ly on d isc r e tize d po in ts in th e sta te sp ace . Fu r th e r m o r e , th e ou tpu t o f th e m od e l f un c tion F k (x i , u k ) is a c on tinuou s va r ia b le in th e sta te sp ace w h ic h ca n b e b e tw ee n th e nod e s o f th e sta te g r id . Con se qu e n tly, th e la st te r m in ( 12 ) , n a m e ly J k +1 (F k (x i , u k )) m u st b e eva lu a te d a pp r op r ia te ly. T h e r e ex ist seve r a l m e thod s o f nd ing th e a pp r op r ia te c o st- to - go J k +1 (F k (x i , u k )) su c h a s u sing a n ea r e st- n e ighbo r a pp r ox i- m a tion o r u sing m o r e a dva n ce d in te r po la tion sc h e m e s. I n th e dpm f un c tion in tr odu ce d in th is p a p e r, lin ea r in te r po la tion o f th e c o st- to - go J k +1 is u se d . Sin ce th e sta te a nd th e inpu t g r id s a r e e qu a lly sp ace d , th e c o m pu ta tion a l c o st o f th is in te r po la tion is low c o m p a r e d to th e c o st indu ce d by th e m od e l eva lu a tion s. T h e ou tpu t o f th e a lgo r ith m ( 11 ) ( 12 ) is a n op tim a l c on tr o l sign a l m a p . T h is m a p is u se d to nd th e op tim a l c on tr o l sign a l du r ing a f o r wa r d sim u la tion o f th e m od e l ( 8 ) , sta r ting fr o m a g ive n in itia l sta te x 0 , to g e n e r a te th e op tim a l sta te tr a jec to r y. I n th e op tim a l c on tr o l sign a l m a p th e c on tr o l sign a l is on ly g ive n f o r th e d isc r e te po i