integrator_lyapunov.hpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
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 // PUBLIC MEMBER FUNCTIONS:
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 // PROTECTED MEMBER FUNCTIONS:
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 // DATA MEMBERS:
00428 //
00429 protected:
00430 
00431 
00432     // BUTCHER-
00433     // TABLEAU:
00434     // ----------
00435     int      dim               ;  
00436     double **A                 ;  
00437     double  *b4                ;  
00438     double  *b5                ;  
00439     double  *c                 ;  
00442     // RK-ALGORITHM:
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     // SENSITIVITIES:
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     // STORAGE:
00482     // --------
00483     int maxAlloc                ;  
00486   // Original ODE
00487   int dimxmy                    ; /* dimension  of  the  original ODE*/
00488   int dimu                    ; /* dimension  of  the  control*/
00489   int dimp                    ; /* dimension  of  the  parameters*/
00490   int dimw                    ; /* dimension  of  the  disturbances*/
00491  
00492   // Sensitivities
00493   double **Y                  ;  /* sensitivity matrix  */    
00494 
00495   double *seedmy              ; /* Seed vector */
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 // end of file.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:58:37