public class EpsilonGreedy extends java.lang.Object implements RlAgent
EpsilonGreedy
is a simple exploration/excitation agent.
It helps other agents explore their environments during training by sometimes picking random actions.
If a model based agent is used, it will only explore paths through the environment that have already been seen. While this is sometimes good, it is also important to sometimes explore new paths as well. This agent exhibits a tradeoff that takes random paths a fixed percentage of the time during training.
Constructor and Description |
---|
EpsilonGreedy(RlAgent baseAgent,
Tracker exploreRate)
Constructs an
EpsilonGreedy . |
Modifier and Type | Method and Description |
---|---|
NDList |
chooseAction(RlEnv env,
boolean training)
Chooses the next action to take within the
RlEnv . |
void |
trainBatch(RlEnv.Step[] batchSteps)
Trains this
RlAgent on a batch of RlEnv.Step s. |
public EpsilonGreedy(RlAgent baseAgent, Tracker exploreRate)
EpsilonGreedy
.baseAgent
- the (presumably model-based) agent to use for exploitation and to trainexploreRate
- the probability of taking a random actionpublic NDList chooseAction(RlEnv env, boolean training)
RlEnv
.chooseAction
in interface RlAgent
env
- the current environmenttraining
- true if the agent is currently traningpublic void trainBatch(RlEnv.Step[] batchSteps)
RlAgent
on a batch of RlEnv.Step
s.trainBatch
in interface RlAgent
batchSteps
- the steps to train on