objective.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 
38 
39 #include <algorithm>
40 
42 
43 
44 //
45 // PUBLIC MEMBER FUNCTIONS:
46 //
47 
48 
50  :LagrangeTerm(){
51 
52  lsqTerm = 0;
53  lsqEndTerm = 0;
54  mayerTerm = 0;
55 
56  nLSQ = 0;
57  nEndLSQ = 0;
58  nMayer = 0;
59 }
60 
61 
63 
64  lsqTerm = 0;
65  lsqEndTerm = 0;
66  mayerTerm = 0;
67 
68  nLSQ = 0;
69  nEndLSQ = 0;
70  nMayer = 0;
71 
72  init( grid_ );
73 }
74 
75 
76 
78 
79  return LagrangeTerm::init( grid_ );
80 }
81 
82 
83 
85  :LagrangeTerm(rhs){
86 
87  uint run1;
88 
89  nLSQ = rhs.nLSQ ;
90  nEndLSQ = rhs.nEndLSQ;
91  nMayer = rhs.nMayer ;
92 
93  if( rhs.lsqTerm != 0 ){
94  lsqTerm = (LSQTerm**)calloc(nLSQ,sizeof(LSQTerm*));
95  for( run1 = 0; run1 < nLSQ; run1++ )
96  lsqTerm[run1] = new LSQTerm(*rhs.lsqTerm[run1]);
97  }
98  else lsqTerm = 0;
99 
100  if( rhs.lsqEndTerm != 0 ){
101  lsqEndTerm = (LSQEndTerm**)calloc(nEndLSQ,sizeof(LSQEndTerm*));
102  for( run1 = 0; run1 < nEndLSQ; run1++ )
103  lsqEndTerm[run1] = new LSQEndTerm(*rhs.lsqEndTerm[run1]);
104  }
105  else lsqEndTerm = 0;
106 
107  if( rhs.mayerTerm != 0 ){
108  mayerTerm = (MayerTerm**)calloc(nMayer,sizeof(MayerTerm*));
109  for( run1 = 0; run1 < nMayer; run1++ )
110  mayerTerm[run1] = new MayerTerm(*rhs.mayerTerm[run1]);
111  }
112  else mayerTerm = 0;
113 
116 
119 
121 }
122 
123 
125 
126  uint run1;
127 
128  if( lsqTerm != 0 ){
129  for( run1 = 0; run1 < nLSQ; run1++ )
130  delete lsqTerm[run1];
131  free(lsqTerm);
132  }
133 
134  if( lsqEndTerm != 0 ){
135  for( run1 = 0; run1 < nEndLSQ; run1++ )
136  delete lsqEndTerm[run1];
137  free(lsqEndTerm);
138  }
139 
140  if( mayerTerm != 0 ){
141  for( run1 = 0; run1 < nMayer; run1++ )
142  delete mayerTerm[run1];
143  free(mayerTerm);
144  }
145 
146  cgExternLsqElements.clear();
147  cgLsqEndTermElements.clear();
148 
149  cgExternLsqElements.clear();
151 
152  cgLsqLinearElements.clear();
153 }
154 
156  const Function& h ,
157  const VariablesGrid *r_ )
158 {
159  nLSQ++;
160  lsqTerm = (LSQTerm**)realloc(lsqTerm,nLSQ*sizeof(LSQTerm*));
161  lsqTerm[nLSQ-1] = new LSQTerm(S_, h, r_);
162  lsqTerm[nLSQ-1]->setGrid(grid);
163 
164  DMatrix temp = S_->getMatrix( 0 );
165  if (temp.isPositiveSemiDefinite() == BT_FALSE)
167 
168  cgLsqElements.push_back(LsqData(temp, h));
169 
170  return SUCCESSFUL_RETURN;
171 }
172 
173 
174 
176  const Function & m,
177  const DVector & r )
178 {
179 
180  nEndLSQ++;
181  lsqEndTerm = (LSQEndTerm**)realloc(lsqEndTerm,nEndLSQ*sizeof(LSQEndTerm*));
182  lsqEndTerm[nEndLSQ-1] = new LSQEndTerm(grid, S, m, r);
184 
185  cgLsqEndTermElements.push_back(LsqData(S, m));
186 
187  return SUCCESSFUL_RETURN;
188 }
189 
191 
192  uint run1;
193 
194  if( this != &rhs ){
195 
196  if( lsqTerm != 0 ){
197  for( run1 = 0; run1 < nLSQ; run1++ )
198  delete lsqTerm[run1];
199  free(lsqTerm);
200  }
201 
202  if( lsqEndTerm != 0 ){
203  for( run1 = 0; run1 < nEndLSQ; run1++ )
204  delete lsqEndTerm[run1];
205  free(lsqEndTerm);
206  }
207 
208  if( mayerTerm != 0 ){
209  for( run1 = 0; run1 < nMayer; run1++ )
210  delete mayerTerm[run1];
211  free(mayerTerm);
212  }
213 
215 
216  nLSQ = rhs.nLSQ ;
217  nEndLSQ = rhs.nEndLSQ;
218  nMayer = rhs.nMayer ;
219 
220  if( rhs.lsqTerm != 0 ){
221  lsqTerm = (LSQTerm**)calloc(nLSQ,sizeof(LSQTerm*));
222  for( run1 = 0; run1 < nLSQ; run1++ )
223  lsqTerm[run1] = new LSQTerm(*rhs.lsqTerm[run1]);
224  }
225  else lsqTerm = 0;
226 
227  if( rhs.lsqEndTerm != 0 ){
228  lsqEndTerm = (LSQEndTerm**)calloc(nEndLSQ,sizeof(LSQEndTerm*));
229  for( run1 = 0; run1 < nEndLSQ; run1++ )
230  lsqEndTerm[run1] = new LSQEndTerm(*rhs.lsqEndTerm[run1]);
231  }
232  else lsqEndTerm = 0;
233 
234  if( rhs.mayerTerm != 0 ){
235  mayerTerm = (MayerTerm**)calloc(nMayer,sizeof(MayerTerm*));
236  for( run1 = 0; run1 < nMayer; run1++ )
237  mayerTerm[run1] = new MayerTerm(*rhs.mayerTerm[run1]);
238  }
239  else mayerTerm = 0;
240 
243 
246 
248  }
249  return *this;
250 }
251 
252 
253 
255 
256  uint run1;
257 
258  for( run1 = 0; run1 < nLSQ; run1++ )
259  ACADO_TRY( lsqTerm[run1]->evaluate( x ) );
260 
261  for( run1 = 0; run1 < nEndLSQ; run1++ )
262  ACADO_TRY( lsqEndTerm[run1]->evaluate( x ) );
263 
264  for( run1 = 0; run1 < nMayer; run1++ )
265  ACADO_TRY( mayerTerm[run1]->evaluate( x ) );
266 
267  return SUCCESSFUL_RETURN;
268 }
269 
270 
272 
273  returnValue returnvalue;
274  uint run1;
275 
276  for( run1 = 0; run1 < nLSQ; run1++ ){
277  returnvalue = lsqTerm[run1]->evaluateSensitivities( 0 );
278  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
279  }
280 
281  for( run1 = 0; run1 < nEndLSQ; run1++ ){
282  returnvalue = lsqEndTerm[run1]->evaluateSensitivities( 0 );
283  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
284  }
285 
286  for( run1 = 0; run1 < nMayer; run1++ ){
287  returnvalue = mayerTerm[run1]->evaluateSensitivities( 0 );
288  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
289  }
290 
291  return SUCCESSFUL_RETURN;
292 }
293 
294 
296 
297  returnValue returnvalue;
298  uint run1;
299 
300  for( run1 = 0; run1 < nLSQ; run1++ ){
301  returnvalue = lsqTerm[run1]->evaluateSensitivities( &hessian );
302  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
303  }
304 
305  for( run1 = 0; run1 < nEndLSQ; run1++ ){
306  returnvalue = lsqEndTerm[run1]->evaluateSensitivities( &hessian );
307  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
308  }
309 
310  for( run1 = 0; run1 < nMayer; run1++ ){
311  returnvalue = mayerTerm[run1]->evaluateSensitivities( &hessian );
312  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
313  }
314 
315  return SUCCESSFUL_RETURN;
316 }
317 
318 
320 
321  returnValue returnvalue;
322  uint run1;
323 
324  hessian.setZero();
325  if( nMayer != 0 )
327 
328  for( run1 = 0; run1 < nLSQ; run1++ ){
329  returnvalue = lsqTerm[run1]->evaluateSensitivitiesGN( &hessian );
330  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
331  }
332  for( run1 = 0; run1 < nEndLSQ; run1++ ){
333  returnvalue = lsqEndTerm[run1]->evaluateSensitivitiesGN( &hessian );
334  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
335  }
336 
337  return SUCCESSFUL_RETURN;
338 }
339 
340 
342  BlockMatrix *xaSeed_,
343  BlockMatrix *pSeed_ ,
344  BlockMatrix *uSeed_ ,
345  BlockMatrix *wSeed_ ,
346  int order ){
347 
348  returnValue returnvalue;
349  uint run1;
350 
351  for( run1 = 0; run1 < nLSQ; run1++ ){
352  returnvalue = lsqTerm[run1]->setForwardSeed( xSeed_, xaSeed_, pSeed_, uSeed_, wSeed_, order );
353  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
354  }
355 
356  for( run1 = 0; run1 < nEndLSQ; run1++ ){
357  returnvalue = lsqEndTerm[run1]->setForwardSeed( xSeed_, xaSeed_, pSeed_, uSeed_, wSeed_, order );
358  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
359  }
360 
361  for( run1 = 0; run1 < nMayer; run1++ ){
362  returnvalue = mayerTerm[run1]->setForwardSeed( xSeed_, xaSeed_, pSeed_, uSeed_, wSeed_, order );
363  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
364  }
365 
366  return SUCCESSFUL_RETURN;
367 }
368 
369 
371 
372  returnValue returnvalue;
373  uint run1;
374 
375  for( run1 = 0; run1 < nLSQ; run1++ ){
376  returnvalue = lsqTerm[run1]->setBackwardSeed( seed, 1 );
377  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
378  }
379 
380  for( run1 = 0; run1 < nEndLSQ; run1++ ){
381  returnvalue = lsqEndTerm[run1]->setBackwardSeed( seed, 1 );
382  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
383  }
384 
385  for( run1 = 0; run1 < nMayer; run1++ ){
386  returnvalue = mayerTerm[run1]->setBackwardSeed( seed, 1 );
387  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
388  }
389 
390  return SUCCESSFUL_RETURN;
391 }
392 
393 
395 
396  BlockMatrix seed(1,1);
397  seed.setIdentity(0,0,1);
398  return setBackwardSeed(&seed,1);
399 }
400 
401 
402 returnValue Objective::getObjectiveValue( double &objectiveValue ){
403 
404  double obj;
405 
406  returnValue returnvalue;
407  uint run1;
408 
409  objectiveValue = 0.0;
410 
411  for( run1 = 0; run1 < nLSQ; run1++ ){
412  returnvalue = lsqTerm[run1]->getObjectiveValue( obj );
413  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
414  objectiveValue += obj;
415  }
416 
417  for( run1 = 0; run1 < nEndLSQ; run1++ ){
418  returnvalue = lsqEndTerm[run1]->getObjectiveValue( obj );
419  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
420  objectiveValue += obj;
421  }
422 
423  for( run1 = 0; run1 < nMayer; run1++ ){
424  returnvalue = mayerTerm[run1]->getObjectiveValue( obj );
425  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
426  objectiveValue += obj;
427  }
428 
429  return SUCCESSFUL_RETURN;
430 }
431 
432 
434 
435  BlockMatrix DD, *sum;
436 
437  returnValue returnvalue;
438  uint run1;
439 
440  sum = 0;
441 
442  for( run1 = 0; run1 < nLSQ; run1++ ){
443  returnvalue = lsqTerm[run1]->getForwardSensitivities( &DD, order );
444  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
445  if( sum != 0 ) sum[0] += DD;
446  else sum = new BlockMatrix(DD);
447  }
448 
449  for( run1 = 0; run1 < nEndLSQ; run1++ ){
450  returnvalue = lsqEndTerm[run1]->getForwardSensitivities( &DD, order );
451  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
452  if( sum != 0 ) sum[0] += DD;
453  else sum = new BlockMatrix(DD);
454  }
455 
456  for( run1 = 0; run1 < nMayer; run1++ ){
457  returnvalue = mayerTerm[run1]->getForwardSensitivities( &DD, order );
458  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
459  if( sum != 0 ) sum[0] += DD;
460  else sum = new BlockMatrix(DD);
461  }
462 
463  if( sum != 0 ){
464  D = sum[0];
465  delete sum;
466  }
467 
468  return SUCCESSFUL_RETURN;
469 }
470 
471 
473 
474  BlockMatrix DD, *sum;
475 
476  returnValue returnvalue;
477  uint run1;
478 
479  sum = 0;
480 
481  for( run1 = 0; run1 < nLSQ; run1++ ){
482  returnvalue = lsqTerm[run1]->getBackwardSensitivities( &DD, order );
483  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
484  if( sum != 0 ) sum[0] += DD;
485  else sum = new BlockMatrix(DD);
486  }
487 
488  for( run1 = 0; run1 < nEndLSQ; run1++ ){
489  returnvalue = lsqEndTerm[run1]->getBackwardSensitivities( &DD, order );
490  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
491  if( sum != 0 ) sum[0] += DD;
492  else sum = new BlockMatrix(DD);
493  }
494 
495  for( run1 = 0; run1 < nMayer; run1++ ){
496  returnvalue = mayerTerm[run1]->getBackwardSensitivities( &DD, order );
497  if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
498  if( sum != 0 ) sum[0] += DD;
499  else sum = new BlockMatrix(DD);
500  }
501 
502  if( sum != 0 ){
503  D = sum[0];
504  delete sum;
505  }
506 
507  return SUCCESSFUL_RETURN;
508 }
509 
510 
511 returnValue Objective::init( const int nStages ,
512  const int nTransitions,
513  DifferentialEquation **fcn ,
514  Transition *transitions ,
515  Constraint *constraint_ ){
516 
517  if( lagrangeFcn != 0 ){
518 
519  int run1;
520 
521  if( fcn == 0 ){
522  fcn = new DifferentialEquation*[nStages];
523  for( run1 = 0; run1 < nStages; run1++ )
524  fcn[run1] = new DifferentialEquation();
525  }
526 
527  DifferentialState xAugment;
528 
529  for( run1 = 0; run1 < nTransitions; run1++ )
530  transitions[run1] << xAugment == xAugment;
531 
532  for( run1 = 0; run1 < nStages; run1++ ){
533 
534  if( fcn[run1]->isDiscretized() == BT_FALSE ){
535  if( nLagrangeTerms == 1 ){
536  fcn[run1][0] << dot( xAugment ) == *lagrangeFcn[0];
537  }
538  else{
539  if( lagrangeFcn[run1] == 0 ) return ACADOERROR(RET_MEMBER_NOT_INITIALISED);
540  fcn[run1][0] << dot( xAugment ) == (*lagrangeFcn[run1]);
541  }
542  }
543  else{
544  if( nLagrangeTerms == 1 ){
545 
546  Expression tmp = xAugment + fcn[run1]->getStepLength()*(*lagrangeFcn[0]);
547 
548  fcn[run1][0] << next( xAugment ) == tmp;
549  }
550  else{
551  if( lagrangeFcn[run1] == 0 ) return ACADOERROR(RET_MEMBER_NOT_INITIALISED);
552 
553  Expression tmp = xAugment + fcn[run1]->getStepLength()*(*lagrangeFcn[run1]);
554 
555  fcn[run1][0] << next( xAugment ) == tmp;
556  }
557  }
558  }
559 
560  constraint_[0].add(0, 0.0, xAugment, 0.0);
561 
562  nMayer++;
563  mayerTerm = (MayerTerm**)realloc(mayerTerm,nMayer*sizeof(MayerTerm*));
564  mayerTerm[nMayer-1] = new MayerTerm(grid, xAugment );
565  }
566 
567  return SUCCESSFUL_RETURN;
568 }
569 
570 
572 
573  if( nLSQ == 0 && nEndLSQ == 0 && nMayer == 0 && lagrangeFcn == 0 )
574  return BT_TRUE;
575 
576  return BT_FALSE;
577 }
578 
580 {
581  _elements = cgLsqElements;
582 
583  return SUCCESSFUL_RETURN;
584 }
585 
587 {
588  _elements = cgLsqEndTermElements;
589 
590  return SUCCESSFUL_RETURN;
591 }
592 
594 {
595  _elements = cgExternLsqElements;
596 
597  return SUCCESSFUL_RETURN;
598 }
599 
601 {
602  _elements = cgExternLsqEndTermElements;
603 
604  return SUCCESSFUL_RETURN;
605 }
606 
608 {
609  _elements = cgLsqLinearElements;
610 
611  return SUCCESSFUL_RETURN;
612 }
613 
615 {
616 
617  return nMayer;
618 }
619 
621 {
622  mayerTerm[index]->getFunction(_mayerTerm);
623 
624  return SUCCESSFUL_RETURN;
625 }
626 
628 {
629 
630  return nLagrangeTerms;
631 }
632 
634 {
635  _lagrangeTerm << *lagrangeFcn[index];
636 
637  return SUCCESSFUL_RETURN;
638 }
639 
640 //
641 // Code generation related functions
642 //
643 
645 {
646  cgLsqElements.push_back(LsqData(S, h));
647 
648  return SUCCESSFUL_RETURN;
649 }
650 
652 {
653  cgLsqEndTermElements.push_back(LsqData(S, h));
654 
655  return SUCCESSFUL_RETURN;
656 }
657 
658 returnValue Objective::addLSQ(const DMatrix& S, const std::string& h)
659 {
660  cgExternLsqElements.push_back(LsqExternData(S, h));
661 
662  return SUCCESSFUL_RETURN;
663 }
664 
665 returnValue Objective::addLSQEndTerm(const DMatrix& S, const std::string& h)
666 {
667  cgExternLsqEndTermElements.push_back(LsqExternData(S, h));
668 
669  return SUCCESSFUL_RETURN;
670 }
671 
673 {
674  cgLsqElements.push_back(LsqData(S.cast<double>(), h, false));
675 
676  return SUCCESSFUL_RETURN;
677 }
678 
680 {
681  cgLsqEndTermElements.push_back(LsqData(S.cast<double>(), h, false));
682 
683  return SUCCESSFUL_RETURN;
684 }
685 
686 returnValue Objective::addLSQ(const BMatrix& S, const std::string& h)
687 {
688  cgExternLsqElements.push_back(LsqExternData(S.cast<double>(), h, false));
689 
690  return SUCCESSFUL_RETURN;
691 }
692 
693 returnValue Objective::addLSQEndTerm(const BMatrix& S, const std::string& h)
694 {
695  cgExternLsqEndTermElements.push_back(LsqExternData(S.cast<double>(), h, false));
696 
697  return SUCCESSFUL_RETURN;
698 }
699 
701 {
702  cgLsqLinearElements.push_back( LsqLinearData(Slx, Slu, true) );
703 
704  return SUCCESSFUL_RETURN;
705 }
706 
708 {
709  cgLsqLinearElements.push_back( LsqLinearData(Slx.cast<double>(), Slu.cast<double>(), false) );
710 
711  return SUCCESSFUL_RETURN;
712 }
713 
715 
716 // end of file.
returnValue getLSQLinearTerms(LsqLinearElements &_elements) const
Definition: objective.cpp:607
virtual double getStepLength() const
uint getNumLagrangeTerms() const
Definition: objective.cpp:627
virtual returnValue setUnitBackwardSeed()
Definition: objective.cpp:394
Data class for storing generic optimization variables.
Definition: ocp_iterate.hpp:57
Implements a very rudimentary block sparse matrix class.
Allows to setup and evaluate a general function based on SymbolicExpressions.
Definition: function_.hpp:59
LSQTerm ** lsqTerm
Definition: objective.hpp:471
returnValue getLSQEndTerms(LsqElements &_elements) const
Definition: objective.cpp:586
bool isPositiveSemiDefinite() const
Definition: matrix.cpp:173
std::vector< LsqLinearData > LsqLinearElements
Definition: objective.hpp:98
returnValue evaluateSensitivities(BlockMatrix *hessian)
Definition: mayer_term.cpp:93
virtual returnValue getBackwardSensitivities(BlockMatrix *D, int order)
BooleanType isEmpty() const
Definition: objective.cpp:571
Stores and evaluates Mayer terms within optimal control problems.
Definition: mayer_term.hpp:57
Stores and evaluates the constraints of optimal control problems.
Definition: constraint.hpp:60
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
returnValue evaluateSensitivitiesGN(BlockMatrix *GNhessian)
returnValue addLSQLinearTerms(const DVector &Slx, const DVector &Slu)
Definition: objective.cpp:700
returnValue addLSQ(const MatrixVariablesGrid *S_, const Function &h, const VariablesGrid *r_)
Definition: objective.cpp:155
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
Allows to conveniently handle (one-dimensional) grids consisting of time points.
Definition: grid.hpp:58
LsqExternElements cgExternLsqElements
Definition: objective.hpp:482
LsqExternElements cgExternLsqEndTermElements
Definition: objective.hpp:483
returnValue evaluateSensitivitiesGN(BlockMatrix &hessian)
Definition: objective.cpp:319
#define CLOSE_NAMESPACE_ACADO
returnValue evaluateSensitivitiesGN(BlockMatrix *GNhessian)
uint nEndLSQ
Definition: objective.hpp:476
virtual returnValue getObjectiveValue(double &objectiveValue)
Definition: objective.cpp:402
#define ACADO_TRY(X)
returnValue add(const double lb_, const Expression &arg, const double ub_)
Definition: constraint.cpp:194
Base class for all variables within the symbolic expressions family.
Definition: expression.hpp:56
LsqElements cgLsqEndTermElements
Definition: objective.hpp:480
Stores and evaluates LSQ mayer terms within optimal control problems.
returnValue evaluateSensitivities(BlockMatrix *hessian)
Provides a time grid consisting of matrix-valued optimization variables at each grid point...
returnValue evaluateSensitivities(BlockMatrix *hessian)
virtual returnValue getForwardSensitivities(BlockMatrix &D, int order)
Definition: objective.cpp:433
uint getNumMayerTerms() const
Definition: objective.cpp:614
returnValue setGrid(const Grid &grid_)
std::vector< LsqData > LsqElements
Definition: objective.hpp:62
returnValue addLSQEndTerm(const DMatrix &S, const Function &m, const DVector &r)
Definition: objective.cpp:175
virtual returnValue setForwardSeed(BlockMatrix *xSeed_, BlockMatrix *xaSeed_, BlockMatrix *pSeed_, BlockMatrix *uSeed_, BlockMatrix *wSeed_, int order)
Definition: objective.cpp:341
Expression ** lagrangeFcn
uint nMayer
Definition: objective.hpp:477
returnValue getMayerTerm(uint index, Function &mayerTerm) const
Definition: objective.cpp:620
void rhs(const real_t *x, real_t *f)
Expression dot(const Expression &arg)
DMatrix getMatrix(uint pointIdx) const
returnValue evaluate(const OCPiterate &x)
Definition: objective.cpp:254
#define BT_TRUE
Definition: acado_types.hpp:47
LSQEndTerm ** lsqEndTerm
Definition: objective.hpp:472
virtual returnValue getObjectiveValue(double &objectiveValue)
returnValue init(const Grid &grid_)
Definition: objective.cpp:77
Allows to setup and evaluate transition functions based on SymbolicExpressions.
Definition: transition.hpp:53
LsqLinearElements cgLsqLinearElements
Definition: objective.hpp:485
returnValue evaluateSensitivities()
Definition: objective.cpp:271
virtual returnValue setBackwardSeed(BlockMatrix *seed, int order)
Definition: objective.cpp:370
returnValue setGrid(const Grid &grid_)
MayerTerm ** mayerTerm
Definition: objective.hpp:473
Expression next(const Expression &arg)
returnValue setZero(uint rowIdx, uint colIdx)
std::vector< LsqExternData > LsqExternElements
Definition: objective.hpp:81
returnValue getLagrangeTerm(uint index, Function &lagrangeTerm) const
Definition: objective.cpp:633
Stores and evaluates Lagrange terms within optimal control problems.
#define BEGIN_NAMESPACE_ACADO
#define BT_FALSE
Definition: acado_types.hpp:49
Stores and evaluates LSQ terms within optimal control problems.
Definition: lsq_term.hpp:61
virtual returnValue setForwardSeed(BlockMatrix *xSeed_, BlockMatrix *xaSeed_, BlockMatrix *pSeed_, BlockMatrix *uSeed_, BlockMatrix *wSeed_, int order)
Objective & operator=(const Objective &rhs)
Definition: objective.cpp:190
returnValue init(const Grid &grid_)
virtual returnValue setBackwardSeed(BlockMatrix *seed, int order)
virtual ~Objective()
Definition: objective.cpp:124
returnValue getFunction(Function &_function)
LagrangeTerm & operator=(const LagrangeTerm &rhs)
virtual returnValue getBackwardSensitivities(BlockMatrix &D, int order)
Definition: objective.cpp:472
returnValue setIdentity(uint rowIdx, uint colIdx, uint dim)
LsqElements cgLsqElements
Definition: objective.hpp:479
virtual returnValue getForwardSensitivities(BlockMatrix *D, int order)
Stores and evaluates the objective function of optimal control problems.
Definition: objective.hpp:123
returnValue getLSQTerms(LsqElements &_elements) const
Definition: objective.cpp:579
#define ACADOERROR(retval)
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.


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