public abstract class JointPolicy extends Policy
AgentType
, the latter of which specifies the set of individual actions
that they can take and which object class represents their state.
It is not uncommon for some joint policies to be defined from a privledged agent's position. This class also contains an abstract method
for setting that target privledge agent: setTargetAgent(String)
. If the joint policy is agent agnostic, then this method
does not need to do anything.
This class can also be used to synchonize the action selection of multiple agents according to the same sampled joint action. This is achieved
by using the getAgentSynchronizedActionSelection(String, State)
method, which returns the single action for each agent (of the specified
name) from the same sampled joint action until all agents defined in the policy have queried the method for their action selection.Policy.ActionProb, Policy.PolicyUndefinedException, Policy.RandomPolicy
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,AgentType> |
agentsInJointPolicy
The agent definitions that define the set of possible joint actions in each state.
|
protected java.util.Set<java.lang.String> |
agentsSyncrhonizedSoFar
The agents whose actiosn have been syncrhonized so far
|
protected State |
lastSyncedState
The last state in which synchronized actions were queried.
|
protected JointAction |
lastSynchronizedJointAction
The last synchronized joint action that was selected
|
annotateOptionDecomposition, evaluateDecomposesOptions
Constructor and Description |
---|
JointPolicy() |
Modifier and Type | Method and Description |
---|---|
abstract JointPolicy |
copy()
Creates a copy of this joint policy and returns it.
|
java.util.Map<java.lang.String,AgentType> |
getAgentsInJointPolicy()
Returns a map specifying the agents who contribute actions to this joint policy.
|
AbstractGroundedAction |
getAgentSynchronizedActionSelection(java.lang.String agentName,
State s)
This method returns the action for a single agent by a synchonrized sampling of this joint policy,
which enables multiple agents to query this policy object and act according to the same selected joint
actions from it.
|
java.util.List<JointAction> |
getAllJointActions(State s)
Returns all possible joint actions that can be taken in state s for the set of agents defined to be used in this joint policy.
|
void |
setAgentsInJointPolicy(java.util.List<Agent> agents)
Sets the agent definitions by querying the agent names and
AgentType objects from a list of agents. |
void |
setAgentsInJointPolicy(java.util.Map<java.lang.String,AgentType> agentsInJointPolicy)
Sets the agent definitions that define the set of possible joint actions in each state.
|
void |
setAgentsInJointPolicyFromWorld(World w)
Sets teh agent definitions by querying the agents that exist in a
World object. |
abstract void |
setTargetAgent(java.lang.String agentName)
Sets the target privledged agent from which this joint policy is defined.
|
evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateMethodsShouldAnnotateOptionDecomposition, evaluateMethodsShouldDecomposeOption, getAction, getActionDistributionForState, getDeterministicPolicy, getProbOfAction, getProbOfActionGivenDistribution, getProbOfActionGivenDistribution, isDefinedFor, isStochastic, sampleFromActionDistribution
protected java.util.Map<java.lang.String,AgentType> agentsInJointPolicy
protected JointAction lastSynchronizedJointAction
protected java.util.Set<java.lang.String> agentsSyncrhonizedSoFar
protected State lastSyncedState
public void setAgentsInJointPolicy(java.util.Map<java.lang.String,AgentType> agentsInJointPolicy)
agentsInJointPolicy
- the agent definitions that define the set of possible joint actions in each state.public void setAgentsInJointPolicy(java.util.List<Agent> agents)
AgentType
objects from a list of agents.agents
- the set of agents that will be involved in a joint aciton.public void setAgentsInJointPolicyFromWorld(World w)
World
object.w
- the World
object that contains the agents that will define the set of possible joint acitons.public java.util.List<JointAction> getAllJointActions(State s)
s
- the state in which all joint actions should be returned.JointAction
objects.public java.util.Map<java.lang.String,AgentType> getAgentsInJointPolicy()
public AbstractGroundedAction getAgentSynchronizedActionSelection(java.lang.String agentName, State s)
agentsInJointPolicy
member
has queried this method for their action or until an action for a different state is queried (that is, *either* condition
will cause the joint action to be resampled).agentName
- the agent name whose action in this joint policy is being querieds
- the state in which the action is to be selected.public abstract void setTargetAgent(java.lang.String agentName)
agentName
- the name of the target agent.public abstract JointPolicy copy()