projection.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_PROJECTION_HPP
36 #define ACADO_TOOLKIT_PROJECTION_HPP
37 
38 
40 
41 
43 
44 
55 class Projection : public SmoothOperator{
56 
57 
59 
60 
61 public:
62 
63 
65  Projection();
66 
68  Projection( const std::string& name_ );
69 
71  Projection( VariableType variableType_, int vIndex_, const std::string& name_ );
72 
73 
75  Projection( const Projection& arg );
76 
77 
79  virtual ~Projection();
80 
81 
82 
89  virtual returnValue evaluate( int number ,
90  double *x ,
91  double *result );
92 
93 
95  virtual returnValue evaluate( EvaluationBase *x );
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 
135 
141  virtual returnValue AD_symmetric( int dim ,
142  VariableType *varType ,
143  int *component ,
144  Operator *l ,
145  Operator **S ,
146  int dimS ,
147  Operator **dfS ,
148  Operator **ldf ,
149  Operator **H ,
150  int &nNewLIS ,
151  TreeProjection ***newLIS ,
152  int &nNewSIS ,
153  TreeProjection ***newSIS ,
154  int &nNewHIS ,
155  TreeProjection ***newHIS );
156 
157 
158 
163  virtual Operator* substitute( int index ,
164  const Operator *sub );
165 
166 
167 
174  virtual NeutralElement isOneOrZero() const;
175 
176 
177 
183  virtual BooleanType isDependingOn( VariableType var ) const;
184 
185 
186 
192  virtual BooleanType isDependingOn( int dim ,
193  VariableType *varType ,
194  int *component,
195  BooleanType *implicit_dep );
196 
197 
198 
199 
207  virtual BooleanType isLinearIn( int dim ,
208  VariableType *varType ,
209  int *component,
210  BooleanType *implicit_dep );
211 
212 
213 
220  virtual BooleanType isPolynomialIn( int dim ,
221  VariableType *varType ,
222  int *component,
223  BooleanType *implicit_dep );
224 
225 
226 
233  virtual BooleanType isRationalIn( int dim ,
234  VariableType *varType ,
235  int *component,
236  BooleanType *implicit_dep );
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 
300  virtual returnValue AD_forward( int number ,
301  double *x ,
303  double *seed ,
304  double *f ,
306  double *df );
308 
309 
310  // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
311  // the point x and to compute f.
312 
318  virtual returnValue AD_backward( int number ,
320  double seed ,
321  double *df );
323 
324 
325 
333  virtual returnValue AD_forward2( int number ,
335  double *seed1 ,
336  double *seed2 ,
338  double *df ,
340  double *ddf );
342 
343 
344 
345  // IMPORTANT REMARK FOR AD_BACKWARD2: run AD_forward first to define
346  // the point x and to compute f and df.
347 
353  virtual returnValue AD_backward2( int number ,
355  double seed1 ,
356  double seed2 ,
357  double *df ,
359  double *ddf );
361 
362 
363 
367  virtual std::ostream& print( std::ostream &stream ) const;
368 
369 
370 
374  virtual Operator* clone() const;
375 
376 
381  virtual returnValue clearBuffer();
382 
383 
384 
390 
391 
395  virtual OperatorName getName();
396 
397 
401  virtual double getScale() const;
402 
403 
407  virtual returnValue setScale( const double &scale_ );
408 
409 
413  virtual BooleanType isVariable( VariableType &varType,
414  int &component ) const;
415 
416 
417 
420  virtual int getVariableIndex( ) const;
421 
422 
427  virtual int getGlobalIndex() const;
428 
429 
432  VariableType getType( ) const;
433 
434 
456 
457 
463  virtual BooleanType isSymbolic() const;
464 
465 
469  virtual returnValue setVariableExportName( const VariableType &_type,
470  const std::vector< std::string >& _name
471  );
472 
473 
474  virtual BooleanType isTrivial() const;
475 
476 //
477 // PROTECTED FUNCTIONS:
478 //
479 
480 protected:
481 
482 
488  virtual Operator* ADforwardProtected( int dim ,
489  VariableType *varType ,
490  int *component,
491  Operator **seed ,
492  int &nNewIS ,
493  TreeProjection ***newIS );
494 
495 
496 
502  virtual returnValue ADbackwardProtected( int dim ,
503  VariableType *varType ,
504  int *component,
505  Operator *seed ,
506  Operator **df ,
507  int &nNewIS ,
508  TreeProjection ***newIS );
509 
510 
516  virtual returnValue ADsymmetricProtected( int dim ,
517  VariableType *varType ,
518  int *component ,
519  Operator *l ,
520  Operator **S ,
521  int dimS ,
522  Operator **dfS ,
523  Operator **ldf ,
524  Operator **H ,
525  int &nNewLIS ,
526  TreeProjection ***newLIS ,
527  int &nNewSIS ,
528  TreeProjection ***newSIS ,
529  int &nNewHIS ,
530  TreeProjection ***newHIS );
531 
532 
533 
534 // PROTECTED MEMBER FUNCTIONS:
535 // ---------------------------------------------
536 
538  virtual void copy( const Projection &arg );
539 
540 
541 //
542 // PROTECTED MEMBERS:
543 //
544 
545 protected:
546 
549  int vIndex ;
550  double scale ;
551  std::string name ;
552 
554 
557 };
558 
559 
561 
562 
563 
564 #endif
OperatorName
Definition: acado_types.hpp:72
virtual returnValue enumerateVariables(SymbolicIndexList *indexList)
Definition: projection.cpp:418
virtual BooleanType isPolynomialIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Definition: projection.cpp:292
virtual MonotonicityType getMonotonicity()
Definition: projection.cpp:310
virtual std::ostream & print(std::ostream &stream) const
Definition: projection.cpp:379
virtual returnValue setScale(const double &scale_)
Definition: projection.cpp:403
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
VariableType variableType
Definition: projection.hpp:547
VariableType getType() const
Definition: projection.cpp:438
virtual void copy(const Projection &arg)
Definition: projection.cpp:148
CurvatureType curvature
Definition: projection.hpp:555
virtual Operator * substitute(int index, const Operator *sub)
Definition: projection.cpp:236
OperatorName operatorName
Definition: projection.hpp:553
Allows to pass back messages to the calling function.
virtual BooleanType isRationalIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Definition: projection.cpp:301
virtual CurvatureType getCurvature()
Definition: projection.cpp:316
virtual BooleanType isTrivial() const
Definition: projection.cpp:579
virtual ~Projection()
Definition: projection.cpp:133
virtual returnValue setMonotonicity(MonotonicityType monotonicity_)
Definition: projection.cpp:322
virtual Operator * differentiate(int index)
Definition: projection.cpp:180
virtual returnValue AD_forward2(int number, double *seed1, double *seed2, double *df, double *ddf)
Definition: projection.cpp:360
#define CLOSE_NAMESPACE_ACADO
virtual NeutralElement isOneOrZero() const
Definition: projection.cpp:248
Manages the indices of SymbolicVariables.
VariableType
Definition: acado_types.hpp:95
virtual int index(VariableType variableType_, int index_) const
virtual returnValue AD_backward2(int number, double seed1, double seed2, double *df, double *ddf)
Definition: projection.cpp:368
virtual BooleanType isSymbolic() const
Definition: projection.cpp:451
virtual returnValue setVariableExportName(const VariableType &_type, const std::vector< std::string > &_name)
Definition: projection.cpp:569
virtual BooleanType isVariable(VariableType &varType, int &component) const
Definition: projection.cpp:410
double scale
Definition: projection.hpp:550
virtual returnValue loadIndices(SymbolicIndexList *indexList)
Definition: projection.cpp:444
virtual 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)
Definition: projection.cpp:518
virtual double getScale() const
Definition: projection.cpp:397
std::string name
Definition: projection.hpp:551
virtual Operator * AD_forward(int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)
Definition: projection.cpp:191
virtual Operator * clone() const
Definition: projection.cpp:142
Implements the projection operator within the symbolic operators family.
Definition: projection.hpp:55
MonotonicityType monotonicity
Definition: projection.hpp:556
NeutralElement
Definition: acado_types.hpp:64
Organizes the evaluation of the function tree.
Abstract base class for all scalar-valued symbolic operators.
MonotonicityType
virtual Operator * ADforwardProtected(int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)
Definition: projection.cpp:457
virtual returnValue ADbackwardProtected(int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)
Definition: projection.cpp:479
Implements the tree-projection operator within the family of SymbolicOperators.
virtual returnValue clearBuffer()
Definition: projection.cpp:385
CurvatureType
virtual int getVariableIndex() const
Definition: projection.cpp:426
#define BEGIN_NAMESPACE_ACADO
Abstract base class for templated evaluation of operators.
virtual BooleanType isDependingOn(VariableType var) const
Definition: projection.cpp:256
virtual int getGlobalIndex() const
Definition: projection.cpp:432
virtual returnValue evaluate(int number, double *x, double *result)
Definition: projection.cpp:166
virtual returnValue setCurvature(CurvatureType curvature_)
Definition: projection.cpp:329
virtual OperatorName getName()
Definition: projection.cpp:391
virtual BooleanType isLinearIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Definition: projection.cpp:283
virtual returnValue AD_backward(int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)
Definition: projection.cpp:203
int variableIndex
Definition: projection.hpp:548
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: projection.cpp:215


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