nonsmooth_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 
00034 #ifndef ACADO_TOOLKIT_NONSMOOTH_OPERATOR_HPP
00035 #define ACADO_TOOLKIT_NONSMOOTH_OPERATOR_HPP
00036 
00037 
00038 #include <acado/symbolic_operator/symbolic_operator_fwd.hpp>
00039 
00040 
00041 BEGIN_NAMESPACE_ACADO
00042 
00043 
00044 
00056 class NonsmoothOperator : public Operator{
00057 
00058 public:
00059 
00060 
00062     NonsmoothOperator();
00063 
00064     virtual ~NonsmoothOperator();
00065 
00066 
00069     virtual Operator& operator=( const double      & arg );
00070     virtual Operator& operator=( const DVector      & arg );
00071     virtual Operator& operator=( const DMatrix      & arg );
00072     virtual Operator& operator=( const Expression  & arg );
00073     virtual Operator& operator=( const Operator    & arg );
00074 
00075 
00076     Operator& operator+=( const double      & arg );
00077     Operator& operator+=( const DVector      & arg );
00078     Operator& operator+=( const DMatrix      & arg );
00079     Operator& operator+=( const Expression  & arg );
00080 
00081     Operator& operator-=( const double      & arg );
00082     Operator& operator-=( const DVector      & arg );
00083     Operator& operator-=( const DMatrix      & arg );
00084     Operator& operator-=( const Expression  & arg );
00085 
00086     Operator& operator*=( const double      & arg );
00087     Operator& operator*=( const DVector      & arg );
00088     Operator& operator*=( const DMatrix      & arg );
00089     Operator& operator*=( const Expression  & arg );
00090 
00091     Operator& operator/=( const double      & arg );
00092     Operator& operator/=( const Expression  & arg );
00093 
00094 
00095     Expression operator+( const double        & arg ) const;
00096     Expression operator+( const DVector        & arg ) const;
00097     Expression operator+( const DMatrix        & arg ) const;
00098     Expression operator+( const Operator& arg ) const;
00099     Expression operator+( const Expression    & arg ) const;
00100 
00101     Expression operator-( const double          & arg ) const;
00102     Expression operator-( const DVector          & arg ) const;
00103     Expression operator-( const DMatrix          & arg ) const;
00104     Expression operator-( const Operator  & arg ) const;
00105     Expression operator-( const Expression      & arg ) const;
00106 
00107     Expression operator-( ) const;
00108 
00109     Expression operator*( const double         & arg ) const;
00110     Expression operator*( const DVector         & arg ) const;
00111     Expression operator*( const DMatrix         & arg ) const;
00112     Expression operator*( const Operator & arg ) const;
00113     Expression operator*( const Expression     & arg ) const;
00114 
00115     Expression operator/( const double         & arg ) const;
00116     Expression operator/( const Operator & arg ) const;
00117     Expression operator/( const Expression     & arg ) const;
00118 
00119 
00120     ConstraintComponent operator<=( const double& ub ) const;
00121     ConstraintComponent operator>=( const double& lb ) const;
00122     ConstraintComponent operator==( const double&  b ) const;
00123 
00124     ConstraintComponent operator<=( const DVector& ub ) const;
00125     ConstraintComponent operator>=( const DVector& lb ) const;
00126     ConstraintComponent operator==( const DVector&  b ) const;
00127 
00128     ConstraintComponent operator<=( const VariablesGrid& ub ) const;
00129     ConstraintComponent operator>=( const VariablesGrid& lb ) const;
00130     ConstraintComponent operator==( const VariablesGrid&  b ) const;
00131 
00132 
00139     virtual returnValue evaluate( int     number    ,
00140                                   double *x         ,
00141                                   double *result      );
00142 
00143 
00145     virtual returnValue evaluate( EvaluationBase *x );
00146 
00147 
00153      virtual Operator* differentiate( int index      );
00154 
00155 
00156 
00162      virtual Operator* AD_forward( int                dim      , 
00163                                      VariableType      *varType  , 
00164                                      int               *component, 
00165                                      Operator       **seed     , 
00166                                      int                &nNewIS  , 
00167                                      TreeProjection ***newIS     );
00168 
00169 
00170 
00176     virtual returnValue AD_backward( int           dim      , 
00177                                      VariableType *varType  , 
00178                                      int          *component, 
00179                                      Operator     *seed     , 
00180                                      Operator    **df       , 
00181                                      int           &nNewIS  , 
00182                                      TreeProjection ***newIS   );
00183 
00184     
00185     
00191      virtual returnValue AD_symmetric( int            dim       , 
00192                                       VariableType  *varType   , 
00193                                       int           *component , 
00194                                       Operator      *l         , 
00195                                       Operator     **S         , 
00196                                       int            dimS      , 
00197                                       Operator     **dfS       , 
00198                                       Operator     **ldf       , 
00199                                       Operator     **H         , 
00200                                       int            &nNewLIS  , 
00201                                       TreeProjection ***newLIS , 
00202                                       int            &nNewSIS  , 
00203                                       TreeProjection ***newSIS , 
00204                                       int            &nNewHIS  , 
00205                                       TreeProjection ***newHIS    );
00206 
00207 
00208 
00213      virtual Operator* substitute( int   index            ,
00214                                      const Operator *sub  );
00215 
00216 
00217 
00224      virtual NeutralElement isOneOrZero() const;
00225 
00226 
00227 
00233      virtual BooleanType isDependingOn( VariableType var ) const;
00234 
00235 
00236 
00242      virtual BooleanType isDependingOn( int           dim      ,    
00243                                           VariableType *varType  ,    
00244                                           int          *component,    
00245                                           BooleanType   *implicit_dep  );
00246 
00247 
00248 
00249 
00257      virtual BooleanType isLinearIn( int           dim      ,    
00258                                        VariableType *varType  ,    
00259                                        int          *component,    
00260                                        BooleanType  *implicit_dep   );
00261 
00262 
00263 
00270      virtual BooleanType isPolynomialIn( int           dim      ,    
00271                                            VariableType *varType  ,    
00272                                            int          *component,    
00273                                            BooleanType  *implicit_dep   );
00274 
00275 
00276 
00283      virtual BooleanType isRationalIn( int           dim      ,    
00284                                          VariableType *varType  ,    
00285                                          int          *component,    
00286                                          BooleanType  *implicit_dep   );
00287 
00293      virtual BooleanType isSmooth( ) const;
00294 
00301      virtual MonotonicityType getMonotonicity( );
00302 
00303 
00304 
00312      virtual CurvatureType getCurvature( );
00313 
00314 
00315 
00321      virtual returnValue setMonotonicity( MonotonicityType monotonicity_ );
00322 
00323 
00324 
00325 
00331      virtual returnValue setCurvature( CurvatureType curvature_  );
00332 
00333 
00334 
00342      virtual returnValue AD_forward( int     number  ,
00343                                      double *x       ,
00345                                      double *seed    ,
00346                                      double *f       ,
00348                                      double *df        );
00350 
00351 
00352 
00359      virtual returnValue AD_forward( int     number  ,
00360                                      double *seed    ,
00361                                      double *df        );
00363 
00364 
00365 
00366     // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
00367     //                                   the point x and to compute f.
00368 
00374      virtual returnValue AD_backward( int    number ,
00376                                       double seed   ,
00377                                       double  *df   );
00379 
00380 
00381 
00389      virtual returnValue AD_forward2( int    number  ,
00391                                       double *seed1  ,
00392                                       double *seed2  ,
00394                                       double *df     ,
00396                                       double *ddf    );
00398 
00399 
00400 
00401     // IMPORTANT REMARK FOR AD_BACKWARD2: run AD_forward first to define
00402     //                                    the point x and to compute f and df.
00403 
00409      virtual returnValue AD_backward2( int    number ,
00411                                        double seed1  ,
00412                                        double seed2  ,
00413                                        double   *df  ,
00415                                        double  *ddf     );
00417 
00418 
00419 
00420 
00424      virtual std::ostream& print( std::ostream &stream ) const;
00425 
00429      virtual Operator* clone() const;
00430 
00431 
00437      virtual TreeProjection* cloneTreeProjection() const;
00438 
00439 
00440 
00445      virtual returnValue clearBuffer();
00446 
00447 
00448 
00453      virtual returnValue enumerateVariables( SymbolicIndexList *indexList );
00454 
00455 
00456 
00460      virtual OperatorName getName();
00461 
00462 
00465      //virtual int getVariableIndex( ) const;
00466 
00467 
00470      virtual int getGlobalIndex( ) const;
00471 
00472 
00476      virtual BooleanType isVariable( VariableType &varType,
00477                                      int &component          ) const;
00478 
00479 
00498      virtual returnValue loadIndices( SymbolicIndexList *indexList  );
00500 
00501 
00502 
00504      virtual double getValue() const;
00505 
00506 
00507 
00509      virtual Operator* passArgument() const;
00510 
00511 
00517     virtual BooleanType isSymbolic() const;
00518 
00519 
00520     int nCount;
00521 
00522 
00523 //
00524 //  PROTECTED FUNCTIONS:
00525 //
00526 
00527 protected:
00528 
00529 
00530 };
00531 
00532 
00533 CLOSE_NAMESPACE_ACADO
00534 
00535 
00536 
00537 #endif
00538 
00539 
00540 


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