variables_grid.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 
33 #ifndef ACADO_TOOLKIT_VARIABLES_GRID_HPP
34 #define ACADO_TOOLKIT_VARIABLES_GRID_HPP
35 
37 
38 
40 
41 
57 {
59  friend class OptimizationAlgorithm;
60  friend class RealTimeAlgorithm;
61 
62  //
63  // PUBLIC MEMBER FUNCTIONS:
64  //
65  public:
66 
69  VariablesGrid( );
70 
85  VariablesGrid( uint _dim,
86  const Grid& _grid,
87  VariableType _type = VT_UNKNOWN,
88  const char** const _names = 0,
89  const char** const _units = 0,
90  const DVector* const _scaling = 0,
91  const DVector* const _lb = 0,
92  const DVector* const _ub = 0,
93  const BooleanType* const _autoInit = 0
94  );
95 
96 
111  VariablesGrid( uint _dim,
112  uint _nPoints,
113  VariableType _type = VT_UNKNOWN,
114  const char** const _names = 0,
115  const char** const _units = 0,
116  const DVector* const _scaling = 0,
117  const DVector* const _lb = 0,
118  const DVector* const _ub = 0,
119  const BooleanType* const _autoInit = 0
120  );
121 
140  VariablesGrid( uint _dim,
141  double _firstTime,
142  double _lastTime,
143  uint _nPoints,
144  VariableType _type = VT_UNKNOWN,
145  const char** const _names = 0,
146  const char** const _units = 0,
147  const DVector* const _scaling = 0,
148  const DVector* const _lb = 0,
149  const DVector* const _ub = 0,
150  const BooleanType* const _autoInit = 0
151  );
152 
161  VariablesGrid( const DVector& arg,
162  const Grid& _grid = trivialGrid,
163  VariableType _type = VT_UNKNOWN
164  );
165 
179  VariablesGrid( const DMatrix& arg,
180  VariableType _type = VT_UNKNOWN
181  );
182 
188  );
189 
195  );
196 
197 
200  ~VariablesGrid( );
201 
202 
208  );
209 
215  );
216 
217  operator DMatrix() const;
218 
231  );
232 
233 
241  inline BooleanType operator==( const VariablesGrid& arg
242  ) const;
243 
251  inline double& operator()( uint pointIdx,
252  uint rowIdx
253  );
254 
262  inline double operator()( uint pointIdx,
263  uint rowIdx
264  ) const;
265 
266 
273  VariablesGrid operator()( const uint rowIdx
274  ) const;
275 
283  VariablesGrid operator[]( const uint pointIdx
284  ) const;
285 
286 
293  inline VariablesGrid operator+( const VariablesGrid& arg
294  ) const;
295 
302  inline VariablesGrid& operator+=( const VariablesGrid& arg
303  );
304 
305 
313  inline VariablesGrid operator-( const VariablesGrid& arg
314  ) const;
315 
322  inline VariablesGrid& operator-=( const VariablesGrid& arg
323  );
324 
325 
330  returnValue init( );
331 
347  returnValue init( uint _dim,
348  const Grid& _grid,
349  VariableType _type = VT_UNKNOWN,
350  const char** const _names = 0,
351  const char** const _units = 0,
352  const DVector* const _scaling = 0,
353  const DVector* const _lb = 0,
354  const DVector* const _ub = 0,
355  const BooleanType* const _autoInit = 0
356  );
357 
374  returnValue init( uint _dim,
375  uint _nPoints,
376  VariableType _type = VT_UNKNOWN,
377  const char** const _names = 0,
378  const char** const _units = 0,
379  const DVector* const _scaling = 0,
380  const DVector* const _lb = 0,
381  const DVector* const _ub = 0,
382  const BooleanType* const _autoInit = 0
383  );
384 
405  returnValue init( uint _dim,
406  double _firstTime,
407  double _lastTime,
408  uint _nPoints,
409  VariableType _type = VT_UNKNOWN,
410  const char** const _names = 0,
411  const char** const _units = 0,
412  const DVector* const _scaling = 0,
413  const DVector* const _lb = 0,
414  const DVector* const _ub = 0,
415  const BooleanType* const _autoInit = 0
416  );
417 
427  returnValue init( const DVector& arg,
428  const Grid& _grid = trivialGrid,
429  VariableType _type = VT_UNKNOWN
430  );
431 
432 
441  returnValue addVector( const DVector& newVector,
442  double newTime = -INFTY
443  );
444 
445 
455  returnValue setVector( uint pointIdx,
456  const DVector& _values
457  );
458 
467  returnValue setAllVectors( const DVector& _values
468  );
469 
470 
477  DVector getVector( uint pointIdx
478  ) const;
479 
484  DVector getFirstVector( ) const;
485 
490  DVector getLastVector( ) const;
491 
492 
503  MergeMethod _mergeMethod = MM_DUPLICATE
504  );
505 
515  returnValue appendTimes( const DMatrix& arg,
516  MergeMethod _mergeMethod = MM_DUPLICATE
517  );
518 
528  );
529 
530 
544  returnValue merge( const VariablesGrid& arg,
545  MergeMethod _mergeMethod = MM_DUPLICATE,
546  BooleanType keepOverlap = BT_TRUE
547  );
548 
549 
559  uint endIdx
560  ) const;
561 
570  VariablesGrid getTimeSubGrid( double startTime,
571  double endTime
572  ) const;
573 
587  uint endIdx
588  ) const;
589 
590 
597  VariablesGrid& shiftTimes( double timeShift
598  );
599 
607 
608 
616  ) const;
617 
626  DVector& value
627  ) const;
628 
629  //
630  // PROTECTED MEMBER FUNCTIONS:
631  //
632  protected:
633 
643 };
644 
646 
647 #include <acado/variables_grid/variables_grid.ipp>
648 
650 
653 
655 
656 #endif // ACADO_TOOLKIT_VARIABLES_GRID_HPP
657 
658 /*
659  * end of file
660  */
VariablesGrid & shiftTimes(double timeShift)
VariablesGrid & shiftBackwards(DVector lastValue=emptyVector)
VariablesGrid & operator=(const VariablesGrid &rhs)
const double INFTY
VariablesGrid operator+(const VariablesGrid &arg) const
User-interface to formulate and solve optimal control problems and static NLPs.
Provides a time grid consisting of vector-valued optimization variables at each grid point...
returnValue getSum(DVector &sum) const
Allows to pass back messages to the calling function.
VariablesGrid getValuesSubGrid(uint startIdx, uint endIdx) const
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
User-interface to formulate and solve model predictive control problems.
#define CLOSE_NAMESPACE_ACADO
Base class for user-interfaces to formulate and solve optimal control problems and static NLPs...
GenericMatrix< double > DMatrix
Definition: matrix.hpp:457
VariableType
Definition: acado_types.hpp:95
returnValue appendValues(const VariablesGrid &arg)
CLOSE_NAMESPACE_ACADO static BEGIN_NAMESPACE_ACADO VariablesGrid emptyVariablesGrid
BooleanType operator==(const VariablesGrid &arg) const
returnValue merge(const VariablesGrid &arg, MergeMethod _mergeMethod=MM_DUPLICATE, BooleanType keepOverlap=BT_TRUE)
returnValue setVector(uint pointIdx, const DVector &_values)
Provides a time grid consisting of matrix-valued optimization variables at each grid point...
VariablesGrid & operator-=(const VariablesGrid &arg)
returnValue addVector(const DVector &newVector, double newTime=-INFTY)
DVector getFirstVector() const
returnValue setAllVectors(const DVector &_values)
VariablesGrid & operator+=(const VariablesGrid &arg)
DVector getLastVector() const
VariablesGrid getTimeSubGrid(uint startIdx, uint endIdx) const
returnValue init()
returnValue appendTimes(const VariablesGrid &arg, MergeMethod _mergeMethod=MM_DUPLICATE)
const Grid trivialGrid(1)
void rhs(const real_t *x, real_t *f)
#define BT_TRUE
Definition: acado_types.hpp:47
VariablesGrid operator[](const uint pointIdx) const
returnValue initializeFromBounds()
DVector getVector(uint pointIdx) const
static DVector emptyVector
Definition: vector.hpp:335
#define BEGIN_NAMESPACE_ACADO
double & operator()(uint pointIdx, uint rowIdx)
MergeMethod
returnValue getIntegral(InterpolationMode mode, DVector &value) const
static const VariablesGrid emptyConstVariablesGrid
InterpolationMode
VariablesGrid operator-(const VariablesGrid &arg) const


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