public class SGQWActionHistory extends SGNaiveQLAgent
1. Watkins, Christopher JCH, and Peter Dayan. "Q-learning." Machine learning 8.3-4 (1992): 279-292.
QProvider.Helper
Modifier and Type | Field and Description |
---|---|
protected HistoryState |
curHState |
protected int |
historySize
The size of action history to store.
|
agentNum, discount, hashFactory, learningRate, policy, qInit, qMap, stateRepresentations, storedMapAbstraction, totalNumberOfSteps
agentType, domain, internalRewardFunction, world, worldAgentName
Constructor and Description |
---|
SGQWActionHistory(SGDomain d,
double discount,
double learningRate,
HashableStateFactory hashFactory,
int historySize)
Initializes the learning algorithm using 0.1 epsilon greedy learning strategy/policy
|
Modifier and Type | Method and Description |
---|---|
Action |
action(State s)
This method is called by the world when it needs the agent to choose an action
|
void |
gameStarting(World w,
int agentNum)
This method is called by the world when a new game is starting.
|
void |
observeOutcome(State s,
JointAction jointAction,
double[] jointReward,
State sprime,
boolean isTerminal)
This method is called by the world when every agent in the world has taken their action.
|
SGQWActionHistory |
setAgentDetails(java.lang.String agentName,
SGAgentType type) |
gameTerminated, getMaxQValue, qValue, qValues, setLearningRate, setQValueInitializer, setStoredMapAbstraction, setStrategy, stateHash, storedQ, value
agentName, agentType, getInternalRewardFunction, init, init, setInternalRewardFunction
protected int historySize
protected HistoryState curHState
public SGQWActionHistory(SGDomain d, double discount, double learningRate, HashableStateFactory hashFactory, int historySize)
d
- the domain in which the agent will actdiscount
- the discount factorlearningRate
- the learning ratehashFactory
- the state hashing factory to usehistorySize
- the number of previous steps to remember and with which to augment the state spacepublic SGQWActionHistory setAgentDetails(java.lang.String agentName, SGAgentType type)
setAgentDetails
in class SGNaiveQLAgent
public void gameStarting(World w, int agentNum)
SGAgent
gameStarting
in interface SGAgent
gameStarting
in class SGNaiveQLAgent
w
- the world in which the game is startingagentNum
- the agent number of the agent in the worldpublic void observeOutcome(State s, JointAction jointAction, double[] jointReward, State sprime, boolean isTerminal)
SGAgent
observeOutcome
in interface SGAgent
observeOutcome
in class SGNaiveQLAgent
s
- the state in which the last action of each agent was takenjointAction
- the joint action of all agents in the worldjointReward
- the joint reward of all agents in the worldsprime
- the next state to which the agent transitionedisTerminal
- whether the new state is a terminal statepublic Action action(State s)
SGAgent
action
in interface SGAgent
action
in class SGNaiveQLAgent
s
- the current state of the world