public class EpsilonGreedy extends Policy implements SolverDerivedPolicy
Policy.ActionProb, Policy.GroundedAnnotatedAction, Policy.PolicyUndefinedException
Modifier and Type | Field and Description |
---|---|
protected double |
epsilon |
protected QFunction |
qplanner |
protected java.util.Random |
rand |
annotateOptionDecomposition, evaluateDecomposesOptions
Constructor and Description |
---|
EpsilonGreedy(double epsilon)
Initializes with the value of epsilon, where epsilon is the probability of taking a random action.
|
EpsilonGreedy(QFunction planner,
double epsilon)
Initializes with the QComputablePlanner to use and the value of epsilon to use, where epsilon is the probability of taking a random action.
|
Modifier and Type | Method and Description |
---|---|
AbstractGroundedAction |
getAction(State s)
This method will return an action sampled by the policy for the given state.
|
java.util.List<Policy.ActionProb> |
getActionDistributionForState(State s)
This method will return action probability distribution defined by the policy.
|
double |
getEpsilon()
Returns the epsilon value, where epsilon is the probability of taking a random action.
|
boolean |
isDefinedFor(State s)
Specifies whether this policy is defined for the input state.
|
boolean |
isStochastic()
Indicates whether the policy is stochastic or deterministic.
|
void |
setEpsilon(double epsilon)
Sets the epsilon value, where epsilon is the probability of taking a random action.
|
void |
setSolver(MDPSolverInterface solver)
Sets the valueFunction whose results affect this policy.
|
evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateMethodsShouldAnnotateOptionDecomposition, evaluateMethodsShouldDecomposeOption, followAndRecordPolicy, followAndRecordPolicy, getDeterministicPolicy, getProbOfAction, getProbOfActionGivenDistribution, getProbOfActionGivenDistribution, sampleFromActionDistribution
protected QFunction qplanner
protected double epsilon
protected java.util.Random rand
public EpsilonGreedy(double epsilon)
epsilon
- the probability of taking a random action.public EpsilonGreedy(QFunction planner, double epsilon)
planner
- the QComputablePlanner to useepsilon
- the probability of taking a random action.public double getEpsilon()
public void setEpsilon(double epsilon)
epsilon
- the probability of taking a random action.public void setSolver(MDPSolverInterface solver)
SolverDerivedPolicy
setSolver
in interface SolverDerivedPolicy
solver
- the solver from which this policy is derivedpublic AbstractGroundedAction getAction(State s)
Policy
public java.util.List<Policy.ActionProb> getActionDistributionForState(State s)
Policy
getActionDistributionForState
in class Policy
s
- the state for which an action distribution should be returnedpublic boolean isStochastic()
Policy
isStochastic
in class Policy
public boolean isDefinedFor(State s)
Policy
isDefinedFor
in class Policy
s
- the input state to test for whether this policy is definedState
s, false otherwise.