How to represent the actions when setting the reward in GridWorld?

3 Ansichten (letzte 30 Tage)
衍辰
衍辰 am 4 Dez. 2022
Beantwortet: Poorna am 30 Aug. 2023
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;

Antworten (1)

Poorna
Poorna am 30 Aug. 2023
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!

Kategorien

Mehr zu Language Support finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by