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>
8 {
9 public:
10  typedef Eigen::Matrix<precision,stateSize,1> stateVec_t; // 1 x stateSize
11  typedef Eigen::Matrix<precision,1,stateSize> stateVecTrans_t; // 1 x stateSize
12  typedef Eigen::Matrix<precision,stateSize,stateSize> stateMat_t; // stateSize x stateSize
13  typedef Eigen::Matrix<precision,stateSize,stateSize> stateTens_t[stateSize]; // stateSize x stateSize x stateSize
14 
15  // typedef for commandSize types
16  typedef Eigen::Matrix<precision,commandSize,1> commandVec_t; // commandSize x 1
17  typedef Eigen::Matrix<precision,1,commandSize> commandVecTrans_t; // 1 x commandSize
18  typedef Eigen::Matrix<precision,commandSize,commandSize> commandMat_t; // commandSize x commandSize
19  typedef Eigen::Matrix<precision,commandSize,commandSize> commandTens_t[commandSize]; // stateSize x commandSize x commandSize
20 
21 
22 
23  // typedef for mixed stateSize and commandSize types
24  typedef Eigen::Matrix<precision,stateSize,commandSize> stateR_commandC_t; // stateSize x commandSize
25  typedef Eigen::Matrix<precision,stateSize,commandSize> stateR_commandC_stateD_t[stateSize]; // stateSize x commandSize x stateSize
26  typedef Eigen::Matrix<precision,stateSize,commandSize> stateR_commandC_commandD_t[commandSize]; // stateSize x commandSize x commandSize
27  typedef Eigen::Matrix<precision,commandSize,stateSize> commandR_stateC_t; // commandSize x stateSize
28  typedef Eigen::Matrix<precision,commandSize,stateSize> commandR_stateC_stateD_t[stateSize]; // commandSize x stateSize x stateSize
29  typedef Eigen::Matrix<precision,commandSize,stateSize> commandR_stateC_commandD_t[commandSize]; // commandSize x stateSize x commandSize
30  typedef Eigen::Matrix<precision,stateSize,stateSize> stateR_stateC_commandD_t[commandSize]; // stateSize x stateSize x commandSize
31  typedef Eigen::Matrix<precision,commandSize,commandSize> commandR_commandC_stateD_t[stateSize]; // commandSize x commandSize x stateSize
32 
33  // constructors //
34 public:
35  // attributes //
36 public:
37 protected:
38  unsigned int stateNb;
39  unsigned int commandNb;
40  double dt;
41 
42  commandVec_t lowerCommandBounds;
43  commandVec_t upperCommandBounds;
44 
45  stateMat_t fx;
46  stateTens_t fxx;
47  stateR_commandC_t fu;
48  stateR_commandC_commandD_t fuu;
49  stateR_stateC_commandD_t fxu;
50  stateR_commandC_stateD_t fux;
51 public:
52 
53 
54 protected:
55 
56 
57  // methods //
58 public:
59  virtual stateVec_t computeNextState(double& dt, const stateVec_t& X,const commandVec_t& U)=0;
60  virtual void computeModelDeriv(double& dt, const stateVec_t& X,const commandVec_t& U)=0;
61  virtual stateMat_t computeTensorContxx(const stateVec_t& nextVx)=0;
62  virtual commandMat_t computeTensorContuu(const stateVec_t& nextVx)=0;
63  virtual commandR_stateC_t computeTensorContux(const stateVec_t& nextVx)=0;
64 private:
65 protected:
66  // accessors //
67 public:
68  unsigned int getStateNb() {return stateNb;}
69  unsigned int getCommandNb() {return commandNb;}
70  commandVec_t& getLowerCommandBounds() {return lowerCommandBounds;}
71  commandVec_t& getUpperCommandBounds() {return upperCommandBounds;}
72  stateMat_t& getfx() {return fx;}
73  stateTens_t& getfxx() {return fxx;}
74  stateR_commandC_t &getfu() {return fu;}
75  stateR_commandC_commandD_t& getfuu() {return fuu;}
76  stateR_stateC_commandD_t& getfxu() {return fxu;}
77  stateR_commandC_stateD_t& getfux() {return fux;}
78 };
79 
80 #endif // DYNAMICMODEL_H
Eigen::Matrix< precision, commandSize, commandSize > commandR_commandC_stateD_t[stateSize]
Definition: dynamicmodel.hh:31
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_t
Definition: dynamicmodel.hh:24
stateTens_t & getfxx()
Definition: dynamicmodel.hh:73
Definition: dynamicmodel.hh:7
unsigned int stateNb
Definition: dynamicmodel.hh:38
double dt
Definition: dynamicmodel.hh:40
unsigned int commandNb
Definition: dynamicmodel.hh:39
Eigen::Matrix< precision, 1, commandSize > commandVecTrans_t
Definition: dynamicmodel.hh:17
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_stateD_t[stateSize]
Definition: dynamicmodel.hh:28
virtual void computeModelDeriv(double &dt, const stateVec_t &X, const commandVec_t &U)=0
stateR_stateC_commandD_t & getfxu()
Definition: dynamicmodel.hh:76
Eigen::Matrix< precision, stateSize, 1 > stateVec_t
Definition: dynamicmodel.hh:10
stateR_commandC_t & getfu()
Definition: dynamicmodel.hh:74
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_commandD_t[commandSize]
Definition: dynamicmodel.hh:26
commandVec_t & getLowerCommandBounds()
Definition: dynamicmodel.hh:70
stateR_commandC_stateD_t & getfux()
Definition: dynamicmodel.hh:77
Eigen::Matrix< precision, commandSize, commandSize > commandTens_t[commandSize]
Definition: dynamicmodel.hh:19
virtual stateMat_t computeTensorContxx(const stateVec_t &nextVx)=0
commandVec_t lowerCommandBounds
Definition: dynamicmodel.hh:42
commandVec_t & getUpperCommandBounds()
Definition: dynamicmodel.hh:71
commandVec_t upperCommandBounds
Definition: dynamicmodel.hh:43
stateR_commandC_stateD_t fux
Definition: dynamicmodel.hh:50
stateMat_t fx
Definition: dynamicmodel.hh:45
Eigen::Matrix< precision, stateSize, stateSize > stateTens_t[stateSize]
Definition: dynamicmodel.hh:13
virtual commandMat_t computeTensorContuu(const stateVec_t &nextVx)=0
stateR_stateC_commandD_t fxu
Definition: dynamicmodel.hh:49
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_stateD_t[stateSize]
Definition: dynamicmodel.hh:25
Eigen::Matrix< precision, 1, stateSize > stateVecTrans_t
Definition: dynamicmodel.hh:11
Eigen::Matrix< precision, commandSize, 1 > commandVec_t
Definition: dynamicmodel.hh:16
unsigned int getCommandNb()
Definition: dynamicmodel.hh:69
stateMat_t & getfx()
Definition: dynamicmodel.hh:72
stateR_commandC_commandD_t fuu
Definition: dynamicmodel.hh:48
Eigen::Matrix< precision, stateSize, stateSize > stateMat_t
Definition: dynamicmodel.hh:12
unsigned int getStateNb()
Definition: dynamicmodel.hh:68
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_commandD_t[commandSize]
Definition: dynamicmodel.hh:29
stateR_commandC_t fu
Definition: dynamicmodel.hh:47
virtual stateVec_t computeNextState(double &dt, const stateVec_t &X, const commandVec_t &U)=0
Eigen::Matrix< precision, stateSize, stateSize > stateR_stateC_commandD_t[commandSize]
Definition: dynamicmodel.hh:30
virtual commandR_stateC_t computeTensorContux(const stateVec_t &nextVx)=0
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_t
Definition: dynamicmodel.hh:27
stateTens_t fxx
Definition: dynamicmodel.hh:46
Eigen::Matrix< precision, commandSize, commandSize > commandMat_t
Definition: dynamicmodel.hh:18
stateR_commandC_commandD_t & getfuu()
Definition: dynamicmodel.hh:75