创建自定义网格世界环境
网格世界是一个基于二维的基于细胞的环境,该试剂从一个细胞开始,并向末端细胞移动,同时收集尽可能多的奖励。网格世界环境对于应用强化学习算法很有用,以发现电网上的代理的最佳路径和政策,以最少的动作以最少的动作达到终端目标。
强化学习工具箱™允许您创建自定义MATLAB®grid world environments for your own applications. To create a custom grid world environment:
创建网格世界模型。
配置网格世界模型。
使用网格世界模型创建自己的网格世界环境。
Grid World Model
您可以使用CreateGridWorld
功能。创建网格大小时指定网格大小网格世界
模型对象。
这网格世界
对象具有以下属性。
财产 | read-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 by-2网格世界模型 gw.States = [“ [1,1]”;“ [2,1]”;“ [1,2]”;“ [2,2]”]; |
||||||
动作 |
是的 | 一个字符串向量,其中包含代理可以使用的可能操作的列表。您可以通过使用该动作来设置操作 gw = createGridworld(m,n,移动) 指定
|
||||||
t |
No | 状态过渡矩阵,指定为3-D数组。
例如,考虑一个5 x-5的确定性网格世界对象 northStateTrySition = GW.T(:,:,1) 从上图, |
||||||
r |
No | 奖励过渡矩阵,指定为3-D阵列。 奖励过渡矩阵
设置 |
||||||
ObstacleStates |
No |
黑细胞是障碍状态,您可以使用以下语法指定它们: GW。ObstacleStates = ["[3,3]";“ [3,4]”;“ [3,5]”;“ [4,3]”]; 有关工作流程的示例,请参见tr一个一世nreinforcement Learning Agent in Basic Grid World。 |
||||||
terminalStates |
No |
gw.terminalstates =“ [5,5]”; 有关工作流程的示例,请参见tr一个一世nreinforcement Learning Agent in Basic Grid World。 |
网格世界环境
您可以使用Markov决策过程(MDP)环境rlMDPEnv
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 objectrlMDPEnv
与网格世界模型对象互动网格世界
。
有关更多信息,请参阅rlMDPEnv
一个ndtr一个一世nreinforcement Learning Agent in Basic Grid World。
也可以看看
CreateGridWorld
|rlMDPEnv
|rlpredefinedenv