public class EpsilonGreedy extends java.lang.Object implements SolverDerivedPolicy, EnumerablePolicy
| Modifier and Type | Field and Description |
|---|---|
protected double |
epsilon |
protected QProvider |
qplanner |
protected java.util.Random |
rand |
| Constructor and Description |
|---|
EpsilonGreedy(double epsilon)
Initializes with the value of epsilon, where epsilon is the probability of taking a random action.
|
EpsilonGreedy(QProvider 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 |
|---|---|
Action |
action(State s)
This method will return an action sampled by the policy for the given state.
|
double |
actionProb(State s,
Action a)
Returns the probability/probability density that the given action will be taken in the given state.
|
boolean |
definedFor(State s)
Specifies whether this policy is defined for the input state.
|
double |
getEpsilon()
Returns the epsilon value, where epsilon is the probability of taking a random action.
|
java.util.List<ActionProb> |
policyDistribution(State s)
This method will return action probability distribution defined by the policy.
|
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.
|
protected QProvider qplanner
protected double epsilon
protected java.util.Random rand
public EpsilonGreedy(double epsilon)
epsilon - the probability of taking a random action.public EpsilonGreedy(QProvider 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)
SolverDerivedPolicysetSolver in interface SolverDerivedPolicysolver - the solver from which this policy is derivedpublic Action action(State s)
Policypublic double actionProb(State s, Action a)
PolicyactionProb in interface Policys - the state of interesta - the action that may be taken in the statepublic java.util.List<ActionProb> policyDistribution(State s)
EnumerablePolicypolicyDistribution in interface EnumerablePolicys - the state for which an action distribution should be returnedpublic boolean definedFor(State s)
PolicydefinedFor in interface Policys - the input state to test for whether this policy is definedState s, false otherwise.