How to represent the actions when setting the reward in GridWorld?
4 次查看(过去 30 天)
显示 更早的评论
I am learning to use the reinforcement learning toolbox. I try to creat a custom grid world environment. But i have some problem with how to set the Rewards . When using "GW.R" , how to represent the actions?
Like this:
GW.R(state2idx(GW,GW.CurrentState),:,state2idx(GW,GW.Actions.NE)) = -14;
GW.R(state2idx(GW,GW.CurrentState),:,'NW') = -14;
GW.R(state2idx(GW,GW.CurrentState),:,GW.Actions.SE) = -14;
GW.R(state2idx(GW,GW.CurrentState),:,GW.Actions.SW) = -14;
0 个评论
回答(1 个)
Poorna
2023-8-30
Hi,
I understand that you would like to know the right syntax of representing the action while setting the reward for a transition. You could use the function action2idx to specify the action.
You could set the required reward as below:
GW.R(state2idx(GW,GW.CurrentState),:,action2idx(GW,"NW")) = -14;
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!