public class QLearning
extends java.lang.Object
| Constructor and Description |
|---|
QLearning(int states,
int actions,
IExplorationPolicy explorationPolicy,
boolean randomize)
Initializes a new instance of the QLearning class.
|
| Modifier and Type | Method and Description |
|---|---|
int |
GetAction(int state)
Get next action from the specified state.
|
int |
getActions()
Amount of possible actions.
|
double |
getDiscountFactor()
Get Discount factor for the expected summary reward.
|
IExplorationPolicy |
getExplorationPolicy()
Exploration policy.
|
double |
getLearningRate()
Get Learning Rate
|
int |
getStates()
Amount of possible states.
|
void |
setDiscountFactor(double discountFactor)
Discount factor for the expected summary reward.
|
void |
setExplorationPolicy(IExplorationPolicy explorationPolicy)
Policy, which is used to select actions.
|
void |
setLearningRate(double learningRate)
Learning rate, [0, 1].
|
void |
UpdateState(int previousState,
int action,
double reward,
int nextState)
Update Q-function's value for the previous state-action pair.
|
public QLearning(int states,
int actions,
IExplorationPolicy explorationPolicy,
boolean randomize)
states - Amount of possible states.actions - Amount of possible actions.explorationPolicy - Exploration policy.randomize - Randomize action estimates or not.public int getStates()
public int getActions()
public IExplorationPolicy getExplorationPolicy()
public void setExplorationPolicy(IExplorationPolicy explorationPolicy)
explorationPolicy - Exploration Policypublic double getLearningRate()
public void setLearningRate(double learningRate)
learningRate - public double getDiscountFactor()
public void setDiscountFactor(double discountFactor)
discountFactor - public int GetAction(int state)
state - Current state to get an action for.public void UpdateState(int previousState,
int action,
double reward,
int nextState)
previousState - Previous state.action - Action, which leads from previous to the next state.reward - Reward value, received by taking specified action from previous state.nextState - Next state.