Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00034 #ifndef ACADO_TOOLKIT_INTEGRATOR_LYAPUNOV_HPP
00035 #define ACADO_TOOLKIT_INTEGRATOR_LYAPUNOV_HPP
00036
00037
00038 #include <acado/integrator/integrator_fwd.hpp>
00039
00040
00041 BEGIN_NAMESPACE_ACADO
00042
00043
00054 class IntegratorLYAPUNOV : public Integrator{
00055
00056
00057
00058
00059
00060 public:
00061
00063 IntegratorLYAPUNOV();
00064
00066 IntegratorLYAPUNOV( int dim_, double power_ );
00067
00069 IntegratorLYAPUNOV( const DifferentialEquation &rhs_, int dim_, double power_ );
00070
00072 IntegratorLYAPUNOV( const IntegratorLYAPUNOV& arg );
00073
00075 virtual ~IntegratorLYAPUNOV( );
00076
00078 virtual IntegratorLYAPUNOV& operator=( const IntegratorLYAPUNOV& arg );
00079
00081 virtual Integrator* clone() const = 0;
00082
00083
00084
00085
00086
00087
00096 virtual returnValue init( const DifferentialEquation &rhs_ );
00097
00109 inline returnValue init( const DifferentialEquation &rhs_,
00110 const Transition &trs_ );
00111
00112
00113
00114
00124 virtual returnValue freezeMesh();
00125
00126
00135 virtual returnValue freezeAll();
00136
00137
00145 virtual returnValue unfreeze();
00146
00147
00148
00149
00150
00173 virtual returnValue step( int number
00174 );
00175
00176
00185 virtual returnValue stop();
00186
00187
00192 virtual returnValue setDxInitialization( double *dx0 );
00196
00197
00198
00199
00203 virtual int getNumberOfSteps() const;
00204
00205
00209 virtual int getNumberOfRejectedSteps() const;
00210
00211
00213 virtual double getStepSize() const;
00214
00215
00216
00217
00218
00219 protected:
00220
00221
00222
00223
00224
00225
00231 virtual returnValue evaluateSensitivities();
00232
00233
00234
00236 virtual int getDim() const;
00237
00238
00239
00240
00241
00242
00246 virtual returnValue evaluate( const DVector &x0 ,
00247 const DVector &xa ,
00248 const DVector &p ,
00249 const DVector &u ,
00250 const DVector &w ,
00251 const Grid &t_ );
00252
00253
00254
00255
00256
00261 virtual returnValue setProtectedForwardSeed( const DVector &xSeed ,
00263 const DVector &pSeed ,
00265 const DVector &uSeed ,
00267 const DVector &wSeed ,
00269 const int &order );
00271
00272
00273
00274
00279 virtual returnValue setProtectedBackwardSeed( const DVector &seed ,
00281 const int &order );
00283
00284
00285
00286
00287
00291 virtual returnValue getProtectedX( DVector *xEnd ) const;
00294
00295
00300 virtual returnValue getProtectedForwardSensitivities( DMatrix *Dx ,
00303 int order ) const;
00304
00305
00306
00318 virtual returnValue getProtectedBackwardSensitivities( DVector &Dx_x0,
00319 DVector &Dx_p ,
00320 DVector &Dx_u ,
00321 DVector &Dx_w ,
00322 int order ) const;
00323
00324
00325
00326
00327
00328
00331 void deleteAll();
00332
00333
00336 void constructAll( const IntegratorLYAPUNOV& arg );
00337
00338
00339
00346 void allocateMemory( );
00347
00348
00354 void initializeVariables();
00355
00356
00358 virtual void initializeButcherTableau() = 0;
00359
00360
00364 double determineEta45();
00365
00366
00370 double determineEta45( int number );
00371
00372
00375 void determineEtaGForward( int number );
00376
00377
00381 void determineEtaGForward2( int number );
00382
00383
00386 void determineEtaHBackward( int number );
00387
00388
00391 void determineEtaHBackward2( int number );
00392
00393
00397 void printIntermediateResults();
00398
00399
00400
00403 returnValue setForwardSeed2( const DVector &xSeed ,
00405 const DVector &pSeed ,
00407 const DVector &uSeed ,
00409 const DVector &wSeed );
00411
00412
00415 virtual returnValue setBackwardSeed2( const DVector &seed );
00417
00418
00419
00420 void interpolate( int jj, double *e1, double *d1, double *e2, VariablesGrid &poly );
00421
00422
00423 void logCurrentIntegratorStep( const DVector& currentX = emptyConstVector
00424 );
00425
00426
00427
00428
00429 protected:
00430
00431
00432
00433
00434
00435 int dim ;
00436 double **A ;
00437 double *b4 ;
00438 double *b5 ;
00439 double *c ;
00442
00443
00444 double *eta4 ;
00445 double *eta5 ;
00446 double *eta4_ ;
00447 double *eta5_ ;
00448 double **k ;
00449 double **k2 ;
00450 double **l ;
00451 double **l2 ;
00452 double t ;
00453 double *x ;
00454 double err_power ;
00457
00458
00459 DVector fseed ;
00460 DVector bseed ;
00462 DVector fseed2 ;
00463 DVector bseed2 ;
00465 double *G ;
00466 double *etaG ;
00468 double *G2 ;
00469 double *G3 ;
00470 double *etaG2 ;
00471 double *etaG3 ;
00473 double *H ;
00474 double *etaH ;
00476 double *H2 ;
00477 double *H3 ;
00478 double *etaH2 ;
00479 double *etaH3 ;
00481
00482
00483 int maxAlloc ;
00486
00487 int dimxmy ;
00488 int dimu ;
00489 int dimp ;
00490 int dimw ;
00491
00492
00493 double **Y ;
00494
00495 double *seedmy ;
00496 Lyapunov lyap;
00497 };
00498
00499
00500 CLOSE_NAMESPACE_ACADO
00501
00502
00503 #include <acado/integrator/integrator_lyapunov.ipp>
00504
00505
00506 #endif // ACADO_TOOLKIT_INTEGRATOR_RUNGE_KUTTA_HPP
00507
00508