Options for SARSA agent
rlSARSAAgentOptions object to specify options for
creating SARSA agents. To create a SARSA agent, use
For more information on SARSA agents, see SARSA Agents.
For more information on the different types of reinforcement learning agents, see Reinforcement Learning Agents.
opt = rlSARSAAgentOptions
rlSARSAAgentOptions object for use as an argument when creating a SARSA
agent using all default settings. You can modify the object properties using dot
EpsilonGreedyExploration — Options for epsilon-greedy exploration
Options for epsilon-greedy exploration, specified as an
EpsilonGreedyExploration object with the following
|Probability threshold to either randomly select an action or select the action that maximizes the state-action value function. A larger value of
Epsilon means that the agent randomly explores the action space at a higher rate.
|Minimum value of
At the end of each training time step, if
Epsilon is greater than
EpsilonMin, then it is updated using the following
Epsilon = Epsilon*(1-EpsilonDecay)
Epsilon is conserved between the end of an episode and
the start of the next one. Therefore, it keeps on uniformly decreasing over multiple
episodes until it reaches
If your agent converges on local optima too quickly, you can promote agent exploration by
To specify exploration options, use dot notation after creating the
opt. For example, set the epsilon value to
opt.EpsilonGreedyExploration.Epsilon = 0.9;
CriticOptimizerOptions — Critic optimizer options
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
SampleTime — Sample time of agent
1 (default) | positive scalar |
Sample time of agent, specified as a positive scalar or as
-1. Setting this
-1 allows for event-based simulations.
Within a Simulink® environment, the RL Agent block
in which the agent is specified to execute every
of simulation time. If
block inherits the sample time from its parent subsystem.
Within a MATLAB® environment, the agent is executed every time the environment advances. In
SampleTime is the time interval between consecutive
elements in the output experience returned by
-1, the time interval between
consecutive elements in the returned output experience reflects the timing of the event
that triggers the agent execution.
DiscountFactor — Discount factor
0.99 (default) | positive scalar less than or equal to 1
Discount factor applied to future rewards during training, specified as a positive scalar less than or equal to 1.
|SARSA reinforcement learning agent
Create a SARSA Agent Options Object
rlSARSAAgentOptions object that specifies the agent sample time.
opt = rlSARSAAgentOptions(SampleTime=0.5)
opt = rlSARSAAgentOptions with properties: SampleTime: 0.5000 DiscountFactor: 0.9900 EpsilonGreedyExploration: [1x1 rl.option.EpsilonGreedyExploration] CriticOptimizerOptions: [1x1 rl.option.rlOptimizerOptions] InfoToSave: [1x1 struct]
You can modify options using dot notation. For example, set the agent discount factor to
opt.DiscountFactor = 0.95;
Introduced in R2019a