c_function.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_FUNCTION_HPP
36 #define ACADO_TOOLKIT_C_FUNCTION_HPP
37 
38 
40 
41 
43 
44 
54 class CFunction{
55 
56  //
57  // PUBLIC MEMBER FUNCTIONS:
58  //
59 
60  public:
61 
63  CFunction( );
64 
65 
68  CFunction( uint dim, cFcnPtr cFcn_ );
69 
70 
74  CFunction( uint dim, cFcnPtr cFcn_ ,
75  cFcnDPtr cFcnDForward_,
76  cFcnDPtr cFcnDBackward_ );
77 
78 
80  CFunction( const CFunction& rhs );
81 
83  virtual ~CFunction( );
84 
86  CFunction& operator=( const CFunction& rhs );
87 
88 
90  virtual Expression operator()( const Expression &arg );
91 
92 
96  virtual uint getDim () const;
97 
98 
103  virtual returnValue evaluate( double *x ,
104  double *result );
105 
106 
107 
111  virtual void evaluateCFunction( double *x ,
112  double *result );
113 
114 
115 
122  virtual returnValue evaluate( double *x ,
123  double *result ,
124  PrintLevel printL );
125 
126 
133  virtual returnValue evaluate( int number ,
134  double *x ,
135  double *result );
136 
137 
142  virtual returnValue AD_forward( double *x ,
144  double *seed ,
145  double *f ,
147  double *df );
149 
150 
157  virtual returnValue AD_forward( int number ,
158  double *seed ,
159  double *df );
161 
162 
170  virtual returnValue AD_forward( int number ,
171  double *x ,
173  double *seed ,
174  double *f ,
176  double *df );
178 
179 
180  // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
181  // the point x and to compute f.
182 
187  virtual returnValue AD_backward( double *seed ,
188  double *df );
190 
191 
192 
193  // IMPORTANT REMARK FOR AD_BACKWARD: run evaluate first to define
194  // the point x and to compute f.
195 
201  virtual returnValue AD_backward( int number ,
203  double *seed ,
204  double *df );
206 
207 
215  virtual returnValue AD_forward2( int number ,
217  double *seed1 ,
218  double *seed2 ,
220  double *df ,
222  double *ddf );
224 
225 
226  // IMPORTANT REMARK FOR AD_BACKWARD2: run AD_forward first to define
227  // the point x and to compute f and df.
228 
234  virtual returnValue AD_backward2( int number ,
236  double *seed1 ,
237  double *seed2 ,
238  double *df ,
240  double *ddf );
242 
243 
244 
249  virtual returnValue clearBuffer();
250 
251 
259  virtual returnValue setUserData( void * user_data_ );
260 
261 
262 
263 //
264 // PROTECTED FUNCTIONS:
265 //
266 
267 protected:
268 
271  void copy( const CFunction &arg );
272 
273 
276  void deleteAll();
277 
278 
279 
280 //
281 // PROTECTED MEMBERS:
282 //
283 
284  protected:
285 
288 
292 
293 
294  void* user_data ;
297  uint nn ;
301  double **xStore ;
302  double **seedStore ;
303 };
304 
305 
307 
308 
309 
310 
311 #endif // ACADO_TOOLKIT_C_FUNCTION_HPP
312 
313 /*
314  * end of file
315  */
316 
virtual returnValue AD_backward2(int number, double *seed1, double *seed2, double *df, double *ddf)
Definition: c_function.cpp:513
Allows to pass back messages to the calling function.
virtual void evaluateCFunction(double *x, double *result)
Definition: c_function.cpp:215
virtual returnValue AD_forward2(int number, double *seed1, double *seed2, double *df, double *ddf)
Definition: c_function.cpp:426
returnValue initialize()
Definition: c_function.cpp:103
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
#define CLOSE_NAMESPACE_ACADO
void(* cFcnDPtr)(int number, double *x, double *seed, double *f, double *df, void *userData)
Definition: acado_types.hpp:59
Base class for all variables within the symbolic expressions family.
Definition: expression.hpp:56
double ** xStore
Definition: c_function.hpp:301
void * user_data
Definition: c_function.hpp:294
void copy(const CFunction &arg)
Definition: c_function.cpp:118
virtual Expression operator()(const Expression &arg)
Definition: c_function.cpp:169
virtual ~CFunction()
Definition: c_function.cpp:91
virtual returnValue evaluate(double *x, double *result)
Definition: c_function.cpp:205
cFcnDPtr cFcnDForward
Definition: c_function.hpp:290
virtual uint getDim() const
Definition: c_function.cpp:199
virtual returnValue setUserData(void *user_data_)
Definition: c_function.cpp:539
void rhs(const real_t *x, real_t *f)
PrintLevel
CFunction & operator=(const CFunction &rhs)
Definition: c_function.cpp:93
virtual returnValue AD_backward(double *seed, double *df)
Definition: c_function.cpp:398
cFcnDPtr cFcnDBackward
Definition: c_function.hpp:291
uint maxAlloc
Definition: c_function.hpp:300
(no description yet)
Definition: c_function.hpp:54
void deleteAll()
Definition: c_function.cpp:156
#define BEGIN_NAMESPACE_ACADO
void(* cFcnPtr)(double *x, double *f, void *userData)
Definition: acado_types.hpp:56
virtual returnValue clearBuffer()
Definition: c_function.cpp:518
double ** seedStore
Definition: c_function.hpp:302
cFcnPtr cFcn
Definition: c_function.hpp:289
virtual returnValue AD_forward(double *x, double *seed, double *f, double *df)
Definition: c_function.cpp:267


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