c_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_C_OPERATOR_HPP
36 #define ACADO_TOOLKIT_C_OPERATOR_HPP
37 
38 
41 
42 
43 
45 
46 
58 class COperator : public SmoothOperator{
59 
60 public:
61 
63  COperator();
64 
66  COperator( const CFunction &fcn, const Expression &arg, int component_ );
67 
69  COperator( const COperator &arg );
70 
72  ~COperator();
73 
75  COperator& operator=( const COperator &arg );
76 
78  int increaseID();
79 
80 
81 
88  virtual returnValue evaluate( int number ,
89  double *x ,
90  double *result );
91 
92 
94  virtual returnValue evaluate( EvaluationBase *x );
95 
96 
97 
103  virtual Operator* differentiate( int index );
104 
105 
106 
112  virtual Operator* AD_forward( int dim ,
113  VariableType *varType ,
114  int *component,
115  Operator **seed ,
116  int &nNewIS ,
117  TreeProjection ***newIS );
118 
119 
120 
126  virtual returnValue AD_backward( int dim ,
127  VariableType *varType ,
128  int *component,
129  Operator *seed ,
130  Operator **df ,
131  int &nNewIS ,
132  TreeProjection ***newIS );
133 
134 
140  virtual returnValue AD_symmetric( int dim ,
141  VariableType *varType ,
142  int *component ,
143  Operator *l ,
144  Operator **S ,
145  int dimS ,
146  Operator **dfS ,
147  Operator **ldf ,
148  Operator **H ,
149  int &nNewLIS ,
150  TreeProjection ***newLIS ,
151  int &nNewSIS ,
152  TreeProjection ***newSIS ,
153  int &nNewHIS ,
154  TreeProjection ***newHIS );
155 
156 
157 
162  virtual Operator* substitute( int index ,
163  const Operator *sub );
164 
165 
166 
173  virtual NeutralElement isOneOrZero() const;
174 
175 
176 
182  virtual BooleanType isDependingOn( VariableType var ) const;
183 
184 
185 
191  virtual BooleanType isDependingOn( int dim ,
192  VariableType *varType ,
193  int *component,
194  BooleanType *implicit_dep );
195 
196 
197 
198 
206  virtual BooleanType isLinearIn( int dim ,
207  VariableType *varType ,
208  int *component,
209  BooleanType *implicit_dep );
210 
211 
212 
219  virtual BooleanType isPolynomialIn( int dim ,
220  VariableType *varType ,
221  int *component,
222  BooleanType *implicit_dep );
223 
224 
225 
232  virtual BooleanType isRationalIn( int dim ,
233  VariableType *varType ,
234  int *component,
235  BooleanType *implicit_dep );
236 
237 
238 
239 
247 
248 
249 
257  virtual CurvatureType getCurvature( );
258 
259 
260 
266  virtual returnValue setMonotonicity( MonotonicityType monotonicity_ );
267 
268 
269 
270 
276  virtual returnValue setCurvature( CurvatureType curvature_ );
277 
278 
279 
286  virtual returnValue AD_forward( int number ,
287  double *seed ,
288  double *df );
290 
291 
292 
293 
301  virtual returnValue AD_forward( int number ,
302  double *x ,
304  double *seed ,
305  double *f ,
307  double *df );
309 
310 
316  virtual returnValue AD_backward( int number ,
318  double seed ,
319  double *df );
321 
322 
323 
331  virtual returnValue AD_forward2( int number ,
333  double *seed1 ,
334  double *seed2 ,
336  double *df ,
338  double *ddf );
340 
341 
342 
343  // IMPORTANT REMARK FOR AD_BACKWARD2: run AD_forward first to define
344  // the point x and to compute f and df.
345 
351  virtual returnValue AD_backward2( int number ,
353  double seed1 ,
354  double seed2 ,
355  double *df ,
357  double *ddf );
359 
360 
361 
365  virtual std::ostream& print( std::ostream& stream ) const;
366 
367 
368 
372  virtual Operator* clone() const;
373 
374 
375 
380  virtual returnValue clearBuffer();
381 
382 
383 
388  virtual returnValue enumerateVariables( SymbolicIndexList *indexList );
389 
390 
391 
395  virtual OperatorName getName();
396 
397 
401  virtual BooleanType isVariable( VariableType &varType,
402  int &component ) const;
403 
404 
423  virtual returnValue loadIndices( SymbolicIndexList *indexList );
426 
427 
433  virtual BooleanType isSymbolic() const;
434 
435 
436 //
437 // PROTECTED FUNCTIONS:
438 //
439 
440 protected:
441 
444  void copy( const COperator &arg );
445 
446 
449  void deleteAll();
450 
451 
452 
453 //
454 // PROTECTED MEMBERS:
455 //
456 
457 protected:
458 
462  double **result;
463  double **d_result;
465  double **cresult;
466  double **d_cresult;
468  int component;
473  int *idx;
475  static int counter;
476 };
477 
478 
480 
481 
482 
483 #endif
484 
virtual returnValue evaluate(int number, double *x, double *result)
Definition: c_operator.cpp:191
OperatorName
Definition: acado_types.hpp:72
virtual BooleanType isSymbolic() const
Definition: c_operator.cpp:573
virtual BooleanType isVariable(VariableType &varType, int &component) const
Definition: c_operator.cpp:553
int globalTypeID
Definition: c_operator.hpp:474
virtual std::ostream & print(std::ostream &stream) const
Definition: c_operator.cpp:504
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
virtual returnValue AD_backward(int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)
Definition: c_operator.cpp:260
double ** cresult
Definition: c_operator.hpp:465
double ** d_result
Definition: c_operator.hpp:463
Allows to pass back messages to the calling function.
virtual returnValue enumerateVariables(SymbolicIndexList *indexList)
Definition: c_operator.cpp:530
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
virtual returnValue clearBuffer()
Definition: c_operator.cpp:517
virtual MonotonicityType getMonotonicity()
Definition: c_operator.cpp:360
#define CLOSE_NAMESPACE_ACADO
Manages the indices of SymbolicVariables.
VariableType
Definition: acado_types.hpp:95
Expression argument
Definition: c_operator.hpp:460
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)
Definition: c_operator.cpp:273
Base class for all variables within the symbolic expressions family.
Definition: expression.hpp:56
virtual BooleanType isDependingOn(VariableType var) const
Definition: c_operator.cpp:308
virtual Operator * clone() const
Definition: c_operator.cpp:511
CFunction cFunction
Definition: c_operator.hpp:459
uint bufferSize
Definition: c_operator.hpp:469
void deleteAll()
Definition: c_operator.cpp:167
virtual Operator * substitute(int index, const Operator *sub)
Definition: c_operator.cpp:294
double ** result
Definition: c_operator.hpp:462
virtual OperatorName getName()
Definition: c_operator.cpp:547
The class COperator is an auxiliary class to use C-Functions within a function evaluation tree...
Definition: c_operator.hpp:58
NeutralElement
Definition: acado_types.hpp:64
Abstract base class for all scalar-valued symbolic operators.
MonotonicityType
virtual CurvatureType getCurvature()
Definition: c_operator.cpp:366
virtual Operator * differentiate(int index)
Definition: c_operator.cpp:238
Implements the tree-projection operator within the family of SymbolicOperators.
void copy(const COperator &arg)
Definition: c_operator.cpp:119
static int counter
Definition: c_operator.hpp:475
(no description yet)
Definition: c_function.hpp:54
int increaseID()
Definition: c_operator.cpp:116
CurvatureType
#define BEGIN_NAMESPACE_ACADO
COperator & operator=(const COperator &arg)
Definition: c_operator.cpp:105
Abstract base class for templated evaluation of operators.
virtual returnValue AD_forward2(int number, double *seed1, double *seed2, double *df, double *ddf)
Definition: c_operator.cpp:456
virtual returnValue loadIndices(SymbolicIndexList *indexList)
Definition: c_operator.cpp:559
virtual BooleanType isLinearIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Definition: c_operator.cpp:333
virtual Operator * AD_forward(int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)
Definition: c_operator.cpp:247
virtual BooleanType isPolynomialIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Definition: c_operator.cpp:342
double ** d_cresult
Definition: c_operator.hpp:466
virtual BooleanType isRationalIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Definition: c_operator.cpp:351
virtual returnValue AD_backward2(int number, double seed1, double seed2, double *df, double *ddf)
Definition: c_operator.cpp:497
virtual NeutralElement isOneOrZero() const
Definition: c_operator.cpp:301
BooleanType first
Definition: c_operator.hpp:471
virtual returnValue setMonotonicity(MonotonicityType monotonicity_)
Definition: c_operator.cpp:372
virtual returnValue setCurvature(CurvatureType curvature_)
Definition: c_operator.cpp:378


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