dynamicmodel.hh
Go to the documentation of this file.
1 #ifndef DYNAMICMODEL_H
2 #define DYNAMICMODEL_H
3 
4 #include <Eigen/Core>
5 
6 template <typename precision, int stateSize, int commandSize>
7 class DynamicModel {
8  public:
9  typedef Eigen::Matrix<precision, stateSize, 1> stateVec_t; // 1 x stateSize
10  typedef Eigen::Matrix<precision, 1, stateSize>
11  stateVecTrans_t; // 1 x stateSize
12  typedef Eigen::Matrix<precision, stateSize, stateSize>
13  stateMat_t; // stateSize x stateSize
14  typedef Eigen::Matrix<precision, stateSize, stateSize>
15  stateTens_t[stateSize]; // stateSize x stateSize x stateSize
16 
17  // typedef for commandSize types
18  typedef Eigen::Matrix<precision, commandSize, 1>
19  commandVec_t; // commandSize x 1
20  typedef Eigen::Matrix<precision, 1, commandSize>
21  commandVecTrans_t; // 1 x commandSize
22  typedef Eigen::Matrix<precision, commandSize, commandSize>
23  commandMat_t; // commandSize x commandSize
24  typedef Eigen::Matrix<precision, commandSize, commandSize>
25  commandTens_t[commandSize]; // stateSize x commandSize x commandSize
26 
27  // typedef for mixed stateSize and commandSize types
28  typedef Eigen::Matrix<precision, stateSize, commandSize>
29  stateR_commandC_t; // stateSize x commandSize
30  typedef Eigen::Matrix<precision, stateSize, commandSize>
31  stateR_commandC_stateD_t[stateSize]; // stateSize x commandSize x
32  // stateSize
33  typedef Eigen::Matrix<precision, stateSize, commandSize>
34  stateR_commandC_commandD_t[commandSize]; // stateSize x commandSize x
35  // commandSize
36  typedef Eigen::Matrix<precision, commandSize, stateSize>
37  commandR_stateC_t; // commandSize x stateSize
38  typedef Eigen::Matrix<precision, commandSize, stateSize>
39  commandR_stateC_stateD_t[stateSize]; // commandSize x stateSize x
40  // stateSize
41  typedef Eigen::Matrix<precision, commandSize, stateSize>
42  commandR_stateC_commandD_t[commandSize]; // commandSize x stateSize x
43  // commandSize
44  typedef Eigen::Matrix<precision, stateSize, stateSize>
45  stateR_stateC_commandD_t[commandSize]; // stateSize x stateSize x
46  // commandSize
47  typedef Eigen::Matrix<precision, commandSize, commandSize>
48  commandR_commandC_stateD_t[stateSize]; // commandSize x commandSize x
49  // stateSize
50 
51  // constructors //
52  public:
53  // attributes //
54  public:
55  protected:
56  unsigned int stateNb;
57  unsigned int commandNb;
58  double dt;
59 
62 
69 
70  public:
71  protected:
72  // methods //
73  public:
74  virtual stateVec_t computeNextState(double& dt, const stateVec_t& X,
75  const commandVec_t& U) = 0;
76  virtual void computeModelDeriv(double& dt, const stateVec_t& X,
77  const commandVec_t& U) = 0;
78  virtual stateMat_t computeTensorContxx(const stateVec_t& nextVx) = 0;
79  virtual commandMat_t computeTensorContuu(const stateVec_t& nextVx) = 0;
80  virtual commandR_stateC_t computeTensorContux(const stateVec_t& nextVx) = 0;
81 
82  private:
83  protected:
84  // accessors //
85  public:
86  unsigned int getStateNb() { return stateNb; }
87  unsigned int getCommandNb() { return commandNb; }
90  stateMat_t& getfx() { return fx; }
91  stateTens_t& getfxx() { return fxx; }
92  stateR_commandC_t& getfu() { return fu; }
96 };
97 
98 #endif // DYNAMICMODEL_H
Definition: dynamicmodel.hh:7
unsigned int getStateNb()
Definition: dynamicmodel.hh:86
stateR_commandC_stateD_t fux
Definition: dynamicmodel.hh:68
virtual commandR_stateC_t computeTensorContux(const stateVec_t &nextVx)=0
stateMat_t fx
Definition: dynamicmodel.hh:63
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_commandD_t[commandSize]
Definition: dynamicmodel.hh:42
commandVec_t lowerCommandBounds
Definition: dynamicmodel.hh:60
Eigen::Matrix< precision, stateSize, 1 > stateVec_t
Definition: dynamicmodel.hh:9
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_stateD_t[stateSize]
Definition: dynamicmodel.hh:39
Eigen::Matrix< precision, 1, stateSize > stateVecTrans_t
Definition: dynamicmodel.hh:11
stateR_commandC_t fu
Definition: dynamicmodel.hh:65
stateR_commandC_commandD_t fuu
Definition: dynamicmodel.hh:66
stateTens_t & getfxx()
Definition: dynamicmodel.hh:91
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_t
Definition: dynamicmodel.hh:29
stateR_commandC_t & getfu()
Definition: dynamicmodel.hh:92
double dt
Definition: dynamicmodel.hh:58
virtual stateVec_t computeNextState(double &dt, const stateVec_t &X, const commandVec_t &U)=0
stateR_stateC_commandD_t & getfxu()
Definition: dynamicmodel.hh:94
Eigen::Matrix< precision, stateSize, stateSize > stateMat_t
Definition: dynamicmodel.hh:13
Eigen::Matrix< precision, commandSize, 1 > commandVec_t
Definition: dynamicmodel.hh:19
Eigen::Matrix< precision, stateSize, stateSize > stateTens_t[stateSize]
Definition: dynamicmodel.hh:15
stateR_stateC_commandD_t fxu
Definition: dynamicmodel.hh:67
commandVec_t upperCommandBounds
Definition: dynamicmodel.hh:61
commandVec_t & getLowerCommandBounds()
Definition: dynamicmodel.hh:88
virtual commandMat_t computeTensorContuu(const stateVec_t &nextVx)=0
virtual void computeModelDeriv(double &dt, const stateVec_t &X, const commandVec_t &U)=0
Eigen::Matrix< precision, 1, commandSize > commandVecTrans_t
Definition: dynamicmodel.hh:21
stateR_commandC_stateD_t & getfux()
Definition: dynamicmodel.hh:95
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_t
Definition: dynamicmodel.hh:37
commandVec_t & getUpperCommandBounds()
Definition: dynamicmodel.hh:89
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_commandD_t[commandSize]
Definition: dynamicmodel.hh:34
Eigen::Matrix< precision, commandSize, commandSize > commandTens_t[commandSize]
Definition: dynamicmodel.hh:25
Eigen::Matrix< precision, commandSize, commandSize > commandMat_t
Definition: dynamicmodel.hh:23
unsigned int getCommandNb()
Definition: dynamicmodel.hh:87
unsigned int commandNb
Definition: dynamicmodel.hh:57
virtual stateMat_t computeTensorContxx(const stateVec_t &nextVx)=0
Eigen::Matrix< precision, stateSize, stateSize > stateR_stateC_commandD_t[commandSize]
Definition: dynamicmodel.hh:45
unsigned int stateNb
Definition: dynamicmodel.hh:56
stateTens_t fxx
Definition: dynamicmodel.hh:64
stateR_commandC_commandD_t & getfuu()
Definition: dynamicmodel.hh:93
stateMat_t & getfx()
Definition: dynamicmodel.hh:90
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_stateD_t[stateSize]
Definition: dynamicmodel.hh:31
Eigen::Matrix< precision, commandSize, commandSize > commandR_commandC_stateD_t[stateSize]
Definition: dynamicmodel.hh:48