unary_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 
35 #ifndef ACADO_TOOLKIT_UNARY_OPERATOR_HPP
36 #define ACADO_TOOLKIT_UNARY_OPERATOR_HPP
37 
38 
40 
41 
43 
44 
57 
58 public:
59 
61  UnaryOperator();
62 
64  UnaryOperator( Operator *_argument );
65 
67  UnaryOperator( const UnaryOperator &arg );
68 
70  virtual ~UnaryOperator();
71 
73  UnaryOperator& operator=( const UnaryOperator &arg );
74 
75 
82  virtual returnValue evaluate( int number ,
83  double *x ,
84  double *result );
85 
86 
88  virtual returnValue evaluate( EvaluationBase *x ) = 0;
89 
90 
96  Operator* differentiate( int index );
97 
98 
104  virtual Operator* AD_forward( int dim ,
105  VariableType *varType ,
106  int *component,
107  Operator **seed ,
108  int &nNewIS ,
109  TreeProjection ***newIS );
110 
111 
117  virtual returnValue AD_backward( int dim ,
118  VariableType *varType ,
119  int *component,
120  Operator *seed ,
121  Operator **df ,
122  int &nNewIS ,
123  TreeProjection ***newIS );
124 
125 
126 
132  virtual returnValue AD_symmetric( int dim ,
133  VariableType *varType ,
134  int *component ,
135  Operator *l ,
136  Operator **S ,
137  int dimS ,
138  Operator **dfS ,
139  Operator **ldf ,
140  Operator **H ,
141  int &nNewLIS ,
142  TreeProjection ***newLIS ,
143  int &nNewSIS ,
144  TreeProjection ***newSIS ,
145  int &nNewHIS ,
146  TreeProjection ***newHIS );
147 
148 
153  virtual Operator* substitute( int index ,
154  const Operator *sub ) = 0;
155 
156 
157 
164  virtual NeutralElement isOneOrZero() const;
165 
166 
167 
173  virtual BooleanType isDependingOn( VariableType var ) const;
174 
175 
181  virtual BooleanType isDependingOn( int dim ,
182  VariableType *varType ,
183  int *component,
184  BooleanType *implicit_dep );
185 
186 
194  virtual BooleanType isLinearIn( int dim ,
195  VariableType *varType ,
196  int *component,
197  BooleanType *implicit_dep );
198 
199 
205  virtual BooleanType isPolynomialIn( int dim ,
206  VariableType *varType ,
207  int *component,
208  BooleanType *implicit_dep );
209 
210 
216  virtual BooleanType isRationalIn( int dim ,
217  VariableType *varType ,
218  int *component,
219  BooleanType *implicit_dep );
220 
221 
228 
229 
236  virtual CurvatureType getCurvature( );
237 
238 
244  virtual returnValue setMonotonicity( MonotonicityType monotonicity_ );
245 
246 
252  virtual returnValue setCurvature( CurvatureType curvature_ );
253 
254 
261  virtual returnValue AD_forward( int number ,
262  double *seed ,
263  double *df );
264 
265 
273  virtual returnValue AD_forward( int number ,
274  double *x ,
275  double *seed ,
276  double *f ,
277  double *df );
278 
279 
285  virtual returnValue AD_backward( int number ,
286  double seed ,
287  double *df );
288 
289 
297  virtual returnValue AD_forward2( int number ,
298  double *seed1 ,
299  double *seed2 ,
300  double *df ,
301  double *ddf );
302 
303 
309  virtual returnValue AD_backward2( int number ,
310  double seed1 ,
311  double seed2 ,
312  double *df ,
313  double *ddf );
314 
315 
316 
320  virtual std::ostream& print( std::ostream &stream ) const;
321 
322 
326  virtual Operator* clone() const = 0;
327 
328 
333  virtual returnValue clearBuffer();
334 
335 
336 
341  virtual returnValue enumerateVariables( SymbolicIndexList *indexList );
342 
343 
344 
348  virtual OperatorName getName();
349 
350 
354  virtual BooleanType isVariable( VariableType &varType,
355  int &component ) const;
356 
357 
376  virtual returnValue loadIndices( SymbolicIndexList *indexList );
377 
378 
384  virtual BooleanType isSymbolic() const;
385 
386 
387 //
388 // PROTECTED FUNCTIONS:
389 //
390 
391 protected:
392 
393 
399  Operator* ADforwardProtected( int dim ,
400  VariableType *varType ,
401  int *component,
402  Operator **seed ,
403  int &nNewIS ,
404  TreeProjection ***newIS );
405 
406 
407 
413  returnValue ADbackwardProtected( int dim ,
414  VariableType *varType ,
415  int *component,
416  Operator *seed ,
417  Operator **df ,
418  int &nNewIS ,
419  TreeProjection ***newIS );
420 
421 
428  VariableType *varType ,
429  int *component ,
430  Operator *l ,
431  Operator **S ,
432  int dimS ,
433  Operator **dfS ,
434  Operator **ldf ,
435  Operator **H ,
436  int &nNewLIS ,
437  TreeProjection ***newLIS ,
438  int &nNewSIS ,
439  TreeProjection ***newSIS ,
440  int &nNewHIS ,
441  TreeProjection ***newHIS );
442 
443 
444 
448  virtual returnValue setVariableExportName( const VariableType &_type,
449  const std::vector< std::string >& _name
450  );
451 
452 
453  // PROTECTED MEMBERS:
454  // -------------------------
455  protected:
456 
462  double *argument_result ;
464  int bufferSize ;
469  std::string cName ;
470 
471  double (*fcn)(double);
472  double (*dfcn)(double);
473  double (*ddfcn)(double);
474 };
475 
476 
478 
479 
480 
481 #endif
OperatorName
Definition: acado_types.hpp:72
Operator * derivative2
Operator * differentiate(int index)
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
Operator * dargument
virtual BooleanType isPolynomialIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
double(* ddfcn)(double)
Operator * derivative
Abstract base class for all scalar-valued unary operators within the symbolic operators family...
Allows to pass back messages to the calling function.
virtual BooleanType isVariable(VariableType &varType, int &component) const
virtual BooleanType isSymbolic() const
virtual OperatorName getName()
#define CLOSE_NAMESPACE_ACADO
Operator * argument
virtual returnValue AD_backward(int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)
Manages the indices of SymbolicVariables.
virtual NeutralElement isOneOrZero() const
virtual BooleanType isRationalIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
virtual Operator * substitute(int index, const Operator *sub)=0
VariableType
Definition: acado_types.hpp:95
double(* dfcn)(double)
UnaryOperator & operator=(const UnaryOperator &arg)
virtual returnValue loadIndices(SymbolicIndexList *indexList)
virtual returnValue AD_backward2(int number, double seed1, double seed2, double *df, double *ddf)
MonotonicityType monotonicity
virtual returnValue clearBuffer()
virtual BooleanType isLinearIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
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)
virtual returnValue setVariableExportName(const VariableType &_type, const std::vector< std::string > &_name)
returnValue ADsymmetricProtected(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)
virtual std::ostream & print(std::ostream &stream) const
CurvatureType curvature
virtual MonotonicityType getMonotonicity()
virtual returnValue setCurvature(CurvatureType curvature_)
virtual returnValue evaluate(int number, double *x, double *result)
NeutralElement
Definition: acado_types.hpp:64
std::string cName
double * argument_result
Abstract base class for all scalar-valued symbolic operators.
MonotonicityType
OperatorName operatorName
Implements the tree-projection operator within the family of SymbolicOperators.
CurvatureType
double * dargument_result
#define BEGIN_NAMESPACE_ACADO
Operator * ADforwardProtected(int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)
returnValue ADbackwardProtected(int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)
Abstract base class for templated evaluation of operators.
virtual returnValue setMonotonicity(MonotonicityType monotonicity_)
virtual returnValue enumerateVariables(SymbolicIndexList *indexList)
virtual returnValue AD_forward2(int number, double *seed1, double *seed2, double *df, double *ddf)
double(* fcn)(double)
virtual CurvatureType getCurvature()
virtual Operator * AD_forward(int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)
virtual ~UnaryOperator()
virtual BooleanType isDependingOn(VariableType var) const


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