powerint.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_POWERINT_HPP
36 #define ACADO_TOOLKIT_POWERINT_HPP
37 
38 
40 
41 
43 
44 
55 class Power_Int : public SmoothOperator{
56 
57 public:
58 
59 
61  Power_Int();
62 
64  Power_Int( Operator *_argument, int _exponent );
65 
67  Power_Int( const Power_Int &arg );
68 
70  ~Power_Int();
71 
73  Power_Int& operator=( const Power_Int &arg );
74 
75 
76 
83  virtual returnValue evaluate( int number ,
84  double *x ,
85  double *result );
86 
87 
89  virtual returnValue evaluate( EvaluationBase *x );
90 
91 
92 
98  virtual Operator* differentiate( int index );
99 
100 
101 
107  virtual Operator* AD_forward( int dim ,
108  VariableType *varType ,
109  int *component,
110  Operator **seed ,
111  int &nNewIS ,
112  TreeProjection ***newIS );
113 
114 
115 
121  virtual returnValue AD_backward( int dim ,
122  VariableType *varType ,
123  int *component,
124  Operator *seed ,
125  Operator **df ,
126  int &nNewIS ,
127  TreeProjection ***newIS );
128 
129 
130 
136  virtual returnValue AD_symmetric( int dim ,
137  VariableType *varType ,
138  int *component ,
139  Operator *l ,
140  Operator **S ,
141  int dimS ,
142  Operator **dfS ,
143  Operator **ldf ,
144  Operator **H ,
145  int &nNewLIS ,
146  TreeProjection ***newLIS ,
147  int &nNewSIS ,
148  TreeProjection ***newSIS ,
149  int &nNewHIS ,
150  TreeProjection ***newHIS );
151 
152 
157  virtual Operator* substitute( int index ,
158  const Operator *sub );
159 
160 
161 
168  virtual NeutralElement isOneOrZero() const;
169 
170 
171 
172 
178  virtual BooleanType isDependingOn( VariableType var ) const;
179 
185  virtual BooleanType isDependingOn( int dim ,
186  VariableType *varType ,
187  int *component,
188  BooleanType *implicit_dep );
189 
190 
191 
192 
200  virtual BooleanType isLinearIn( int dim ,
201  VariableType *varType ,
202  int *component,
203  BooleanType *implicit_dep );
204 
205 
206 
213  virtual BooleanType isPolynomialIn( int dim ,
214  VariableType *varType ,
215  int *component,
216  BooleanType *implicit_dep );
217 
218 
219 
226  virtual BooleanType isRationalIn( int dim ,
227  VariableType *varType ,
228  int *component,
229  BooleanType *implicit_dep );
230 
231 
239 
240 
241 
249  virtual CurvatureType getCurvature( );
250 
251 
252 
258  virtual returnValue setMonotonicity( MonotonicityType monotonicity_ );
259 
260 
261 
262 
268  virtual returnValue setCurvature( CurvatureType curvature_ );
269 
270 
277  virtual returnValue AD_forward( int number ,
278  double *seed ,
279  double *df );
281 
282 
283 
284 
292  virtual returnValue AD_forward( int number ,
293  double *x ,
295  double *seed ,
296  double *f ,
298  double *df );
300 
301 
302 
303  // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
304  // the point x and to compute f.
305 
311  virtual returnValue AD_backward( int number ,
313  double seed ,
314  double *df );
316 
317 
318 
326  virtual returnValue AD_forward2( int number ,
328  double *seed1 ,
329  double *seed2 ,
331  double *df ,
333  double *ddf );
335 
336 
337 
338  // IMPORTANT REMARK FOR AD_BACKWARD2: run AD_forward first to define
339  // the point x and to compute f and df.
340 
346  virtual returnValue AD_backward2( int number ,
348  double seed1 ,
349  double seed2 ,
350  double *df ,
352  double *ddf );
354 
358  virtual std::ostream& print( std::ostream &stream ) const;
359 
360 
364  virtual Operator* clone() const;
365 
366 
371  virtual returnValue clearBuffer();
372 
373 
374 
379  virtual returnValue enumerateVariables( SymbolicIndexList *indexList );
380 
381 
382 
383 
387  virtual OperatorName getName();
388 
389 
390  virtual returnValue initDerivative();
391 
392 
393 
397  virtual BooleanType isVariable( VariableType &varType,
398  int &component ) const;
399 
400 
401 
420  virtual returnValue loadIndices( SymbolicIndexList *indexList );
423 
424 
430  virtual BooleanType isSymbolic() const;
431 
432 
433 
437  virtual returnValue setVariableExportName( const VariableType &_type,
438  const std::vector< std::string >& _name
439  );
440 
441 
442 //
443 // PROTECTED FUNCTIONS:
444 //
445 
446 protected:
447 
448 
449 //
450 // PROTECTED MEMBERS:
451 //
452 
453 protected:
454 
461  int exponent ;
467  double * argument_result;
470  double * dargument_result;
474  int bufferSize ;
478 };
479 
480 
482 
483 
484 
485 #endif
OperatorName
Definition: acado_types.hpp:72
Operator * dargument
Definition: powerint.hpp:464
int exponent
Definition: powerint.hpp:461
virtual returnValue setMonotonicity(MonotonicityType monotonicity_)
Definition: powerint.cpp:435
TreeProjection * derivative
Definition: powerint.hpp:455
double * dargument_result
Definition: powerint.hpp:470
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
virtual returnValue evaluate(int number, double *x, double *result)
Definition: powerint.cpp:186
int bufferSize
Definition: powerint.hpp:474
Allows to pass back messages to the calling function.
virtual returnValue AD_forward2(int number, double *seed1, double *seed2, double *df, double *ddf)
Definition: powerint.cpp:485
virtual BooleanType isSymbolic() const
Definition: powerint.cpp:599
Operator * argument
Definition: powerint.hpp:458
TreeProjection * derivative2
Definition: powerint.hpp:456
virtual returnValue clearBuffer()
Definition: powerint.cpp:560
#define CLOSE_NAMESPACE_ACADO
Manages the indices of SymbolicVariables.
virtual BooleanType isDependingOn(VariableType var) const
Definition: powerint.cpp:320
VariableType
Definition: acado_types.hpp:95
virtual returnValue AD_backward2(int number, double seed1, double seed2, double *df, double *ddf)
Definition: powerint.cpp:503
virtual returnValue enumerateVariables(SymbolicIndexList *indexList)
Definition: powerint.cpp:572
virtual returnValue loadIndices(SymbolicIndexList *indexList)
Definition: powerint.cpp:593
virtual MonotonicityType getMonotonicity()
Definition: powerint.cpp:383
CurvatureType curvature
Definition: powerint.hpp:476
Power_Int & operator=(const Power_Int &arg)
Definition: powerint.cpp:141
virtual CurvatureType getCurvature()
Definition: powerint.cpp:408
Implements the scalar power operator with integer exponent within the symbolic operators family...
Definition: powerint.hpp:55
virtual OperatorName getName()
Definition: powerint.cpp:583
virtual Operator * AD_forward(int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)
Definition: powerint.cpp:222
virtual NeutralElement isOneOrZero() const
Definition: powerint.cpp:317
virtual BooleanType isVariable(VariableType &varType, int &component) const
Definition: powerint.cpp:588
virtual Operator * differentiate(int index)
Definition: powerint.cpp:208
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: powerint.cpp:259
NeutralElement
Definition: acado_types.hpp:64
virtual returnValue initDerivative()
Definition: powerint.cpp:283
Abstract base class for all scalar-valued symbolic operators.
MonotonicityType
virtual std::ostream & print(std::ostream &stream) const
Definition: powerint.cpp:520
Implements the tree-projection operator within the family of SymbolicOperators.
CurvatureType
virtual BooleanType isPolynomialIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Definition: powerint.cpp:356
#define BEGIN_NAMESPACE_ACADO
Abstract base class for templated evaluation of operators.
MonotonicityType monotonicity
Definition: powerint.hpp:477
virtual returnValue AD_backward(int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)
Definition: powerint.cpp:241
double * argument_result
Definition: powerint.hpp:467
virtual Operator * clone() const
Definition: powerint.cpp:554
virtual Operator * substitute(int index, const Operator *sub)
Definition: powerint.cpp:310
virtual returnValue setCurvature(CurvatureType curvature_)
Definition: powerint.cpp:442
virtual returnValue setVariableExportName(const VariableType &_type, const std::vector< std::string > &_name)
Definition: powerint.cpp:605
virtual BooleanType isLinearIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Definition: powerint.cpp:339
virtual BooleanType isRationalIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Definition: powerint.cpp:370


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