ocp_iterate.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 
34 #ifndef ACADO_TOOLKIT_OCP_ITERATE_HPP
35 #define ACADO_TOOLKIT_OCP_ITERATE_HPP
36 
39 
40 
42 
43 
57 class OCPiterate{
58 
59 
60  //
61  // PUBLIC MEMBER FUNCTIONS:
62  //
63  public:
64 
66  OCPiterate( );
67 
68  OCPiterate( const VariablesGrid* const _x,
69  const VariablesGrid* const _xa,
70  const VariablesGrid* const _p,
71  const VariablesGrid* const _u,
72  const VariablesGrid* const _w
73  );
74 
76  OCPiterate( const OCPiterate& rhs );
77 
79  virtual ~OCPiterate( );
80 
82  OCPiterate& operator=( const OCPiterate& rhs );
83 
84 
86 
87  returnValue init( const VariablesGrid* const _x,
88  const VariablesGrid* const _xa,
89  const VariablesGrid* const _p,
90  const VariablesGrid* const _u,
91  const VariablesGrid* const _w
92  );
93 
94  returnValue clear( );
95 
97  //OCPiterate& operator+=( const OCPiterate& rhs );
98 
99 
101  inline uint getNX( ) const;
102 
104  inline uint getNXA( ) const;
105 
107  inline uint getNP( ) const;
108 
110  inline uint getNU( ) const;
111 
113  inline uint getNW( ) const;
114 
115 
116  uint getNumPoints( ) const;
117 
118 
119  returnValue print( ) const;
120 
121  inline double getTime( const uint &idx ) const;
122 
123  inline DVector getX ( const uint &idx ) const;
124  inline DVector getXA ( const uint &idx ) const;
125  inline DVector getP ( const uint &idx ) const;
126  inline DVector getU ( const uint &idx ) const;
127  inline DVector getW ( const uint &idx ) const;
128 
129 
130  inline Grid getGrid() const;
131 
132 
137  Grid getUnionGrid( ) const;
138 
139 
141 
142 
144  DVector &xa_ = emptyVector,
145  DVector &p_ = emptyVector,
146  DVector &u_ = emptyVector,
147  DVector &w_ = emptyVector ) const;
148 
149 
150  returnValue updateData( double t ,
151  DVector &x_ = emptyVector,
152  DVector &xa_ = emptyVector,
153  DVector &p_ = emptyVector,
154  DVector &u_ = emptyVector,
155  DVector &w_ = emptyVector );
156 
157 
158  returnValue applyStep( const BlockMatrix& bm,
159  double alpha
160  );
161 
162 
164 
165  inline BooleanType isInSimulationMode( ) const;
166 
167 
173  virtual returnValue shift( double timeShift = -1.0,
174  DVector lastX = emptyVector,
175  DVector lastXA = emptyVector,
176  DVector lastP = emptyVector,
177  DVector lastU = emptyVector,
178  DVector lastW = emptyVector );
179 
180 
181  //
182  // PUBLIC DATA MEMBERS:
183  //
184  public:
185 
186  VariablesGrid *x ; // the differential state variables
187  VariablesGrid *xa; // the algebraic state variables
188  VariablesGrid *p ; // the parameter
189  VariablesGrid *u ; // the control variables
190  VariablesGrid *w ; // the disturbances
191 
192 
193 
194  // PROTECTED MEMBER FUNCTIONS:
195  // ---------------------------
196  protected:
197 
198  void copy (const OCPiterate& rhs);
199 
200  inline DVector copy ( const VariablesGrid *z, const uint &idx ) const;
201 
202  inline uint getDim( VariablesGrid *z ) const;
203 
204 
205  void update( double t, VariablesGrid &z1, DVector &z2 ) const;
206 
207 
208  //
209  // PUBLIC DATA MEMBERS:
210  //
211  protected:
212 
214 };
215 
216 
218 
219 
220 #include <acado/function/ocp_iterate.ipp>
221 
222 #endif // ACADO_TOOLKIT_OCP_ITERATE_HPP
223 
224 /*
225  * end of file
226  */
Data class for storing generic optimization variables.
Definition: ocp_iterate.hpp:57
Implements a very rudimentary block sparse matrix class.
VariablesGrid * x
uint getNX() const
VariablesGrid * u
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
returnValue allocateAll()
Definition: ocp_iterate.cpp:92
DVector getW(const uint &idx) const
virtual ~OCPiterate()
Definition: ocp_iterate.cpp:75
DVector getX(const uint &idx) const
DVector getXA(const uint &idx) const
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
returnValue updateData(double t, DVector &x_=emptyVector, DVector &xa_=emptyVector, DVector &p_=emptyVector, DVector &u_=emptyVector, DVector &w_=emptyVector)
returnValue init(const VariablesGrid *const _x, const VariablesGrid *const _xa, const VariablesGrid *const _p, const VariablesGrid *const _u, const VariablesGrid *const _w)
Allows to conveniently handle (one-dimensional) grids consisting of time points.
Definition: grid.hpp:58
void copy(const OCPiterate &rhs)
uint getNP() const
uint getNU() const
#define CLOSE_NAMESPACE_ACADO
uint getNumPoints() const
returnValue clear()
DVector getP(const uint &idx) const
VariablesGrid * xa
DVector getU(const uint &idx) const
uint getNW() const
returnValue enableSimulationMode()
Grid getUnionGrid() const
returnValue getInitialData(DVector &x_=emptyVector, DVector &xa_=emptyVector, DVector &p_=emptyVector, DVector &u_=emptyVector, DVector &w_=emptyVector) const
OCPiterate & operator=(const OCPiterate &rhs)
Definition: ocp_iterate.cpp:81
returnValue applyStep(const BlockMatrix &bm, double alpha)
void update(double t, VariablesGrid &z1, DVector &z2) const
void rhs(const real_t *x, real_t *f)
uint getDim(VariablesGrid *z) const
VariablesGrid * p
BooleanType inSimulationMode
virtual returnValue shift(double timeShift=-1.0, DVector lastX=emptyVector, DVector lastXA=emptyVector, DVector lastP=emptyVector, DVector lastU=emptyVector, DVector lastW=emptyVector)
Grid getGrid() const
BooleanType areGridsConsistent()
uint getNXA() const
static DVector emptyVector
Definition: vector.hpp:335
VariablesGrid * w
#define BEGIN_NAMESPACE_ACADO
returnValue print() const
double getTime(const uint &idx) const
BooleanType isInSimulationMode() const


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