Miiilad / SOL-Python-toolbox

This is a toolbox for a Model-based Reinforcement learning technique
4 stars 2 forks source link

Some small code issues #1

Open cexuzheng opened 1 year ago

cexuzheng commented 1 year ago

Hi, I found your work in the Model-Based Reinforcement Learning book along with this pyhton toolbox very interesting. However, while executing the code I have found some minor issues.

  1. In the MBRLtool.py file, in the Class Objective, you missed writing the self.Q and self.R for the stage cost function
  2. In the SysID class, in the update function for the RLS, you call utils.RLS instead of utils.identification_RLS
  3. In the utils.identification_RLS, the equations didn't work quite right, so I made some modifications:

def identification_RLS(W,S,dXdt,Theta,forget_factor=0.9): g=np.matmul(S,Theta)/(forget_factor+np.matmul(np.matmul(Theta.T,S),Theta)) S=(1/forget_factor)*(S-np.matmul(g.reshape(S.shape[0],1),np.matmul(Theta.T,S).reshape(1,S.shape[0])) ) W=W+np.matmul( (dXdt-np.matmul(W,Theta)).reshape(len(dXdt),1) ,np.matmul(Theta.T, S).reshape(1,len(Theta))) return [W,S]

  1. I might suggest to improve the definition of the SysID class by choosing the desired lam factor for the SINDy algorithm.

Hope this can help and share better your fabulous work.

I also had some questions about the Quadrotor example, could you introduce me the parameters that you used to get those examples of the book? I found the very interesting, but didn't quite got them so quickly and stable.

Thank a lot

Ce Xu

Miiilad commented 1 year ago

Hi, I found your work in the Model-Based Reinforcement Learning book along with this pyhton toolbox very interesting. However, while executing the code I have found some minor issues.

  1. In the MBRLtool.py file, in the Class Objective, you missed writing the self.Q and self.R for the stage cost function
  2. In the SysID class, in the update function for the RLS, you call utils.RLS instead of utils.identification_RLS
  3. In the utils.identification_RLS, the equations didn't work quite right, so I made some modifications:

def identification_RLS(W,S,dXdt,Theta,forget_factor=0.9): g=np.matmul(S,Theta)/(forget_factor+np.matmul(np.matmul(Theta.T,S),Theta)) S=(1/forget_factor)*(S-np.matmul(g.reshape(S.shape[0],1),np.matmul(Theta.T,S).reshape(1,S.shape[0])) ) W=W+np.matmul( (dXdt-np.matmul(W,Theta)).reshape(len(dXdt),1) ,np.matmul(Theta.T, S).reshape(1,len(Theta))) return [W,S]

  1. I might suggest to improve the definition of the SysID class by choosing the desired lam factor for the SINDy algorithm.

Hope this can help and share better your fabulous work.

I also had some questions about the Quadrotor example, could you introduce me the parameters that you used to get those examples of the book? I found the very interesting, but didn't quite got them so quickly and stable.

Thank a lot

Ce Xu

Hi Ce Xu,

Thank you for your interest and feedback.

I hope this helps to answer your questions, and again, thanks for your comments.

Milad