projection.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_PROJECTION_HPP
00036 #define ACADO_TOOLKIT_PROJECTION_HPP
00037 
00038 
00039 #include <acado/symbolic_operator/symbolic_operator_fwd.hpp>
00040 
00041 
00042 BEGIN_NAMESPACE_ACADO
00043 
00044 
00055 class Projection : public SmoothOperator{
00056 
00057 
00058 friend class FunctionEvaluationTree;
00059 
00060 
00061 public:
00062 
00063 
00065     Projection();
00066 
00068     Projection( const std::string& name_ );
00069 
00071     Projection( VariableType variableType_, int vIndex_, const std::string& name_ );
00072 
00073 
00075     Projection( const Projection& arg );
00076 
00077 
00079     virtual ~Projection();
00080 
00081 
00082 
00089     virtual returnValue evaluate( int     number    ,
00090                                   double *x         ,
00091                                   double *result      );
00092 
00093 
00095         virtual returnValue evaluate( EvaluationBase *x );
00096         
00097         
00103      virtual Operator* differentiate( int index   );
00104 
00105 
00106 
00112      virtual Operator* AD_forward( int                dim      , 
00113                                      VariableType      *varType  , 
00114                                      int               *component, 
00115                                      Operator       **seed     , 
00116                                      int                &nNewIS  , 
00117                                      TreeProjection ***newIS     );
00118 
00119 
00120 
00126     virtual returnValue AD_backward( int           dim      , 
00127                                      VariableType *varType  , 
00128                                      int          *component, 
00129                                      Operator     *seed     , 
00130                                      Operator    **df       , 
00131                                      int           &nNewIS  , 
00132                                      TreeProjection ***newIS   );
00133 
00134     
00135     
00141      virtual returnValue AD_symmetric( int            dim       , 
00142                                       VariableType  *varType   , 
00143                                       int           *component , 
00144                                       Operator      *l         , 
00145                                       Operator     **S         , 
00146                                       int            dimS      , 
00147                                       Operator     **dfS       , 
00148                                       Operator     **ldf       , 
00149                                       Operator     **H         , 
00150                                       int            &nNewLIS  , 
00151                                       TreeProjection ***newLIS , 
00152                                       int            &nNewSIS  , 
00153                                       TreeProjection ***newSIS , 
00154                                       int            &nNewHIS  , 
00155                                       TreeProjection ***newHIS    );
00156 
00157 
00158 
00163      virtual Operator* substitute( int   index           ,
00164                                      const Operator *sub );
00165 
00166 
00167 
00174      virtual NeutralElement isOneOrZero() const;
00175 
00176 
00177 
00183      virtual BooleanType isDependingOn( VariableType var ) const;
00184 
00185 
00186 
00192      virtual BooleanType isDependingOn( int           dim      ,    
00193                                           VariableType *varType  ,    
00194                                           int          *component,    
00195                                           BooleanType   *implicit_dep  );
00196 
00197 
00198 
00199 
00207      virtual BooleanType isLinearIn( int           dim      ,    
00208                                        VariableType *varType  ,    
00209                                        int          *component,    
00210                                        BooleanType  *implicit_dep   );
00211 
00212 
00213 
00220      virtual BooleanType isPolynomialIn( int           dim      ,    
00221                                            VariableType *varType  ,    
00222                                            int          *component,    
00223                                            BooleanType  *implicit_dep   );
00224 
00225 
00226 
00233      virtual BooleanType isRationalIn( int           dim      ,    
00234                                          VariableType *varType  ,    
00235                                          int          *component,    
00236                                          BooleanType  *implicit_dep   );
00237 
00238 
00239 
00246      virtual MonotonicityType getMonotonicity( );
00247 
00248 
00249 
00257      virtual CurvatureType getCurvature( );
00258 
00259 
00260 
00266      virtual returnValue setMonotonicity( MonotonicityType monotonicity_ );
00267 
00268 
00269 
00270 
00276      virtual returnValue setCurvature( CurvatureType curvature_  );
00277 
00278 
00279 
00286      virtual returnValue AD_forward( int     number  ,
00287                                      double *seed    ,
00288                                      double *df        );
00290 
00291 
00292 
00300      virtual returnValue AD_forward( int     number  ,
00301                                      double *x       ,
00303                                      double *seed    ,
00304                                      double *f       ,
00306                                      double *df        );
00308 
00309 
00310     // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
00311     //                                   the point x and to compute f.
00312 
00318      virtual returnValue AD_backward( int    number ,
00320                                       double seed   ,
00321                                       double  *df   );
00323 
00324 
00325 
00333      virtual returnValue AD_forward2( int    number  ,
00335                                       double *seed1  ,
00336                                       double *seed2  ,
00338                                       double *df     ,
00340                                       double *ddf    );
00342 
00343 
00344 
00345     // IMPORTANT REMARK FOR AD_BACKWARD2: run AD_forward first to define
00346     //                                    the point x and to compute f and df.
00347 
00353      virtual returnValue AD_backward2( int    number ,
00355                                        double seed1  ,
00356                                        double seed2  ,
00357                                        double   *df  ,
00359                                        double  *ddf     );
00361 
00362 
00363 
00367      virtual std::ostream& print( std::ostream &stream ) const;
00368 
00369 
00370 
00374      virtual Operator* clone() const;
00375 
00376 
00381      virtual returnValue clearBuffer();
00382 
00383 
00384 
00389      virtual returnValue enumerateVariables( SymbolicIndexList *indexList );
00390 
00391 
00395      virtual OperatorName getName();
00396 
00397 
00401      virtual double getScale() const;
00402 
00403 
00407      virtual returnValue setScale( const double &scale_ );
00408 
00409 
00413      virtual BooleanType isVariable( VariableType &varType,
00414                                      int &component          ) const;
00415 
00416 
00417 
00420      virtual int getVariableIndex( ) const;
00421 
00422 
00427      virtual int getGlobalIndex() const;
00428 
00429 
00432      VariableType getType( ) const;
00433 
00434 
00453      virtual returnValue loadIndices( SymbolicIndexList *indexList );
00456 
00457 
00463     virtual BooleanType isSymbolic() const;
00464 
00465 
00469     virtual returnValue setVariableExportName(  const VariableType &_type,
00470                                                                                         const std::vector< std::string >& _name
00471                                                                                         );
00472 
00473 
00474     virtual BooleanType isTrivial() const;
00475 
00476 //
00477 //  PROTECTED FUNCTIONS:
00478 //
00479 
00480 protected:
00481 
00482 
00488      virtual Operator* ADforwardProtected( int                dim      , 
00489                                              VariableType      *varType  , 
00490                                              int               *component, 
00491                                              Operator       **seed     , 
00492                                              int                &nNewIS  , 
00493                                              TreeProjection ***newIS     );
00494 
00495 
00496 
00502      virtual returnValue ADbackwardProtected( int            dim      , 
00503                                               VariableType  *varType  , 
00504                                               int           *component, 
00505                                               Operator      *seed     , 
00506                                               Operator     **df       , 
00507                                               int            &nNewIS  , 
00508                                               TreeProjection ***newIS     );
00509 
00510      
00516      virtual returnValue ADsymmetricProtected( int            dim       , 
00517                                                VariableType  *varType   , 
00518                                                int           *component , 
00519                                                Operator      *l         , 
00520                                                Operator     **S         , 
00521                                                int            dimS      , 
00522                                                Operator     **dfS       , 
00523                                                Operator     **ldf       , 
00524                                                Operator     **H         , 
00525                                                int            &nNewLIS  , 
00526                                                TreeProjection ***newLIS , 
00527                                                int            &nNewSIS  , 
00528                                                TreeProjection ***newSIS , 
00529                                                int            &nNewHIS  , 
00530                                                TreeProjection ***newHIS    );
00531 
00532 
00533 
00534 //  PROTECTED MEMBER FUNCTIONS:
00535 // ---------------------------------------------
00536 
00538     virtual void copy( const Projection &arg );
00539 
00540 
00541 //
00542 //  PROTECTED MEMBERS:
00543 //
00544 
00545 protected:
00546 
00547     VariableType      variableType ;
00548     int               variableIndex;
00549     int               vIndex       ;
00550     double            scale        ;
00551     std::string       name         ;
00552 
00553     OperatorName      operatorName ;
00554 
00555     CurvatureType     curvature    ;
00556     MonotonicityType  monotonicity ;
00557 };
00558 
00559 
00560 CLOSE_NAMESPACE_ACADO
00561 
00562 
00563 
00564 #endif


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