ellipsoidal_integrator.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_ELLIPSOIDAL_INTEGRATOR_HPP
00035 #define ACADO_TOOLKIT_ELLIPSOIDAL_INTEGRATOR_HPP
00036 
00037 #include <iostream>
00038 #include <iomanip>
00039 #include <acado/clock/clock.hpp>
00040 #include <acado/utils/acado_utils.hpp>
00041 #include <acado/user_interaction/algorithmic_base.hpp>
00042 #include <acado/matrix_vector/matrix_vector.hpp>
00043 #include <acado/variables_grid/variables_grid.hpp>
00044 #include <acado/symbolic_expression/symbolic_expression.hpp>
00045 #include <acado/function/function.hpp>
00046 #include <acado/set_arithmetics/set_arithmetics.hpp>
00047 
00048 
00049 BEGIN_NAMESPACE_ACADO
00050 
00051 
00060 class EllipsoidalIntegrator : public AlgorithmicBase
00061 {
00062  
00063   public: 
00064   
00066     EllipsoidalIntegrator( );
00067 
00073     EllipsoidalIntegrator( const DifferentialEquation &rhs_, const int &N_ = 3 );
00074 
00076     EllipsoidalIntegrator( const EllipsoidalIntegrator& arg );
00077 
00079     virtual ~EllipsoidalIntegrator( );
00080 
00082     virtual EllipsoidalIntegrator& operator=( const EllipsoidalIntegrator& arg );
00083   
00084         
00085         
00086         
00087         Tmatrix<Interval> integrate( double t0, double tf, int M, const Tmatrix<Interval> &x );
00088         
00089         Tmatrix<Interval> integrate( double t0, double tf, int M, const Tmatrix<Interval> &x, const Tmatrix<Interval> &p );
00090         
00091         Tmatrix<Interval> integrate( double t0, double tf, int M, const Tmatrix<Interval> &x,
00092                                                                  const Tmatrix<Interval> &p, const Tmatrix<Interval> &w );
00093         
00094 
00095         template <typename T> returnValue integrate( double t0, double tf,
00096                                                                                                  Tmatrix<T> *x, Tmatrix<T> *p = 0, Tmatrix<T> *w = 0 );
00097 
00098     template <typename T> double step( const double &t, const double &tf,
00099                                                                            Tmatrix<T> *x, Tmatrix<T> *p = 0, Tmatrix<T> *w = 0 );
00100 
00101         returnValue init( const DifferentialEquation &rhs_, const int &N_ = 3 );
00102 
00103         Tmatrix<Interval> boundQ() const;
00104         
00105         template <typename T> Tmatrix<Interval> getStateBound( const Tmatrix<T> &x ) const;
00106         
00107         
00108         
00109         
00110 // PRIVATE FUNCTIONS:
00111 // ----------------------------------------------------------
00112         
00113 private:
00114         
00115         
00116         virtual returnValue setupOptions( );
00117         
00118         
00119         void copy( const EllipsoidalIntegrator& arg );
00120         
00121         template <typename T> void phase0( double t,
00122                                                                            Tmatrix<T> *x, Tmatrix<T> *p, Tmatrix<T> *w,
00123                                                                            Tmatrix<T> &coeff, Tmatrix<double> &C );
00124         
00125         template <typename T> double phase1(    double t, double tf,
00126                                                                                         Tmatrix<T> *x, Tmatrix<T> *p, Tmatrix<T> *w,
00127                                                                                         Tmatrix<T> &coeff,
00128                                                                                         Tmatrix<double> &C );
00129         
00130         template <typename T> void phase2(      double t, double h,
00131                                                                                 Tmatrix<T> *x, Tmatrix<T> *p, Tmatrix<T> *w,
00132                                                                                 Tmatrix<T> &coeff,
00133                                                                                 Tmatrix<double> &C );
00134 
00135         template <typename T> Tmatrix<T> evaluate(      Function &f, double t,
00136                                                                                                 Tmatrix<T> *x, Tmatrix<T> *p, Tmatrix<T> *w ) const;
00137 
00138 
00139         template <typename T> Tmatrix<T> evaluate(      Function &f, Interval t,
00140                                                                                                 Tmatrix<T> *x, Tmatrix<T> *p, Tmatrix<T> *w ) const;
00141 
00142         
00143         template <typename T> Tmatrix<T> phi( const Tmatrix<T> &coeff, const double &h ) const;
00144         
00145         
00146         
00147         template <typename T> Tmatrix<double> hat( const Tmatrix<T> &x ) const;
00148         
00149         Tmatrix<Interval> evalC ( const Tmatrix<double> &C, double h ) const;
00150         Tmatrix<double>   evalC2( const Tmatrix<double> &C, double h ) const;
00151         
00152         double scale( const         Interval  &E, const   Interval  &X ) const;
00153         double norm ( const Tmatrix<Interval> &E, Tmatrix<Interval> &X ) const;
00154         
00155         
00156         BooleanType isIncluded( const Tmatrix<Interval> &A, const Tmatrix<Interval> &B ) const;
00157 
00158         template <typename T> Tmatrix<Interval> bound( const Tmatrix<T> &x ) const;
00159         
00160         template <typename T> Tmatrix<Interval> getRemainder( const Tmatrix<T> &x ) const;
00161         
00162         template <typename T> Tmatrix<T> getPolynomial( const Tmatrix<T> &x ) const;
00163         
00164         template <typename T> void center( Tmatrix<T> &x ) const;
00165         
00166         void updateQ( Tmatrix<double> C, Tmatrix<Interval> R );
00167         
00168         void setInfinity();
00169         
00170         
00171         
00172 // PRIVATE MEMBERS:
00173 // ----------------------------------------------------------
00174         
00175 private:
00176   
00177         int       nx;   // number of differential states.
00178         int       N ;   // the order of the integrator.
00179         
00180         Function g  ;   // Taylor expansion of the solution trajectory
00181         Function gr ;   // Remainder term associated with g 
00182         Function dg ;   // Jacobian of the function g : g(t,x,...)/dx
00183         Function ddg;   // Directional derivative of dg: (d^2 g(t,x,...)/d^2x)*r*r
00184 
00185     Tmatrix<double>  Q;  // Ellipsoidal remainder matrix
00186     
00187     RealClock totalTime ;
00188     RealClock Phase0Time;
00189     RealClock Phase1Time;
00190 };
00191 
00192 CLOSE_NAMESPACE_ACADO
00193 
00194 
00195 #include <acado/validated_integrator/ellipsoidal_integrator.ipp>
00196 
00197 #endif  // ACADO_TOOLKIT_ELLIPSOIDAL_INTEGRATOR_HPP
00198 
00199 // end of file.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:37:01