main content

reinforcement learning policy -凯发k8网页登录

reinforcement learning policy

since r2022b

  • policy block

libraries:
reinforcement learning toolbox

description

use the policy block to simulate a reinforcement learning policy in simulink® and to generate code (using simulink coder™) for deployment purposes. this block takes an observation as input and outputs an action. you associate the block with a mat-file that contains the information needed to fully characterize the policy, and which can be generated by or .

examples

ports

input

this port receives observation signals from the environment. observation signals represent measurements or other instantaneous system data. if you have multiple observations, you can use a mux block to combine them into a vector signal. to use a nonvirtual bus signal, use bus2rlspec.

output

action computed by the policy based on the observation input. connect this port to the inputs of your system. to use a nonvirtual bus signal, use bus2rlspec.

note

policy blocks generated from a continuous action-space object or a continuous action-space rlacagent, , or object, do not enforce the constraints set by the action specification. in these cases, you must enforce action space constraints within the environment.

parameters

enter the name of the mat-file containing the information needed to fully characterize the policy. this file is generated by or . when you generate the block using generatepolicyblock and specify a non-default datafilename argument, then the generated block has this parameter set to the specified file name, so that the block is associated with the generated data file.

to use a policy block within a conditionally executed subsystem, such as a (simulink) or a (simulink), you must generate its data file from an agent or policy object which has its sampletime property set to -1. doing so allows the block to inherit the sample time of its parent subsystem.

programmatic use

block parameter: matfile
type: string, character vector
default: "blockagentdata.mat"

tips

  • when using embedded coder® to generate parallel code, enabling the generate parallel for loops optimization parameter improves the performance when the data being processed is large in size. however, if the network and the data is small, the overhead of initializing the threads for parallelization significantly reduces the performance. in this case, disable generate parallel for loops. see (embedded coder) and (matlab coder) for more information.

extended capabilities

c/c code generation
generate c and c code using simulink® coder™.

version history

introduced in r2022b

网站地图