binary_operator.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_BINARY_OPERATOR_HPP
00036 #define ACADO_TOOLKIT_BINARY_OPERATOR_HPP
00037 
00038 
00039 #include <acado/symbolic_operator/symbolic_operator_fwd.hpp>
00040 
00041 
00042 BEGIN_NAMESPACE_ACADO
00043 
00044 
00056 class BinaryOperator : public SmoothOperator{
00057 
00058 public:
00059 
00060   friend class Power_Int;
00062   BinaryOperator();
00063 
00065   BinaryOperator( Operator *_argument1, Operator *_argument2 );
00066 
00068   BinaryOperator( const BinaryOperator &arg );
00069 
00071   virtual ~BinaryOperator();
00072 
00074   BinaryOperator& operator=( const BinaryOperator &arg );
00075 
00076 
00083     virtual returnValue evaluate( int     number    ,
00084                                   double *x         ,
00085                                   double *result      ) = 0;
00086 
00087 
00089         virtual returnValue evaluate( EvaluationBase *x ) = 0;
00090         
00091         
00097      virtual Operator* differentiate( int index      ) = 0;
00098 
00099 
00100 
00106      virtual Operator* AD_forward( int                dim      , 
00107                                      VariableType      *varType  , 
00108                                      int               *component, 
00109                                      Operator       **seed     , 
00110                                      int                &nNewIS  , 
00111                                      TreeProjection ***newIS     ) = 0;
00112 
00113 
00114 
00120     virtual returnValue AD_backward( int           dim      , 
00121                                      VariableType *varType  , 
00122                                      int          *component, 
00123                                      Operator     *seed     , 
00124                                      Operator    **df       , 
00125                                      int           &nNewIS  , 
00126                                      TreeProjection ***newIS   ) = 0;
00127 
00128     
00129     
00135      virtual returnValue AD_symmetric( int            dim       , 
00136                                       VariableType  *varType   , 
00137                                       int           *component , 
00138                                       Operator      *l         , 
00139                                       Operator     **S         , 
00140                                       int            dimS      , 
00141                                       Operator     **dfS       , 
00142                                       Operator     **ldf       , 
00143                                       Operator     **H         , 
00144                                       int            &nNewLIS  , 
00145                                       TreeProjection ***newLIS , 
00146                                       int            &nNewSIS  , 
00147                                       TreeProjection ***newSIS , 
00148                                       int            &nNewHIS  , 
00149                                       TreeProjection ***newHIS    ) = 0;
00150 
00151 
00156      virtual Operator* substitute( int   index            ,
00157                                      const Operator *sub  ) = 0;
00158 
00159 
00160 
00167      virtual NeutralElement isOneOrZero() const;
00168 
00169 
00170 
00176      virtual BooleanType isDependingOn( VariableType var ) const;
00177 
00178 
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   ) = 0;
00204 
00205 
00206 
00213      virtual BooleanType isPolynomialIn( int           dim      ,    
00214                                            VariableType *varType  ,    
00215                                            int          *component,    
00216                                            BooleanType  *implicit_dep   ) = 0;
00217 
00218 
00219 
00226      virtual BooleanType isRationalIn( int           dim      ,    
00227                                          VariableType *varType  ,    
00228                                          int          *component,    
00229                                          BooleanType  *implicit_dep   ) = 0;
00230 
00231 
00238      virtual MonotonicityType getMonotonicity( ) = 0;
00239 
00240 
00241 
00249      virtual CurvatureType getCurvature( ) = 0;
00250 
00251 
00252 
00258      virtual returnValue setMonotonicity( MonotonicityType monotonicity_ );
00259 
00260 
00261 
00262 
00268      virtual returnValue setCurvature( CurvatureType curvature_  );
00269 
00270 
00271 
00279      virtual returnValue AD_forward( int     number  ,
00280                                      double *x       ,
00282                                      double *seed    ,
00283                                      double *f       ,
00285                                      double *df        ) = 0;
00287 
00288 
00289 
00296      virtual returnValue AD_forward( int     number  ,
00297                                      double *seed    ,
00298                                      double *df        ) = 0;
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   ) = 0;
00316 
00317 
00318 
00326      virtual returnValue AD_forward2( int    number  ,
00328                                       double *seed1  ,
00329                                       double *seed2  ,
00331                                       double *df     ,
00333                                       double *ddf    ) = 0;
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     ) = 0;
00354 
00355 
00359      virtual Operator* clone() const = 0;
00360 
00361 
00366      virtual returnValue clearBuffer();
00367 
00368 
00369 
00373      virtual std::ostream& print( std::ostream &stream ) const = 0;
00374 
00375 
00376 
00381      virtual returnValue enumerateVariables( SymbolicIndexList *indexList );
00382 
00383 
00384 
00388      virtual OperatorName getName() = 0;
00389 
00390 
00394      virtual BooleanType isVariable( VariableType &varType,
00395                                      int &component          ) const;
00396 
00397 
00416      virtual returnValue loadIndices( SymbolicIndexList *indexList  );
00418 
00419 
00420 
00426     virtual BooleanType isSymbolic() const;
00427 
00428 
00429 
00433     virtual returnValue setVariableExportName(  const VariableType &_type,
00434                                                                                                 const std::vector< std::string >& _name
00435                                                                                                 );
00436 
00437     virtual returnValue initDerivative();
00438 
00439 //
00440 //  PROTECTED FUNCTIONS:
00441 //
00442 
00443 protected:
00444 
00445 
00446 
00447     void copy( const BinaryOperator &arg );
00448     void deleteAll();
00449 
00450 
00451 
00452   //
00453   //  PROTECTED MEMBERS:
00454   //
00455 
00456 protected:
00457 
00458     Operator *argument1 ;       
00459     Operator *argument2 ;       
00462     Operator *dargument1;       
00464     Operator *dargument2;       
00468     double *  argument1_result;   
00470     double *  argument2_result;   
00474     double * dargument1_result;   
00477     double * dargument2_result;   
00481     int     bufferSize       ;    
00483     CurvatureType     curvature   ;
00484     MonotonicityType  monotonicity;
00485 };
00486 
00487 
00488 CLOSE_NAMESPACE_ACADO
00489 
00490 
00491 
00492 #endif


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