main content

obtain action data specifications from reinforcement learning environment, agent, or experience buffer -凯发k8网页登录

obtain action data specifications from reinforcement learning environment, agent, or experience buffer

since r2019a

description

example

actinfo = getactioninfo(env) extracts action information from reinforcement learning environment env.

actinfo = getactioninfo(agent) extracts action information from reinforcement learning agent agent.

actinfo = getactioninfo(buffer) extracts action information from experience buffer buffer.

examples

the reinforcement learning environment for this example is a longitudinal dynamics model comprising two cars, a leader and a follower. the vehicle model is also used in the (model predictive control toolbox) example.

open the model.

mdl = "rlaccmdl";
open_system(mdl);

specify path to the agent block in the model.

agentblk = mdl   "/rl agent";

create the observation and action specifications.

% observation specifications
obsinfo = rlnumericspec([3 1],lowerlimit=-inf*ones(3,1),upperlimit=inf*ones(3,1));
obsinfo.name = "observations";
obsinfo.description = "information on velocity error and ego velocity";
% action specifications
actinfo = rlnumericspec([1 1],lowerlimit=-3,upperlimit=2);
actinfo.name = "acceleration";

define environment interface.

env = rlsimulinkenv(mdl,agentblk,obsinfo,actinfo)
env = 
simulinkenvwithagent with properties:
           model : rlaccmdl
      agentblock : rlaccmdl/rl agent
        resetfcn : []
  usefastrestart : on

the reinforcement learning environment env is a simulinkenvwithagent object.

extract the action and observation specifications from env.

actinfoext = getactioninfo(env)
actinfoext = 
  rlnumericspec with properties:
     lowerlimit: -3
     upperlimit: 2
           name: "acceleration"
    description: [0x0 string]
      dimension: [1 1]
       datatype: "double"
obsinfoext = getobservationinfo(env)
obsinfoext = 
  rlnumericspec with properties:
     lowerlimit: [3x1 double]
     upperlimit: [3x1 double]
           name: "observations"
    description: "information on velocity error and ego velocity"
      dimension: [3 1]
       datatype: "double"

the action information contains acceleration values while the observation information contains the velocity and velocity error values of the ego vehicle.

input arguments

reinforcement learning environment from which to extract the action information, specified as one of the following:

for more information on reinforcement learning environments, see reinforcement learning environments and create custom simulink environments.

reinforcement learning agent from which to extract the action information, specified as one of the following objects.

for more information on reinforcement learning agents, see reinforcement learning agents.

experience buffer, specified as one of the following replay memory objects.

output arguments

action data specifications extracted from the reinforcement learning environment, returned as an array of one of the following:

version history

introduced in r2019a

网站地图