public class MultiAgentVFPlanningAgent extends Agent
MAValueFunctionPlanner
) to compute the value of each state and then follow
a policy derived from a joint policy that is derived from that estimated value function. This is achieved by at each step by the MAValueFunctionPlanner.planFromState(State)
being first
called and then following the policy. Ideally, the planning object should only perform planning for a state if it has not already planned for it. The joint policy
underlining the policy the agent follows must be an instance of MAQSourcePolicy
. Furthermore, when the policy is set, the underlining joint policy
will automatically be set to use this agent's planning object as the value function source and the set of agents will automatically be set to the involved in this agent's
world. The PolicyFromJointPolicy
will also be told that this agent is its target.Modifier and Type | Field and Description |
---|---|
protected MAValueFunctionPlanner |
planner
The planner this agent will use to estiamte the value function and thereby determine its policy.
|
protected PolicyFromJointPolicy |
policy
The policy dervied from a joint policy derived from the planner's value function estimate that this agent will follow.
|
protected boolean |
setAgentDefinitions
Whether the agent definitions for this planner have been set yet.
|
agentType, domain, internalRewardFunction, world, worldAgentName
Constructor and Description |
---|
MultiAgentVFPlanningAgent(SGDomain domain,
MAValueFunctionPlanner planner,
PolicyFromJointPolicy policy)
Initializes.
|
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 |
joinWorld(World w,
AgentType as)
Causes this agent instance to join a world.
|
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 |
setPolicy(PolicyFromJointPolicy policy)
Sets the policy derived from this agents planner to follow.
|
getAgentName, getAgentType, getInternalRewardFunction, init, setInternalRewardFunction
protected MAValueFunctionPlanner planner
protected PolicyFromJointPolicy policy
protected boolean setAgentDefinitions
public MultiAgentVFPlanningAgent(SGDomain domain, MAValueFunctionPlanner planner, PolicyFromJointPolicy policy)
MAQSourcePolicy
or a runtime exception will be thrown.
The joint policy will automatically be set to use the provided planner as the value function source.domain
- the domain in which the agent will actplanner
- the planner the agent should use for determining its policypolicy
- the policy that will use the planners value function as a source.public void setPolicy(PolicyFromJointPolicy policy)
MAQSourcePolicy
or a runtime exception will be thrown.
The joint policy will automatically be set to use the provided planner as the value function source.policy
- the policy that will use the planners value function as a source.public void joinWorld(World w, AgentType as)
Agent
public 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