Options for Q-learning agent
For more information on Q-learning agents, see Q-Learning Agents.
For more information on the different types of reinforcement learning agents, see Reinforcement Learning Agents.
opt = rlQAgentOptions
rlQAgentOptions object for use as an argument when creating a
Q-learning agent using all default settings. You can modify the object properties using
option properties using
name-value pairs. For example,
opt = rlQAgentOptions(
creates an option set with a discount factor of
0.95. You can specify
multiple name-value pairs. Enclose each property name in quotes.
EpsilonGreedyExploration — Options for epsilon-greedy exploration
Options for epsilon-greedy exploration, specified as an
EpsilonGreedyExploration object with the following properties.
|Probability threshold to either randomly select an action or select the action that maximizes the state-action value function. A larger value of |
|Minimum value of |
At the end of each training time step, if
Epsilon is greater than
EpsilonMin, then it is updated using the following formula.
Epsilon = Epsilon*(1-EpsilonDecay)
If your agent converges on local optima too quickly, you can promote agent exploration by increasing
To specify exploration options, use dot notation after creating the
opt. For example, set the epsilon value to
opt.EpsilonGreedyExploration.Epsilon = 0.9;
SampleTime — Sample time of agent
1 (default) | positive scalar
Sample time of agent, specified as a positive scalar.
Within a Simulink® environment, the agent gets executed every
SampleTime seconds of simulation time.
Within a MATLAB® environment, the agent gets executed every time the environment advances. However,
SampleTime is the time interval between consecutive elements in the output experience returned by
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.
|Q-learning reinforcement learning agent|
Create Q-Learning Agent Options Object
This example shows how to create an options object for a Q-Learning agent.
rlQAgentOptions object that specifies the agent sample time.
opt = rlQAgentOptions('SampleTime',0.5)
opt = rlQAgentOptions with properties: EpsilonGreedyExploration: [1x1 rl.option.EpsilonGreedyExploration] SampleTime: 0.5000 DiscountFactor: 0.9900
You can modify options using dot notation. For example, set the agent discount factor to
opt.DiscountFactor = 0.95;