rlPredefinedEnv
Create a predefined reinforcement learning environment
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 Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)