public class SingleAgentInterface extends Agent
Modifier and Type | Class and Description |
---|---|
protected class |
SingleAgentInterface.MutableGroundedSingleAction
A mutable grounded singled action
|
protected class |
SingleAgentInterface.MutableState
A mutable OO-MDP state wrapper
|
protected class |
SingleAgentInterface.SARFWrapper
A reward function for returning the last RLGlue reward.
|
protected class |
SingleAgentInterface.SATFWrapper
A termianl function that returns true when the last RLGlue state was terminal.
|
Modifier and Type | Field and Description |
---|---|
protected double |
lastReward
The last reward received by this agent
|
protected boolean |
lastStateIsTerminal
Whether the last state was a terminal state
|
protected boolean |
needsToStartEpisode
whether a new single agent learning episode needs to be started for the next action request
|
protected SingleAgentInterface.MutableGroundedSingleAction |
nextAction
A mutable action holding the next action to be taken by the agent
|
protected SingleAgentInterface.MutableState |
nextState
A mutable state holding the next state for the single agent
|
protected LearningAgent |
saAgent
The BURLAP single agent learning agent that is being used.
|
protected SALearningAgentFactoryForSG |
saAgentFactory
The single agent learning factory
|
protected SADomain |
saDomain
The single agent version of the domain
|
protected java.lang.Thread |
saThread
The thread that runs the single agent learning algorithm
|
agentType, domain, internalRewardFunction, world, worldAgentName
Constructor and Description |
---|
SingleAgentInterface(SGDomain sgDomain,
SALearningAgentFactoryForSG saAgentFactory)
Initializes for a given stochastic games domain and a factory to produce the single agent learning object
|
Modifier and Type | Method and Description |
---|---|
void |
gameStarting()
This method is called by the world when a new game is starting.
|
void |
gameTerminated()
This method is called by the world when a game has ended.
|
GroundedSingleAction |
getAction(State s)
This method is called by the world when it needs the agent to choose an action
|
void |
observeOutcome(State s,
JointAction jointAction,
java.util.Map<java.lang.String,java.lang.Double> jointReward,
State sprime,
boolean isTerminal)
This method is called by the world when every agent in the world has taken their action.
|
State |
receiveSAAction(GroundedAction ga)
A method that receives calls from the single agent domain actions to inform this stochastic games agent which action to take next when
requested by the world.
|
getAgentName, getAgentType, getInternalRewardFunction, init, joinWorld, setInternalRewardFunction
protected SADomain saDomain
protected SALearningAgentFactoryForSG saAgentFactory
protected LearningAgent saAgent
protected boolean lastStateIsTerminal
protected double lastReward
protected boolean needsToStartEpisode
protected SingleAgentInterface.MutableState nextState
protected SingleAgentInterface.MutableGroundedSingleAction nextAction
protected java.lang.Thread saThread
public SingleAgentInterface(SGDomain sgDomain, SALearningAgentFactoryForSG saAgentFactory)
sgDomain
- the source stochastic games domain to be playedsaAgentFactory
- the single learning agent factory to use to perform learning and action selectionpublic void gameStarting()
Agent
gameStarting
in class Agent
public GroundedSingleAction getAction(State s)
Agent
public void observeOutcome(State s, JointAction jointAction, java.util.Map<java.lang.String,java.lang.Double> jointReward, State sprime, boolean isTerminal)
Agent
observeOutcome
in class Agent
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 void gameTerminated()
Agent
gameTerminated
in class Agent
public State receiveSAAction(GroundedAction ga)
ga
- the single agent grounded aciton selection