create a predefined reinforcement learning environment -凯发k8网页登录
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:
rlmdpenv
object, when you use one of the following keywords.'basicgridworld'
'waterfallgridworld-stochastic'
'waterfallgridworld-deterministic'
cartpolediscreteaction
object, when you use the'cartpole-discrete'
keyword.cartpolecontinuousaction
object, when you use the'cartpole-continuous'
keyword.doubleintegratordiscreteaction
object, when you use the'doubleintegrator-discrete'
keyword.doubleintegratorcontinuousaction
object, when you use the'doubleintegrator-continuous'
keyword.simplependlumwithimagediscreteaction
object, when you use the'simplependulumwithimage-discrete'
keyword.simplependlumwithimagecontinuousaction
object, when you use the'simplependulumwithimage-continuous'
keyword.simulinkenvwithagent
object, 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 命令。
select a web site
choose a web site to get translated content where available and see local events and offers. based on your location, we recommend that you select: .
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.
americas
- (español)
- (english)
- (english)
europe
- (english)
- (english)
- (deutsch)
- (español)
- (english)
- (français)
- (english)
- (italiano)
- (english)
- (english)
- (english)
- (deutsch)
- (english)
- (english)
- switzerland
- (english)
asia pacific
- (english)
- (english)
- (english)
- 中国
- (日本語)
- (한국어)