create a predefined reinforcement learning environment -pg电子麻将胡了
create a predefined reinforcement learning environment
since r2019a
description
takes a predefined keyword env = rlpredefinedenv(keyword)keyword representing the environment name to
create a matlab® or simulink® reinforcement learning environment env. the environment
env models the dynamics with which the agent interacts, generating
rewards and observations in response to agent actions.
examples
basic grid world reinforcement learning environment
use the predefined "basicgridworld" keyword to create a basic grid world reinforcement learning environment.
env = rlpredefinedenv("basicgridworld")env =
rlmdpenv with properties:
model: [1x1 rl.env.gridworld]
resetfcn: []
continuous double integrator reinforcement learning environment
use the predefined "doubleintegrator-continuous" keyword to create a continuous double integrator reinforcement learning environment.
env = rlpredefinedenv("doubleintegrator-continuous")env =
doubleintegratorcontinuousaction with properties:
gain: 1
ts: 0.1000
maxdistance: 5
goalthreshold: 0.0100
q: [2x2 double]
r: 0.0100
maxforce: inf
state: [2x1 double]
you can visualize the environment using the plot function and interact with it using the reset and step functions.
plot(env) observation = reset(env)
observation = 2×1
4
0
[observation,reward,isdone] = step(env,16)

observation = 2×1
4.0800
1.6000
reward = -16.5559
isdone = logical
0
create continuous simple pendulum model environment
use the predefined "simplependulummodel-continuous" keyword to create a continuous simple pendulum model reinforcement learning environment.
env = rlpredefinedenv("simplependulummodel-continuous")env =
simulinkenvwithagent with properties:
model : rlsimplependulummodel
agentblock : rlsimplependulummodel/rl agent
resetfcn : []
usefastrestart : on
input arguments
keyword — predefined keyword representing the environment name
'basicgridworld' | 'cartpole-discrete' | 'doubleintegrator-continuous' | 'simplependulumwithimage-discrete' | 'simplependulummodel-discrete' | 'simplependulummodel-continuous' | 'cartpolesimscapemodel-continuous' | ...
predefined keyword representing the environment name, specified as one of the following:
matlab environment
'basicgridworld''cartpole-discrete''cartpole-continuous''doubleintegrator-discrete''doubleintegrator-continuous''simplependulumwithimage-discrete''simplependulumwithimage-continuous''waterfallgridworld-stochastic''waterfallgridworld-deterministic'
simulink environment
'simplependulummodel-discrete''simplependulummodel-continuous''cartpolesimscapemodel-discrete''cartpolesimscapemodel-continuous'
output arguments
env — matlab or simulink environment object
rlmdpenv object | cartpolediscreteaction object | cartpolecontinuousaction object | doubleintegratordiscreteaction object | doubleintegratorcontinuousaction object | simplependlumwithimagediscreteaction object | simplependlumwithimagecontinuousaction object | simulinkenvwithagent object
matlab or simulink environment object, returned as one of the following:
rlmdpenvobject, when you use one of the following keywords.'basicgridworld''waterfallgridworld-stochastic''waterfallgridworld-deterministic'
cartpolediscreteactionobject, when you use the'cartpole-discrete'keyword.cartpolecontinuousactionobject, when you use the'cartpole-continuous'keyword.doubleintegratordiscreteactionobject, when you use the'doubleintegrator-discrete'keyword.doubleintegratorcontinuousactionobject, when you use the'doubleintegrator-continuous'keyword.simplependlumwithimagediscreteactionobject, when you use the'simplependulumwithimage-discrete'keyword.simplependlumwithimagecontinuousactionobject, when you use the'simplependulumwithimage-continuous'keyword.simulinkenvwithagentobject, when you use one of the following keywords.'simplependulummodel-discrete''simplependulummodel-continuous''cartpolesimscapemodel-discrete''cartpolesimscapemodel-continuous'
version history
introduced in r2019a
打开示例
您曾对此示例进行过修改。是否要打开带有您的编辑的示例?
matlab 命令
您点击的链接对应于以下 matlab 命令:
请在 matlab 命令行窗口中直接输入以执行命令。web 浏览器不支持 matlab 命令。
you can also select a web site from the following list:
how to get best site performance
select the china site (in chinese or english) for best site performance. other mathworks country sites are not optimized for visits from your location.