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;

回答(1 个)

Poorna
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!

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by