nonsmooth_operator.cpp
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 
39 
40 
42 
43 
45 {
46 }
47 
49 {
50 }
51 
52 
53 Operator& NonsmoothOperator::operator=( const double &arg ){
54 
56  ASSERT( 1 == 0 );
57  return emptyTreeProjection;
58 }
59 
61 
63  ASSERT( 1 == 0 );
64  return emptyTreeProjection;
65 }
66 
68 
70  ASSERT( 1 == 0 );
71  return emptyTreeProjection;
72 }
73 
75 
77  ASSERT( 1 == 0 );
78  return emptyTreeProjection;
79 }
80 
82 
84  ASSERT( 1 == 0 );
85  return emptyTreeProjection;
86 }
87 
88 
90 
91  // if this routine is ever called something went
92  // really wrong ....
93 
95  ASSERT( 1 == 0 );
96  return new TreeProjection();
97 }
98 
99 
100 Operator& NonsmoothOperator::operator+=( const double & arg ){ return operator=( this->operator+(arg) ); }
101 Operator& NonsmoothOperator::operator+=( const DVector & arg ){ return operator=( this->operator+(arg) ); }
102 Operator& NonsmoothOperator::operator+=( const DMatrix & arg ){ return operator=( this->operator+(arg) ); }
103 Operator& NonsmoothOperator::operator+=( const Expression& arg ){ return operator=( this->operator+(arg) ); }
104 
105 Operator& NonsmoothOperator::operator-=( const double & arg ){ return operator=( this->operator-(arg) ); }
106 Operator& NonsmoothOperator::operator-=( const DVector & arg ){ return operator=( this->operator-(arg) ); }
107 Operator& NonsmoothOperator::operator-=( const DMatrix & arg ){ return operator=( this->operator-(arg) ); }
108 Operator& NonsmoothOperator::operator-=( const Expression & arg ){ return operator=( this->operator-(arg) ); }
109 
110 Operator& NonsmoothOperator::operator*=( const double & arg ){ return operator=( this->operator*(arg) ); }
111 Operator& NonsmoothOperator::operator*=( const DVector & arg ){ return operator=( this->operator*(arg) ); }
112 Operator& NonsmoothOperator::operator*=( const DMatrix & arg ){ return operator=( this->operator*(arg) ); }
113 Operator& NonsmoothOperator::operator*=( const Expression & arg ){ return operator=( this->operator*(arg) ); }
114 
115 Operator& NonsmoothOperator::operator/=( const double & arg ){ return operator=( this->operator/(arg) ); }
116 Operator& NonsmoothOperator::operator/=( const Expression & arg ){ return operator=( this->operator/(arg) ); }
117 
118 
119 
120 
121 Expression NonsmoothOperator::operator+( const double & arg ) const{ return Expression(*this)+arg; }
122 Expression NonsmoothOperator::operator+( const DVector & arg ) const{ return Expression(*this)+arg; }
123 Expression NonsmoothOperator::operator+( const DMatrix & arg ) const{ return Expression(*this)+arg; }
124 Expression NonsmoothOperator::operator+( const Operator& arg ) const{ return Expression(*this)+arg; }
125 Expression NonsmoothOperator::operator+( const Expression & arg ) const{ return Expression(*this)+arg; }
126 
127 Expression NonsmoothOperator::operator-( const double & arg ) const{ return Expression(*this)-arg; }
128 Expression NonsmoothOperator::operator-( const DVector & arg ) const{ return Expression(*this)-arg; }
129 Expression NonsmoothOperator::operator-( const DMatrix & arg ) const{ return Expression(*this)-arg; }
130 Expression NonsmoothOperator::operator-( const Operator& arg ) const{ return Expression(*this)-arg; }
131 Expression NonsmoothOperator::operator-( const Expression & arg ) const{ return Expression(*this)-arg; }
132 
134 
135 Expression NonsmoothOperator::operator*( const double & arg ) const{ return Expression(*this)*arg; }
136 Expression NonsmoothOperator::operator*( const DVector & arg ) const{ return Expression(*this)*arg; }
137 Expression NonsmoothOperator::operator*( const DMatrix & arg ) const{ return Expression(*this)*arg; }
138 
139 
141 
142  Expression tmp2(arg);
143 
144 
145  Expression tmp1(*this);
146 
147 
148  return tmp1*tmp2;
149 }
150 
151 
152 Expression NonsmoothOperator::operator*( const Expression & arg ) const{ return Expression(*this)*arg; }
153 
154 Expression NonsmoothOperator::operator/( const double & arg ) const{ return Expression(*this)/arg; }
155 Expression NonsmoothOperator::operator/( const Operator& arg ) const{ return Expression(*this)/arg; }
156 Expression NonsmoothOperator::operator/( const Expression & arg ) const{ return Expression(*this)/arg; }
157 
158 
159 ConstraintComponent NonsmoothOperator::operator<=( const double& ub ) const{ return Expression(*this) <= ub; }
160 ConstraintComponent NonsmoothOperator::operator>=( const double& lb ) const{ return Expression(*this) >= lb; }
161 ConstraintComponent NonsmoothOperator::operator==( const double& b ) const{ return Expression(*this) == b; }
162 
165 ConstraintComponent NonsmoothOperator::operator==( const DVector& b ) const{ return Expression(*this) == b; }
166 
170 
171 
172 
173 
174 returnValue NonsmoothOperator::evaluate( int number, double *x, double *result ){
175 
176  //result[0] = value;
177  return SUCCESSFUL_RETURN;
178 }
179 
180 
182 
183  return SUCCESSFUL_RETURN;
184 }
185 
186 
187 
189 
190  return new NonsmoothOperator();
191 }
192 
193 
195  VariableType *varType,
196  int *component,
197  Operator **seed,
198  int &nNewIS,
199  TreeProjection ***newIS ){
200 
201  return new NonsmoothOperator();
202 }
203 
204 
205 
207  VariableType *varType ,
208  int *component,
209  Operator *seed ,
210  Operator **df ,
211  int &nNewIS ,
212  TreeProjection ***newIS ){
213 
214  delete seed;
215  return SUCCESSFUL_RETURN;
216 }
217 
218 
219 
221  VariableType *varType ,
222  int *component ,
223  Operator *l ,
224  Operator **S ,
225  int dimS ,
226  Operator **dfS ,
227  Operator **ldf ,
228  Operator **H ,
229  int &nNewLIS ,
230  TreeProjection ***newLIS ,
231  int &nNewSIS ,
232  TreeProjection ***newSIS ,
233  int &nNewHIS ,
234  TreeProjection ***newHIS ){
235 
236  delete l;
237  return SUCCESSFUL_RETURN;
238 }
239 
240 
241 
243 
244  return clone();
245 }
246 
247 
248 
250 
252 }
253 
254 
256 
257  return BT_FALSE;
258 }
259 
260 
262  VariableType *varType,
263  int *component,
264  BooleanType *implicit_dep ){
265 
266  return BT_FALSE;
267 }
268 
269 
271  VariableType *varType,
272  int *component,
273  BooleanType *implicit_dep ){
274 
275  return BT_TRUE;
276 }
277 
278 
280  VariableType *varType,
281  int *component,
282  BooleanType *implicit_dep ){
283 
284  return BT_TRUE;
285 }
286 
287 
289  VariableType *varType,
290  int *component,
291  BooleanType *implicit_dep ){
292 
293  return BT_TRUE;
294 }
295 
296 
298 {
299  return BT_FALSE;
300 }
301 
302 
304 
305  return MT_CONSTANT;
306 }
307 
308 
310 
311  return CT_CONSTANT;
312 }
313 
314 
316 
317  return SUCCESSFUL_RETURN;
318 }
319 
320 
322 
323  return SUCCESSFUL_RETURN;
324 }
325 
326 
327 returnValue NonsmoothOperator::AD_forward( int number, double *x, double *seed,
328  double *f, double *df ){
329 
330  f[0] = 0.0;//value;
331  df[0] = 0.0;
332 
333  return SUCCESSFUL_RETURN;
334 }
335 
336 
337 
338 returnValue NonsmoothOperator::AD_forward( int number, double *seed, double *df ){
339 
340  df[0] = 0.0;
341  return SUCCESSFUL_RETURN;
342 }
343 
344 
345 returnValue NonsmoothOperator::AD_backward( int number, double seed, double *df ){
346 
347  return SUCCESSFUL_RETURN;
348 }
349 
350 
351 returnValue NonsmoothOperator::AD_forward2( int number, double *seed, double *dseed,
352  double *df, double *ddf ){
353 
354  df[0] = 0.0;
355  ddf[0] = 0.0;
356 
357  return SUCCESSFUL_RETURN;
358 }
359 
360 
361 returnValue NonsmoothOperator::AD_backward2( int number, double seed1, double seed2,
362  double *df, double *ddf ){
363 
364  return SUCCESSFUL_RETURN;
365 }
366 
367 
368 std::ostream& NonsmoothOperator::print( std::ostream &stream ) const
369 {
370  return stream; // << value;
371 }
372 
373 
375 
376  return new NonsmoothOperator(*this);
377 }
378 
379 
381 
382  return SUCCESSFUL_RETURN;
383 }
384 
385 
387 
388  return SUCCESSFUL_RETURN;
389 }
390 
391 //
392 // PROTECTED MEMBER FUNCTIONS:
393 // ---------------------------
394 
396 
397  return ON_DOUBLE_CONSTANT;
398 }
399 
400 BooleanType NonsmoothOperator::isVariable( VariableType &varType, int &component ) const
401 {
402  return BT_FALSE;
403 }
404 
405 
407 
408  return SUCCESSFUL_RETURN;
409 }
410 
411 
413 
414  return BT_TRUE;
415 }
416 
417 
418 
419 double NonsmoothOperator::getValue() const{ return INFTY; }
420 
422 
424  return -1;
425 }
426 
427 
429 
430  return 0;
431 }
432 
433 
434 
436 
437 
438 // end of file.
OperatorName
Definition: acado_types.hpp:72
virtual returnValue enumerateVariables(SymbolicIndexList *indexList)
ConstraintComponent operator==(const double &b) const
ConstraintComponent operator<=(const double &ub) const
Expression operator*(const double &arg) const
virtual returnValue AD_forward2(int number, double *seed1, double *seed2, double *df, double *ddf)
virtual std::ostream & print(std::ostream &stream) const
virtual BooleanType isSmooth() const
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
Operator & operator/=(const double &arg)
const double INFTY
virtual returnValue setMonotonicity(MonotonicityType monotonicity_)
virtual returnValue clearBuffer()
Expression operator/(const double &arg) const
virtual TreeProjection * cloneTreeProjection() const
ConstraintComponent operator>=(const double &lb) const
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
virtual OperatorName getName()
virtual Operator * passArgument() const
virtual Operator * AD_forward(int dim, VariableType *varType, int *component, Operator **seed, int &nNewIS, TreeProjection ***newIS)
Expression operator-() const
virtual returnValue AD_backward(int dim, VariableType *varType, int *component, Operator *seed, Operator **df, int &nNewIS, TreeProjection ***newIS)
virtual returnValue evaluate(int number, double *x, double *result)
virtual BooleanType isDependingOn(VariableType var) const
virtual returnValue loadIndices(SymbolicIndexList *indexList)
virtual BooleanType isLinearIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Operator & operator+=(const double &arg)
virtual NeutralElement isOneOrZero() const
#define CLOSE_NAMESPACE_ACADO
Manages the indices of SymbolicVariables.
Data class for symbolically formulating constraints within optimal control problems.
VariableType
Definition: acado_types.hpp:95
virtual returnValue setCurvature(CurvatureType curvature_)
virtual BooleanType isVariable(VariableType &varType, int &component) const
Base class for all variables within the symbolic expressions family.
Definition: expression.hpp:56
Operator & operator*=(const double &arg)
virtual Operator * substitute(int index, const Operator *sub)
virtual BooleanType isRationalIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
virtual returnValue AD_backward2(int number, double seed1, double seed2, double *df, double *ddf)
virtual Operator * clone() const
virtual Operator * differentiate(int index)
Expression operator+(const double &arg) const
virtual MonotonicityType getMonotonicity()
virtual Operator & operator=(const double &arg)
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)
static TreeProjection emptyTreeProjection
#define ASSERT(x)
#define BT_TRUE
Definition: acado_types.hpp:47
NeutralElement
Definition: acado_types.hpp:64
MonotonicityType
Implements the tree-projection operator within the family of SymbolicOperators.
virtual CurvatureType getCurvature()
CurvatureType
virtual BooleanType isSymbolic() const
#define BEGIN_NAMESPACE_ACADO
Abstract base class for templated evaluation of operators.
#define BT_FALSE
Definition: acado_types.hpp:49
virtual double getValue() const
virtual BooleanType isPolynomialIn(int dim, VariableType *varType, int *component, BooleanType *implicit_dep)
Operator & operator-=(const double &arg)
virtual int getGlobalIndex() const
#define ACADOERROR(retval)


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