ocp_iterate.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 
00034 #ifndef ACADO_TOOLKIT_OCP_ITERATE_HPP
00035 #define ACADO_TOOLKIT_OCP_ITERATE_HPP
00036 
00037 #include <acado/utils/acado_utils.hpp>
00038 #include <acado/variables_grid/variables_grid.hpp>
00039 
00040 
00041 BEGIN_NAMESPACE_ACADO
00042 
00043 
00057 class OCPiterate{
00058 
00059 
00060     //
00061     // PUBLIC MEMBER FUNCTIONS:
00062     //
00063     public:
00064 
00066         OCPiterate( );
00067 
00068                 OCPiterate(     const VariablesGrid* const _x,
00069                                         const VariablesGrid* const _xa,
00070                                         const VariablesGrid* const _p,
00071                                         const VariablesGrid* const _u,
00072                                         const VariablesGrid* const _w
00073                                         );
00074 
00076         OCPiterate( const OCPiterate& rhs );
00077 
00079         virtual ~OCPiterate( );
00080 
00082         OCPiterate& operator=( const OCPiterate& rhs );
00083 
00084 
00085                 returnValue allocateAll( );
00086                 
00087                 returnValue init(       const VariablesGrid* const _x,
00088                                                         const VariablesGrid* const _xa,
00089                                                         const VariablesGrid* const _p,
00090                                                         const VariablesGrid* const _u,
00091                                                         const VariablesGrid* const _w
00092                                                         );
00093 
00094                 returnValue clear( );
00095 
00097         //OCPiterate& operator+=( const OCPiterate& rhs );
00098 
00099 
00101         inline uint getNX( ) const;
00102 
00104         inline uint getNXA( ) const;
00105 
00107         inline uint getNP( ) const;
00108 
00110         inline uint getNU( ) const;
00111 
00113         inline uint getNW( ) const;
00114 
00115 
00116                 uint getNumPoints( ) const;
00117 
00118 
00119                 returnValue print( ) const;
00120 
00121         inline double getTime( const uint &idx ) const;
00122 
00123         inline DVector getX   ( const uint &idx ) const;
00124         inline DVector getXA  ( const uint &idx ) const;
00125         inline DVector getP   ( const uint &idx ) const;
00126         inline DVector getU   ( const uint &idx ) const;
00127         inline DVector getW   ( const uint &idx ) const;
00128 
00129 
00130         inline Grid getGrid() const;
00131 
00132 
00137         Grid getUnionGrid( ) const;
00138 
00139 
00140                 BooleanType areGridsConsistent( );
00141 
00142 
00143         returnValue getInitialData( DVector &x_  = emptyVector,
00144                                     DVector &xa_ = emptyVector,
00145                                     DVector &p_  = emptyVector,
00146                                     DVector &u_  = emptyVector,
00147                                     DVector &w_  = emptyVector  ) const;
00148 
00149 
00150         returnValue updateData(  double t                 ,
00151                                  DVector &x_  = emptyVector,
00152                                  DVector &xa_ = emptyVector,
00153                                  DVector &p_  = emptyVector,
00154                                  DVector &u_  = emptyVector,
00155                                  DVector &w_  = emptyVector  );
00156 
00157 
00158                 returnValue applyStep(  const BlockMatrix& bm,
00159                                                         double alpha
00160                                                                 );
00161 
00162 
00163         returnValue enableSimulationMode( );
00164 
00165                 inline BooleanType isInSimulationMode( ) const;
00166 
00167 
00173                 virtual returnValue shift(      double timeShift = -1.0,
00174                                                                         DVector  lastX    =  emptyVector,
00175                                                                         DVector lastXA    =  emptyVector,
00176                                                                         DVector lastP     =  emptyVector,
00177                                                                         DVector lastU     =  emptyVector,
00178                                                                         DVector lastW     =  emptyVector );
00179 
00180 
00181     //
00182     // PUBLIC DATA MEMBERS:
00183     //
00184     public:
00185 
00186         VariablesGrid  *x ;  // the differential state variables
00187         VariablesGrid  *xa;  // the algebraic state variables
00188         VariablesGrid  *p ;  // the parameter
00189         VariablesGrid  *u ;  // the control variables
00190         VariablesGrid  *w ;  // the disturbances
00191 
00192 
00193 
00194     // PROTECTED MEMBER FUNCTIONS:
00195     // ---------------------------
00196     protected:
00197 
00198                 void copy (const OCPiterate& rhs);
00199 
00200                 inline DVector copy ( const VariablesGrid *z, const uint &idx ) const;
00201 
00202                 inline uint getDim( VariablesGrid *z ) const;
00203 
00204 
00205         void update( double t, VariablesGrid &z1, DVector &z2 ) const;
00206 
00207 
00208     //
00209     // PUBLIC DATA MEMBERS:
00210     //
00211     protected:
00212                 
00213                 BooleanType inSimulationMode;
00214 };
00215 
00216 
00217 CLOSE_NAMESPACE_ACADO
00218 
00219 
00220 #include <acado/function/ocp_iterate.ipp>
00221 
00222 #endif  // ACADO_TOOLKIT_OCP_ITERATE_HPP
00223 
00224 /*
00225  *  end of file
00226  */


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