This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

rlSimulationOptions

Options for simulating reinforcement learning environments

Syntax

simOpts = rlSimulationOptions
simOpts = rlSimulationOptions(Name,Value)

Description

example

simOpts = rlSimulationOptions returns the default options for simulating a reinforcement learning environment against an agent. You use simulation options to specify parameters about the simulation such as the maximum number of steps to run per simulation and the number of simulations to run. After you configure the options, use simOpts as an input argument for sim.

example

simOpts = rlSimulationOptions(Name,Value) creates an option set for simulation using the specified name-value pairs to override default option values.

Examples

collapse all

Create an options set for simulating a reinforcement learning environment. Set the number of steps to simulate to 1000, and configure the options to run three simulations.

You can set the options using Name,Value pairs when you create the options set. Any options that you do not explicitly set have their default values.

simOpts = rlSimulationOptions(...
    'MaxSteps',1000,...
    'NumSimulations',3)
simOpts = 
  rlSimulationOptions with properties:

          MaxSteps: 1000
    NumSimulations: 3
       StopOnError: "off"

Alternatively, create a default options set and use dot notation to change some of the values.

simOpts = rlSimulationOptions;
simOpts.MaxSteps = 1000;
simOpts.NumSimulations = 3;

simOpts
simOpts = 
  rlSimulationOptions with properties:

          MaxSteps: 1000
    NumSimulations: 3
       StopOnError: "off"

Input Arguments

collapse all

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'MaxSteps',1000,'StopOnError',"On"

Number of steps to run the simulation, specified as the comma-separated pair consisting of 'MaxSteps' and a positive integer. In general, you define episode termination conditions in the environment. This value is the maximum number of steps to run in the simulation if those termination conditions are not met.

Example: 'MaxSteps',1000

Number of simulations to run, specified as the comma-separated pair consisting of 'NumSimulations' and a positive integer. At the start of each simulation, sim resets the environment. You specify what happens on environment reset when you create the environment. For instance, resetting the environment at the start of each episode can include randomizing initial state values, if you configure your environment to do so. In that case, running multiple simulations allows you to validate performance of a trained agent over a range of initial conditions.

Example: 'NumSimulations',10

Stop simulation when an error occurs, specified as "off" or "on". When this option is "off", errors are captured and returned in the SimulationInfo output of sim, and simulation continues.

Output Arguments

collapse all

Option set for simulating reinforcement learning environments, returned as a rlSimulationOptions object. The property values of simOpts are initialized to the default values or to the values you specify with Name,Value pairs. You can further modify the property values using dot notation. Use the options set as an input argument with sim when you simulate reinforcement learning environment against an agent.

See Also

Introduced in R2019a