smooth_operator.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
27 
34 #ifndef ACADO_TOOLKIT_SMOOTH_OPERATOR_HPP
35 #define ACADO_TOOLKIT_SMOOTH_OPERATOR_HPP
36 
37 
39 
40 
42 
43 
44 
56 class SmoothOperator : public Operator{
57 
58 public:
59 
60 
63 
64  virtual ~SmoothOperator();
65 
66 
69  virtual Operator& operator=( const double & arg );
70  virtual Operator& operator=( const DVector & arg );
71  virtual Operator& operator=( const DMatrix & arg );
72  virtual Operator& operator=( const Expression & arg );
73  virtual Operator& operator=( const Operator & arg );
74 
75 
76  Operator& operator+=( const double & arg );
77  Operator& operator+=( const DVector & arg );
78  Operator& operator+=( const DMatrix & arg );
79  Operator& operator+=( const Expression & arg );
80 
81  Operator& operator-=( const double & arg );
82  Operator& operator-=( const DVector & arg );
83  Operator& operator-=( const DMatrix & arg );
84  Operator& operator-=( const Expression & arg );
85 
86  Operator& operator*=( const double & arg );
87  Operator& operator*=( const DVector & arg );
88  Operator& operator*=( const DMatrix & arg );
89  Operator& operator*=( const Expression & arg );
90 
91  Operator& operator/=( const double & arg );
92  Operator& operator/=( const Expression & arg );
93 
94 
95  Expression operator+( const double & arg ) const;
96  Expression operator+( const DVector & arg ) const;
97  Expression operator+( const DMatrix & arg ) const;
98  Expression operator+( const Operator& arg ) const;
99  Expression operator+( const Expression & arg ) const;
100 
101  Expression operator-( const double & arg ) const;
102  Expression operator-( const DVector & arg ) const;
103  Expression operator-( const DMatrix & arg ) const;
104  Expression operator-( const Operator & arg ) const;
105  Expression operator-( const Expression & arg ) const;
106 
107  Expression operator-( ) const;
108 
109  Expression operator*( const double & arg ) const;
110  Expression operator*( const DVector & arg ) const;
111  Expression operator*( const DMatrix & arg ) const;
112  Expression operator*( const Operator & arg ) const;
113  Expression operator*( const Expression & arg ) const;
114 
115  Expression operator/( const double & arg ) const;
116  Expression operator/( const Operator & arg ) const;
117  Expression operator/( const Expression & arg ) const;
118 
119 
120  ConstraintComponent operator<=( const double& ub ) const;
121  ConstraintComponent operator>=( const double& lb ) const;
122  ConstraintComponent operator==( const double& b ) const;
123 
124  ConstraintComponent operator<=( const DVector& ub ) const;
125  ConstraintComponent operator>=( const DVector& lb ) const;
126  ConstraintComponent operator==( const DVector& b ) const;
127 
128  ConstraintComponent operator<=( const VariablesGrid& ub ) const;
129  ConstraintComponent operator>=( const VariablesGrid& lb ) const;
130  ConstraintComponent operator==( const VariablesGrid& b ) const;
131 
132 
139  virtual returnValue evaluate( int number ,
140  double *x ,
141  double *result ) = 0;
142 
143 
145  virtual returnValue evaluate( EvaluationBase *x ) = 0;
146 
147 
153  virtual Operator* differentiate( int index ) = 0;
154 
155 
156 
162  virtual Operator* AD_forward( int dim ,
163  VariableType *varType ,
164  int *component,
165  Operator **seed ,
166  int &nNewIS ,
167  TreeProjection ***newIS ) = 0;
168 
169 
170 
176  virtual returnValue AD_backward( int dim ,
177  VariableType *varType ,
178  int *component,
179  Operator *seed ,
180  Operator **df ,
181  int &nNewIS ,
182  TreeProjection ***newIS ) = 0;
183 
184 
190  virtual returnValue AD_symmetric( int dim ,
191  VariableType *varType ,
192  int *component ,
193  Operator *l ,
194  Operator **S ,
195  int dimS ,
196  Operator **dfS ,
197  Operator **ldf ,
198  Operator **H ,
199  int &nNewLIS ,
200  TreeProjection ***newLIS ,
201  int &nNewSIS ,
202  TreeProjection ***newSIS ,
203  int &nNewHIS ,
204  TreeProjection ***newHIS ) = 0;
205 
206 
211  virtual Operator* substitute( int index ,
212  const Operator *sub ) = 0;
213 
214 
215 
222  virtual NeutralElement isOneOrZero() const = 0;
223 
224 
225 
231  virtual BooleanType isDependingOn( VariableType var ) const = 0;
232 
233 
234 
240  virtual BooleanType isDependingOn( int dim ,
241  VariableType *varType ,
242  int *component,
243  BooleanType *implicit_dep ) = 0;
244 
245 
246 
247 
255  virtual BooleanType isLinearIn( int dim ,
256  VariableType *varType ,
257  int *component,
258  BooleanType *implicit_dep ) = 0;
259 
260 
261 
268  virtual BooleanType isPolynomialIn( int dim ,
269  VariableType *varType ,
270  int *component,
271  BooleanType *implicit_dep ) = 0;
272 
273 
274 
281  virtual BooleanType isRationalIn( int dim ,
282  VariableType *varType ,
283  int *component,
284  BooleanType *implicit_dep ) = 0;
285 
291  virtual BooleanType isSmooth( ) const;
292 
293 
300  virtual MonotonicityType getMonotonicity( ) = 0;
301 
302 
303 
311  virtual CurvatureType getCurvature( ) = 0;
312 
313 
314 
320  virtual returnValue setMonotonicity( MonotonicityType monotonicity_ ) = 0;
321 
322 
323 
324 
330  virtual returnValue setCurvature( CurvatureType curvature_ ) = 0;
331 
332 
333 
341  virtual returnValue AD_forward( int number ,
342  double *x ,
344  double *seed ,
345  double *f ,
347  double *df ) = 0;
349 
350 
351 
358  virtual returnValue AD_forward( int number ,
359  double *seed ,
360  double *df ) = 0;
362 
363 
364 
365  // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
366  // the point x and to compute f.
367 
373  virtual returnValue AD_backward( int number ,
375  double seed ,
376  double *df ) = 0;
378 
379 
380 
388  virtual returnValue AD_forward2( int number ,
390  double *seed1 ,
391  double *seed2 ,
393  double *df ,
395  double *ddf ) = 0;
397 
398 
399 
400  // IMPORTANT REMARK FOR AD_BACKWARD2: run AD_forward first to define
401  // the point x and to compute f and df.
402 
408  virtual returnValue AD_backward2( int number ,
410  double seed1 ,
411  double seed2 ,
412  double *df ,
414  double *ddf ) = 0;
416 
420  virtual std::ostream& print( std::ostream &stream ) const = 0;
421 
425  virtual Operator* clone() const = 0;
426 
427 
433  virtual TreeProjection* cloneTreeProjection() const;
434 
435 
436 
441  virtual returnValue clearBuffer() = 0;
442 
443 
444 
449  virtual returnValue enumerateVariables( SymbolicIndexList *indexList ) = 0;
450 
451 
452 
456  virtual OperatorName getName() = 0;
457 
458 
461  //virtual int getVariableIndex( ) const;
462 
463 
466  virtual int getGlobalIndex( ) const;
467 
468 
472  virtual BooleanType isVariable( VariableType &varType,
473  int &component ) const = 0;
474 
475 
494  virtual returnValue loadIndices( SymbolicIndexList *indexList ) = 0;
496 
497 
498 
500  virtual double getValue() const;
501 
502 
503 
505  virtual Operator* passArgument() const;
506 
507 
513  virtual BooleanType isSymbolic() const = 0;
514 
515 
516  int nCount;
517 
518 //
519 // PROTECTED FUNCTIONS:
520 //
521 
522 protected:
523 
524 
525 };
526 
527 
529 
530 
531 
532 #endif
533 
534 
535 
OperatorName
Definition: acado_types.hpp:72
virtual BooleanType isVariable(VariableType &varType, int &component) const =0
virtual std::ostream & print(std::ostream &stream) const =0
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
virtual int getGlobalIndex() const
Expression operator-() const
Operator & operator-=(const double &arg)
virtual returnValue enumerateVariables(SymbolicIndexList *indexList)=0
virtual Operator * substitute(int index, const Operator *sub)=0
virtual OperatorName getName()=0
virtual returnValue loadIndices(SymbolicIndexList *indexList)=0
virtual BooleanType isRationalIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)=0
virtual returnValue AD_forward2(int number, double *seed1, double *seed2, double *df, double *ddf)=0
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
virtual BooleanType isDependingOn(VariableType var) const =0
virtual returnValue evaluate(int number, double *x, double *result)=0
#define CLOSE_NAMESPACE_ACADO
Manages the indices of SymbolicVariables.
Data class for symbolically formulating constraints within optimal control problems.
VariableType
Definition: acado_types.hpp:95
ConstraintComponent operator<=(const double &ub) const
virtual CurvatureType getCurvature()=0
virtual returnValue setMonotonicity(MonotonicityType monotonicity_)=0
ConstraintComponent operator>=(const double &lb) const
Base class for all variables within the symbolic expressions family.
Definition: expression.hpp:56
virtual Operator * differentiate(int index)=0
virtual returnValue clearBuffer()=0
Expression operator*(const double &arg) const
virtual Operator * clone() const =0
virtual returnValue AD_symmetric(int dim, VariableType *varType, int *component, Operator *l, Operator **S, int dimS, Operator **dfS, Operator **ldf, Operator **H, int &nNewLIS, TreeProjection ***newLIS, int &nNewSIS, TreeProjection ***newSIS, int &nNewHIS, TreeProjection ***newHIS)=0
Operator & operator/=(const double &arg)
virtual NeutralElement isOneOrZero() const =0
Expression operator/(const double &arg) const
virtual Operator * AD_forward(int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)=0
virtual returnValue AD_backward2(int number, double seed1, double seed2, double *df, double *ddf)=0
Expression operator+(const double &arg) const
ConstraintComponent operator==(const double &b) const
virtual BooleanType isSymbolic() const =0
NeutralElement
Definition: acado_types.hpp:64
Abstract base class for all scalar-valued symbolic operators.
MonotonicityType
Operator & operator*=(const double &arg)
virtual Operator * passArgument() const
Implements the tree-projection operator within the family of SymbolicOperators.
virtual TreeProjection * cloneTreeProjection() const
virtual MonotonicityType getMonotonicity()=0
CurvatureType
#define BEGIN_NAMESPACE_ACADO
virtual double getValue() const
Abstract base class for templated evaluation of operators.
Operator & operator+=(const double &arg)
virtual BooleanType isPolynomialIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)=0
virtual returnValue setCurvature(CurvatureType curvature_)=0
virtual Operator & operator=(const double &arg)
virtual returnValue AD_backward(int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)=0
virtual BooleanType isSmooth() const
virtual BooleanType isLinearIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)=0
virtual ~SmoothOperator()


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:06