public abstract class JointPolicy extends java.lang.Object implements Policy
SGAgentType
, 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 privileged agent's position. This class also contains an abstract method
for setting that target privileged agent: setTargetAgent(int)
. If the joint policy is agent agnostic, then this method
does not need to do anything.
This class can also be used to synchronize the action selection of multiple agents according to the same sampled joint action. This is achieved
by using the getAgentSynchronizedActionSelection(int, 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.
Modifier and Type | Field and Description |
---|---|
protected java.util.List<SGAgentType> |
agentsInJointPolicy
The agent definitions that define the set of possible joint actions in each state.
|
protected java.util.Set<java.lang.Integer> |
agentsSynchronizedSoFar
The agents whose actions have been synchronized 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
|
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.List<SGAgentType> |
getAgentsInJointPolicy()
Returns a map specifying the agents who contribute actions to this joint policy.
|
Action |
getAgentSynchronizedActionSelection(int agentNum,
State s)
This method returns the action for a single agent by a synchronized 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<SGAgent> agents)
Sets the agent definitions by querying the agent names and
SGAgentType objects from a list of agents. |
void |
setAgentsInJointPolicyFromWorld(World w)
Sets teh agent definitions by querying the agents that exist in a
World object. |
void |
setAgentTypesInJointPolicy(java.util.List<SGAgentType> agentsInJointPolicy)
Sets the agent definitions that define the set of possible joint actions in each state.
|
abstract void |
setTargetAgent(int agentNum)
Sets the target privileged agent from which this joint policy is defined.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
action, actionProb, definedFor
protected java.util.List<SGAgentType> agentsInJointPolicy
protected JointAction lastSynchronizedJointAction
protected java.util.Set<java.lang.Integer> agentsSynchronizedSoFar
protected State lastSyncedState
public void setAgentTypesInJointPolicy(java.util.List<SGAgentType> agentsInJointPolicy)
agentsInJointPolicy
- the agent definitions that define the set of possible joint actions in each state.public void setAgentsInJointPolicy(java.util.List<SGAgent> agents)
SGAgentType
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.List<SGAgentType> getAgentsInJointPolicy()
public Action getAgentSynchronizedActionSelection(int agentNum, 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).agentNum
- the agent whose action in this joint policy is being querieds
- the state in which the action is to be selected.public abstract void setTargetAgent(int agentNum)
agentNum
- the target agent.public abstract JointPolicy copy()