Main Content

rlDDPGAgentOptions

Options for DDPG agent

Description

Use an rlDDPGAgentOptions object to specify options for deep deterministic policy gradient (DDPG) agents. To create a DDPG agent, use rlDDPGAgent.

For more information, see Deep Deterministic Policy Gradient (DDPG) Agents.

For more information on the different types of reinforcement learning agents, see Reinforcement Learning Agents.

Creation

Description

opt = rlDDPGAgentOptions creates an options object for use as an argument when creating a DDPG agent using all default options. You can modify the object properties using dot notation.

example

opt = rlDDPGAgentOptions(Name,Value) sets option properties using name-value pairs. For example, rlDDPGAgentOptions('DiscountFactor',0.95) creates an option set with a discount factor of 0.95. You can specify multiple name-value pairs. Enclose each property name in quotes.

Properties

expand all

Noise model options, specified as an OrnsteinUhlenbeckActionNoise object. For more information on the noise model, see Noise Model.

For an agent with multiple actions, if the actions have different ranges and units, it is likely that each action requires different noise model parameters. If the actions have similar ranges and units, you can set the noise parameters for all actions to the same value.

For example, for an agent with two actions, set the standard deviation of each action to a different value while using the same decay rate for both standard deviations.

opt = rlDDPGAgentOptions;
opt.NoiseOptions.StandardDeviation = [0.1 0.2];
opt.NoiseOptions.StandardDeviationDecayRate = 1e-4;

Actor optimizer options, specified as an rlOptimizerOptions object. It allows you to specify training parameters of the actor approximator such as learning rate, gradient threshold, as well as the optimizer algorithm and its parameters. For more information, see rlOptimizerOptions and rlOptimizer.

Critic optimizer options, specified as an rlOptimizerOptions object. It allows you to specify training parameters of the critic approximator such as learning rate, gradient threshold, as well as the optimizer algorithm and its parameters. For more information, see rlOptimizerOptions and rlOptimizer.

Smoothing factor for target actor and critic updates, specified as a positive scalar less than or equal to 1. For more information, see Target Update Methods.

Number of steps between target actor and critic updates, specified as a positive integer. For more information, see Target Update Methods.

Option for clearing the experience buffer before training, specified as a logical value.

Maximum batch-training trajectory length when using a recurrent neural network, specified as a positive integer. This value must be greater than 1 when using a recurrent neural network and 1 otherwise.

Size of random experience mini-batch, specified as a positive integer. During each training episode, the agent randomly samples experiences from the experience buffer when computing gradients for updating the critic properties. Large mini-batches reduce the variance when computing gradients but increase the computational effort.

Number of future rewards used to estimate the value of the policy, specified as a positive integer. For more information, see [1], Chapter 7.

Note that if parallel training is enabled (that is if an rlTrainingOptions option object in which the UseParallel property is set to true is passed to train) then NumStepsToLookAhead must be set to 1, otherwise an error is generated. This guarantees that experiences are stored contiguously.

.

Experience buffer size, specified as a positive integer. During training, the agent computes updates using a mini-batch of experiences randomly sampled from the buffer.

Sample time of agent, specified as a positive scalar or as -1. Setting this parameter to -1 allows for event-based simulations.

Within a Simulink® environment, the RL Agent block in which the agent is specified to execute every SampleTime seconds of simulation time. If SampleTime is -1, the block inherits the sample time from its parent subsystem.

Within a MATLAB® environment, the agent is executed every time the environment advances. In this case, SampleTime is the time interval between consecutive elements in the output experience returned by sim or train. If SampleTime is -1, the time interval between consecutive elements in the returned output experience reflects the timing of the event that triggers the agent execution.

Discount factor applied to future rewards during training, specified as a positive scalar less than or equal to 1.

Object Functions

rlDDPGAgentDeep deterministic policy gradient (DDPG) reinforcement learning agent

Examples

collapse all

This example shows how to create a DDPG agent option object.

Create an rlDDPGAgentOptions object that specifies the mini-batch size.

opt = rlDDPGAgentOptions('MiniBatchSize',48)
opt = 
  rlDDPGAgentOptions with properties:

                           NoiseOptions: [1x1 rl.option.OrnsteinUhlenbeckActionNoise]
                  ActorOptimizerOptions: [1x1 rl.option.rlOptimizerOptions]
                 CriticOptimizerOptions: [1x1 rl.option.rlOptimizerOptions]
                     TargetSmoothFactor: 1.0000e-03
                  TargetUpdateFrequency: 1
    ResetExperienceBufferBeforeTraining: 1
                         SequenceLength: 1
                          MiniBatchSize: 48
                    NumStepsToLookAhead: 1
                 ExperienceBufferLength: 10000
                             SampleTime: 1
                         DiscountFactor: 0.9900
                             InfoToSave: [1x1 struct]

You can modify options using dot notation. For example, set the agent sample time to 0.5.

opt.SampleTime = 0.5;

Algorithms

expand all

References

[1] Sutton, Richard S., and Andrew G. Barto. Reinforcement Learning: An Introduction. Second edition. Adaptive Computation and Machine Learning. Cambridge, Mass: The MIT Press, 2018.

Version History

Introduced in R2019a

expand all