powerint.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_POWERINT_HPP
00036 #define ACADO_TOOLKIT_POWERINT_HPP
00037 
00038 
00039 #include <acado/symbolic_operator/symbolic_operator_fwd.hpp>
00040 
00041 
00042 BEGIN_NAMESPACE_ACADO
00043 
00044 
00055 class Power_Int : public SmoothOperator{
00056 
00057 public:
00058 
00059 
00061     Power_Int();
00062 
00064     Power_Int( Operator *_argument, int _exponent );
00065 
00067     Power_Int( const Power_Int &arg );
00068 
00070     ~Power_Int();
00071 
00073     Power_Int& operator=( const Power_Int &arg );
00074 
00075 
00076 
00083     virtual returnValue evaluate( int     number    ,
00084                                   double *x         ,
00085                                   double *result      );
00086 
00087 
00089         virtual returnValue evaluate( EvaluationBase *x );
00090         
00091         
00092         
00098      virtual Operator* differentiate( int index   );
00099 
00100 
00101 
00107      virtual Operator* AD_forward( int                dim      , 
00108                                      VariableType      *varType  , 
00109                                      int               *component, 
00110                                      Operator       **seed     , 
00111                                      int                &nNewIS  , 
00112                                      TreeProjection ***newIS     );
00113 
00114 
00115 
00121     virtual returnValue AD_backward( int           dim      , 
00122                                      VariableType *varType  , 
00123                                      int          *component, 
00124                                      Operator     *seed     , 
00125                                      Operator    **df       , 
00126                                      int           &nNewIS  , 
00127                                      TreeProjection ***newIS   );
00128 
00129     
00130     
00136      virtual returnValue AD_symmetric( int            dim       , 
00137                                       VariableType  *varType   , 
00138                                       int           *component , 
00139                                       Operator      *l         , 
00140                                       Operator     **S         , 
00141                                       int            dimS      , 
00142                                       Operator     **dfS       , 
00143                                       Operator     **ldf       , 
00144                                       Operator     **H         , 
00145                                       int            &nNewLIS  , 
00146                                       TreeProjection ***newLIS , 
00147                                       int            &nNewSIS  , 
00148                                       TreeProjection ***newSIS , 
00149                                       int            &nNewHIS  , 
00150                                       TreeProjection ***newHIS    );
00151 
00152 
00157      virtual Operator* substitute( int   index           ,
00158                                      const Operator *sub );
00159 
00160 
00161 
00168      virtual NeutralElement isOneOrZero() const;
00169 
00170 
00171 
00172 
00178      virtual BooleanType isDependingOn( VariableType var ) const;
00179 
00185      virtual BooleanType isDependingOn( int           dim      ,    
00186                                           VariableType *varType  ,    
00187                                           int          *component,    
00188                                           BooleanType   *implicit_dep  );
00189 
00190 
00191 
00192 
00200      virtual BooleanType isLinearIn( int           dim      ,    
00201                                        VariableType *varType  ,    
00202                                        int          *component,    
00203                                        BooleanType  *implicit_dep   );
00204 
00205 
00206 
00213      virtual BooleanType isPolynomialIn( int           dim      ,    
00214                                            VariableType *varType  ,    
00215                                            int          *component,    
00216                                            BooleanType  *implicit_dep   );
00217 
00218 
00219 
00226      virtual BooleanType isRationalIn( int           dim      ,    
00227                                          VariableType *varType  ,    
00228                                          int          *component,    
00229                                          BooleanType  *implicit_dep   );
00230 
00231 
00238      virtual MonotonicityType getMonotonicity( );
00239 
00240 
00241 
00249      virtual CurvatureType getCurvature( );
00250 
00251 
00252 
00258      virtual returnValue setMonotonicity( MonotonicityType monotonicity_ );
00259 
00260 
00261 
00262 
00268      virtual returnValue setCurvature( CurvatureType curvature_  );
00269 
00270 
00277      virtual returnValue AD_forward( int     number  ,
00278                                      double *seed    ,
00279                                      double *df        );
00281 
00282 
00283 
00284 
00292      virtual returnValue AD_forward( int     number  ,
00293                                      double *x       ,
00295                                      double *seed    ,
00296                                      double *f       ,
00298                                      double *df        );
00300 
00301 
00302 
00303     // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
00304     //                                   the point x and to compute f.
00305 
00311      virtual returnValue AD_backward( int    number ,
00313                                       double seed   ,
00314                                       double  *df   );
00316 
00317 
00318 
00326      virtual returnValue AD_forward2( int    number  ,
00328                                       double *seed1  ,
00329                                       double *seed2  ,
00331                                       double *df     ,
00333                                       double *ddf    );
00335 
00336 
00337 
00338     // IMPORTANT REMARK FOR AD_BACKWARD2: run AD_forward first to define
00339     //                                    the point x and to compute f and df.
00340 
00346      virtual returnValue AD_backward2( int    number ,
00348                                        double seed1  ,
00349                                        double seed2  ,
00350                                        double   *df  ,
00352                                        double  *ddf     );
00354 
00358      virtual std::ostream& print( std::ostream &stream ) const;
00359 
00360 
00364      virtual Operator* clone() const;
00365 
00366 
00371      virtual returnValue clearBuffer();
00372 
00373 
00374 
00379      virtual returnValue enumerateVariables( SymbolicIndexList *indexList );
00380 
00381 
00382 
00383 
00387      virtual OperatorName getName();
00388 
00389 
00390      virtual returnValue initDerivative();
00391 
00392 
00393 
00397      virtual BooleanType isVariable( VariableType &varType,
00398                                      int &component          ) const;
00399 
00400 
00401 
00420      virtual returnValue loadIndices( SymbolicIndexList *indexList );
00423 
00424 
00430     virtual BooleanType isSymbolic() const;
00431 
00432 
00433 
00437     virtual returnValue setVariableExportName(  const VariableType &_type,
00438                                                                                         const std::vector< std::string >& _name
00439                                                                                         );
00440 
00441 
00442 //
00443 //  PROTECTED FUNCTIONS:
00444 //
00445 
00446 protected:
00447 
00448 
00449 //
00450 //  PROTECTED MEMBERS:
00451 //
00452 
00453 protected:
00454 
00455         TreeProjection  *derivative;            
00456         TreeProjection  *derivative2;           
00458     Operator *argument ;       
00461     int         exponent ;       
00464     Operator *dargument;       
00467     double *  argument_result;   
00470     double * dargument_result;   
00474     int     bufferSize       ;   
00476     CurvatureType     curvature   ;
00477     MonotonicityType  monotonicity;
00478 };
00479 
00480 
00481 CLOSE_NAMESPACE_ACADO
00482 
00483 
00484 
00485 #endif


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