binary_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_BINARY_OPERATOR_HPP
36 #define ACADO_TOOLKIT_BINARY_OPERATOR_HPP
37 
38 
40 
41 
43 
44 
57 
58 public:
59 
60  friend class Power_Int;
63 
65  BinaryOperator( Operator *_argument1, Operator *_argument2 );
66 
68  BinaryOperator( const BinaryOperator &arg );
69 
71  virtual ~BinaryOperator();
72 
75 
76 
83  virtual returnValue evaluate( int number ,
84  double *x ,
85  double *result ) = 0;
86 
87 
89  virtual returnValue evaluate( EvaluationBase *x ) = 0;
90 
91 
97  virtual Operator* differentiate( int index ) = 0;
98 
99 
100 
106  virtual Operator* AD_forward( int dim ,
107  VariableType *varType ,
108  int *component,
109  Operator **seed ,
110  int &nNewIS ,
111  TreeProjection ***newIS ) = 0;
112 
113 
114 
120  virtual returnValue AD_backward( int dim ,
121  VariableType *varType ,
122  int *component,
123  Operator *seed ,
124  Operator **df ,
125  int &nNewIS ,
126  TreeProjection ***newIS ) = 0;
127 
128 
129 
135  virtual returnValue AD_symmetric( int dim ,
136  VariableType *varType ,
137  int *component ,
138  Operator *l ,
139  Operator **S ,
140  int dimS ,
141  Operator **dfS ,
142  Operator **ldf ,
143  Operator **H ,
144  int &nNewLIS ,
145  TreeProjection ***newLIS ,
146  int &nNewSIS ,
147  TreeProjection ***newSIS ,
148  int &nNewHIS ,
149  TreeProjection ***newHIS ) = 0;
150 
151 
156  virtual Operator* substitute( int index ,
157  const Operator *sub ) = 0;
158 
159 
160 
167  virtual NeutralElement isOneOrZero() const;
168 
169 
170 
176  virtual BooleanType isDependingOn( VariableType var ) const;
177 
178 
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 ) = 0;
204 
205 
206 
213  virtual BooleanType isPolynomialIn( int dim ,
214  VariableType *varType ,
215  int *component,
216  BooleanType *implicit_dep ) = 0;
217 
218 
219 
226  virtual BooleanType isRationalIn( int dim ,
227  VariableType *varType ,
228  int *component,
229  BooleanType *implicit_dep ) = 0;
230 
231 
238  virtual MonotonicityType getMonotonicity( ) = 0;
239 
240 
241 
249  virtual CurvatureType getCurvature( ) = 0;
250 
251 
252 
258  virtual returnValue setMonotonicity( MonotonicityType monotonicity_ );
259 
260 
261 
262 
268  virtual returnValue setCurvature( CurvatureType curvature_ );
269 
270 
271 
279  virtual returnValue AD_forward( int number ,
280  double *x ,
282  double *seed ,
283  double *f ,
285  double *df ) = 0;
287 
288 
289 
296  virtual returnValue AD_forward( int number ,
297  double *seed ,
298  double *df ) = 0;
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 ) = 0;
316 
317 
318 
326  virtual returnValue AD_forward2( int number ,
328  double *seed1 ,
329  double *seed2 ,
331  double *df ,
333  double *ddf ) = 0;
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 ) = 0;
354 
355 
359  virtual Operator* clone() const = 0;
360 
361 
366  virtual returnValue clearBuffer();
367 
368 
369 
373  virtual std::ostream& print( std::ostream &stream ) const = 0;
374 
375 
376 
381  virtual returnValue enumerateVariables( SymbolicIndexList *indexList );
382 
383 
384 
388  virtual OperatorName getName() = 0;
389 
390 
394  virtual BooleanType isVariable( VariableType &varType,
395  int &component ) const;
396 
397 
416  virtual returnValue loadIndices( SymbolicIndexList *indexList );
418 
419 
420 
426  virtual BooleanType isSymbolic() const;
427 
428 
429 
433  virtual returnValue setVariableExportName( const VariableType &_type,
434  const std::vector< std::string >& _name
435  );
436 
437  virtual returnValue initDerivative();
438 
439 //
440 // PROTECTED FUNCTIONS:
441 //
442 
443 protected:
444 
445 
446 
447  void copy( const BinaryOperator &arg );
448  void deleteAll();
449 
450 
451 
452  //
453  // PROTECTED MEMBERS:
454  //
455 
456 protected:
457 
468  double * argument1_result;
470  double * argument2_result;
474  double * dargument1_result;
477  double * dargument2_result;
481  int bufferSize ;
485 };
486 
487 
489 
490 
491 
492 #endif
OperatorName
Definition: acado_types.hpp:72
virtual returnValue AD_forward2(int number, double *seed1, double *seed2, double *df, double *ddf)=0
Operator * dargument1
virtual NeutralElement isOneOrZero() const
virtual MonotonicityType getMonotonicity()=0
virtual Operator * AD_forward(int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)=0
Operator * dargument2
virtual returnValue setVariableExportName(const VariableType &_type, const std::vector< std::string > &_name)
Abstract base class for all scalar-valued binary operators within the symbolic operators family...
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
CurvatureType curvature
double * argument1_result
virtual BooleanType isSymbolic() const
Allows to pass back messages to the calling function.
virtual std::ostream & print(std::ostream &stream) const =0
virtual returnValue loadIndices(SymbolicIndexList *indexList)
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
virtual returnValue AD_backward2(int number, double seed1, double seed2, double *df, double *ddf)=0
virtual returnValue enumerateVariables(SymbolicIndexList *indexList)
virtual returnValue initDerivative()
virtual returnValue setMonotonicity(MonotonicityType monotonicity_)
Operator * argument2
virtual BooleanType isLinearIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)=0
virtual BooleanType isDependingOn(VariableType var) const
#define CLOSE_NAMESPACE_ACADO
virtual returnValue evaluate(int number, double *x, double *result)=0
Manages the indices of SymbolicVariables.
VariableType
Definition: acado_types.hpp:95
virtual returnValue setCurvature(CurvatureType curvature_)
double * dargument2_result
virtual ~BinaryOperator()
virtual Operator * clone() const =0
Operator * argument1
MonotonicityType monotonicity
Implements the scalar power operator with integer exponent within the symbolic operators family...
Definition: powerint.hpp:55
double * argument2_result
virtual CurvatureType getCurvature()=0
double * dargument1_result
virtual returnValue AD_backward(int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)=0
NeutralElement
Definition: acado_types.hpp:64
virtual BooleanType isPolynomialIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)=0
Abstract base class for all scalar-valued symbolic operators.
MonotonicityType
virtual OperatorName getName()=0
virtual Operator * substitute(int index, const Operator *sub)=0
Implements the tree-projection operator within the family of SymbolicOperators.
CurvatureType
void copy(const BinaryOperator &arg)
BinaryOperator & operator=(const BinaryOperator &arg)
#define BEGIN_NAMESPACE_ACADO
Abstract base class for templated evaluation of operators.
virtual BooleanType isVariable(VariableType &varType, int &component) const
virtual BooleanType isRationalIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)=0
virtual returnValue clearBuffer()
virtual Operator * differentiate(int index)=0


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