main content

create a predefined reinforcement learning environment -凯发k8网页登录

create a predefined reinforcement learning environment

since r2019a

description

example

env = rlpredefinedenv(keyword) takes a predefined 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

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: []

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)

figure double integrator visualizer contains an axes object. the axes object contains an object of type rectangle.

observation = 2×1
    4.0800
    1.6000
reward = -16.5559
isdone = logical
   0

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

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

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

网站地图