public abstract class Agent
extends java.lang.Object
AgentType
. Agents are informed
by the world when a game is starting and ending and they are also queried
by the world for the action they will take. After all agents in the world
have chosen their action, the world changes and informs each agent of the outcome
for all agents in the world.Modifier and Type | Field and Description |
---|---|
protected AgentType |
agentType |
protected SGDomain |
domain |
protected JointReward |
internalRewardFunction |
protected World |
world |
protected java.lang.String |
worldAgentName |
Constructor and Description |
---|
Agent() |
Modifier and Type | Method and Description |
---|---|
abstract void |
gameStarting()
This method is called by the world when a new game is starting.
|
abstract void |
gameTerminated()
This method is called by the world when a game has ended.
|
abstract GroundedSingleAction |
getAction(State s)
This method is called by the world when it needs the agent to choose an action
|
java.lang.String |
getAgentName()
Returns this agent's name
|
AgentType |
getAgentType()
Returns this agent's type
|
JointReward |
getInternalRewardFunction()
Returns the internal reward function used by the agent.
|
protected void |
init(SGDomain d) |
void |
joinWorld(World w,
AgentType as)
Causes this agent instance to join a world.
|
abstract 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.
|
void |
setInternalRewardFunction(JointReward jr)
Internal reward functions are optional, but can be useful for purposes like reward shaping.
|
protected SGDomain domain
protected JointReward internalRewardFunction
protected AgentType agentType
protected java.lang.String worldAgentName
protected World world
protected void init(SGDomain d)
public void setInternalRewardFunction(JointReward jr)
jr
- the internal reward function the agent should use for reasoning and learningpublic JointReward getInternalRewardFunction()
public void joinWorld(World w, AgentType as)
w
- the world for the agent to joinas
- the agent type the agent will be joining aspublic java.lang.String getAgentName()
public AgentType getAgentType()
public abstract void gameStarting()
public abstract GroundedSingleAction getAction(State s)
s
- the current state of the worldpublic abstract void observeOutcome(State s, JointAction jointAction, java.util.Map<java.lang.String,java.lang.Double> jointReward, State sprime, boolean isTerminal)
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 abstract void gameTerminated()