创建自定义网格世界环境
网格世界是一种基于细胞的基于细胞的环境,其中代理从一个电池开始并朝向终端电池移动,同时收集尽可能多的奖励。网格世界环境对于应用强化学习算法,可以在网格上发现最佳路径和政策,以便在最少的移动中到达终端目标。
钢筋学习工具箱™允许您创建自定义MATLAB®网格世界为您自己的应用程序环境。T.O.create a custom grid world environment:
创建网格世界模型。
配置网格世界模型。
使用网格世界模型创建自己的网格世界环境。
Grid World Model
您可以使用自己的网格世界模型creategridworld.
功能。创建时指定网格尺寸Gridworld.
模型对象。
这Gridworld.
对象具有以下属性。
财产 | R.ead-Only | 描述 | ||||||
---|---|---|---|---|---|---|---|---|
网格化 |
是的 | 网格世界的尺寸,显示为M.-经过-N.大批。这里,M.表示网格行的数量和N.是网格列的数量。 |
||||||
当前状态 |
No | Name of the current state of the agent, specified as a string. You can use this property to set the initial state of the agent. The agent always starts from cell 代理人从中开始 |
||||||
状态 |
是的 | 包含网格世界的状态名称的字符串矢量。例如,对于2×2网格世界模型 gw.states = [“[1,1]”;“[2,1]”;“[1,2]”;“[2,2]”]; |
||||||
行动 |
是的 | 一个字符串矢量,包含代理可以使用的可能操作的列表。您可以使用使用时创建网格世界模型时设置操作 gw = creategridworld(m,n,moves) 指定
|
||||||
T. |
No | 状态转换矩阵,指定为3-D阵列。
例如,考虑一个5×5的确定性网格世界对象 NorthstateTransition = GW.T(:,:1) 从上图,值 |
||||||
R. |
No | 奖励转换矩阵,指定为3-D阵列。 奖励过渡矩阵
设置 |
||||||
ObstacleStates |
No |
黑色细胞是障碍状态,您可以使用以下语法指定它们: GW.。ObstacleStates = ["[3,3]";“[3,4]”;“[3,5]”;“[4,3]”]; 对于工作流示例,请参阅T.R.一种一世N.R.einforcement Learning Agent in Basic Grid World。 |
||||||
T.erminalStates |
No |
gw.terminalstates =“[5,5]”; 对于工作流示例,请参阅T.R.一种一世N.R.einforcement Learning Agent in Basic Grid World。 |
网格世界环境
您可以使用Markov决策过程(MDP)环境R.L.MDPEnv
from the grid world model from the previous step. MDP is a discrete-time stochastic control process. It provides a mathematical framework for modeling decision making in situations where outcomes are partly random and partly under the control of the decision maker. The agent uses the grid world environment objectR.L.MDPEnv
与网格世界模型对象互动Gridworld.
。
有关更多信息,请参阅R.L.MDPEnv
一种N.dT.R.一种一世N.R.einforcement Learning Agent in Basic Grid World。
也可以看看
creategridworld.
|R.L.MDPEnv
|Rlpredefinedenv.