c_function.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 
00035 #ifndef ACADO_TOOLKIT_C_FUNCTION_HPP
00036 #define ACADO_TOOLKIT_C_FUNCTION_HPP
00037 
00038 
00039 #include <acado/symbolic_expression/symbolic_expression.hpp>
00040 
00041 
00042 BEGIN_NAMESPACE_ACADO
00043 
00044 
00054 class CFunction{
00055 
00056     //
00057     // PUBLIC MEMBER FUNCTIONS:
00058     //
00059 
00060     public:
00061 
00063     CFunction( );
00064 
00065 
00068     CFunction( uint dim, cFcnPtr cFcn_  );
00069 
00070 
00074     CFunction( uint dim, cFcnPtr  cFcn_        ,  
00075                          cFcnDPtr cFcnDForward_,  
00076                          cFcnDPtr cFcnDBackward_   );
00077 
00078 
00080     CFunction( const CFunction& rhs );
00081 
00083     virtual ~CFunction( );
00084 
00086     CFunction& operator=( const CFunction& rhs );
00087 
00088 
00090     virtual Expression operator()( const Expression &arg );
00091 
00092 
00096     virtual uint getDim () const;
00097 
00098 
00103     virtual returnValue evaluate( double *x         ,
00104                                   double *result      );
00105 
00106 
00107 
00111      virtual void evaluateCFunction( double *x         ,
00112                                      double *result       );
00113 
00114 
00115 
00122     virtual returnValue evaluate( double *x         ,
00123                                   double *result    ,
00124                                   PrintLevel printL     );
00125 
00126 
00133     virtual returnValue evaluate( int     number    ,
00134                                   double *x         ,
00135                                   double *result      );
00136 
00137 
00142      virtual returnValue AD_forward( double *x     ,
00144                                      double *seed  ,
00145                                      double *f     ,
00147                                      double *df      );
00149 
00150 
00157      virtual returnValue AD_forward( int     number  ,
00158                                      double *seed    ,
00159                                      double *df        );
00161 
00162 
00170      virtual returnValue AD_forward( int     number  ,
00171                                      double *x       ,
00173                                      double *seed    ,
00174                                      double *f       ,
00176                                      double *df        );
00178 
00179 
00180     // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
00181     //                                   the point x and to compute f.
00182 
00187      virtual returnValue AD_backward( double *seed ,
00188                                       double  *df     );
00190 
00191 
00192 
00193     // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
00194     //                                   the point x and to compute f.
00195 
00201      virtual returnValue AD_backward( int    number ,
00203                                       double *seed  ,
00204                                       double  *df   );
00206 
00207 
00215      virtual returnValue AD_forward2( int    number  ,
00217                                       double *seed1  ,
00218                                       double *seed2  ,
00220                                       double *df     ,
00222                                       double *ddf    );
00224 
00225 
00226     // IMPORTANT REMARK FOR AD_BACKWARD2: run AD_forward first to define
00227     //                                    the point x and to compute f and df.
00228 
00234      virtual returnValue AD_backward2( int    number ,
00236                                        double *seed1 ,
00237                                        double *seed2 ,
00238                                        double   *df  ,
00240                                        double  *ddf     );
00242 
00243 
00244 
00249      virtual returnValue clearBuffer();
00250 
00251 
00259      virtual returnValue setUserData( void * user_data_  );
00260 
00261 
00262 
00263 //
00264 //  PROTECTED FUNCTIONS:
00265 //
00266 
00267 protected:
00268 
00271      void copy( const CFunction &arg );
00272 
00273 
00276      void deleteAll();
00277 
00278 
00279 
00280 //
00281 //  PROTECTED MEMBERS:
00282 //
00283 
00284      protected:
00285 
00287         returnValue initialize();
00288 
00289         cFcnPtr   cFcn         ;
00290         cFcnDPtr  cFcnDForward ;
00291         cFcnDPtr  cFcnDBackward;
00292 
00293   
00294         void* user_data        ;    
00297         uint     nn            ;    
00298         uint     dim           ;    
00300         uint     maxAlloc      ;    
00301         double **xStore        ;    
00302         double **seedStore     ;    
00303 };
00304 
00305 
00306 CLOSE_NAMESPACE_ACADO
00307 
00308 
00309 
00310 
00311 #endif  // ACADO_TOOLKIT_C_FUNCTION_HPP
00312 
00313 /*
00314  *   end of file
00315  */
00316 


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