public class PolicyFromJointPolicy extends java.lang.Object implements EnumerablePolicy
When the agent name for this policy is
set, it automatically calls the JointPolicy.setTargetAgent(int)
method of the source joint policy with the same
agent name.
Action selection from the underlying joint policy may also be synchronized with multiple agents who are following the same
underlying joint policy object. This has the effect of the joint policy choosing a joint action for each time step and causing
each agent to follow that selected joint action. See the JointPolicy
class documentation for more information on how
this works. By default, synchronization will not be used.
Modifier and Type | Field and Description |
---|---|
protected int |
actingAgent |
protected JointPolicy |
jointPolicy
The underlying joint policy from which actions are selected.
|
protected boolean |
synchronizeJointActionSelectionAmongAgents |
Constructor and Description |
---|
PolicyFromJointPolicy(int actingAgent,
JointPolicy jointPolicy)
Initializes with the acting agent name whose actions from the underlying joint policy will be returned.
|
PolicyFromJointPolicy(int actingAgent,
JointPolicy jointPolicy,
boolean synchronizeJointActionSelectionAmongAgents)
Initializes with the acting agent name whose actions from the underlying joint policy will be returned and
whether actions should be synchronized with other agents following the same underlying joint policy.
|
PolicyFromJointPolicy(JointPolicy jointPolicy)
Initializes with the underlying joint polciy
|
PolicyFromJointPolicy(JointPolicy jointPolicy,
boolean synchronizeJointActionSelectionAmongAgents)
Initializes with the underlying joint polciy and whether actions should be synchronized with other agents following the same underlying joint policy.
|
Modifier and Type | Method and Description |
---|---|
Action |
action(State s)
This method will return an action sampled by the policy for the given state.
|
double |
actionProb(State s,
Action a)
Returns the probability/probability density that the given action will be taken in the given state.
|
PolicyFromJointPolicy |
copy()
Returns a copy of this policy, which entails of first making a copy of the joint policy.
|
boolean |
definedFor(State s)
Specifies whether this policy is defined for the input state.
|
int |
getActingAgent()
Returns the acting agent
|
JointPolicy |
getJointPolicy()
Returns the underlying joint policy
|
java.util.List<ActionProb> |
policyDistribution(State s)
This method will return action probability distribution defined by the policy.
|
void |
setActingAgent(int agentNum)
Sets the acting agents name
|
void |
setJointPolicy(JointPolicy jointPolicy)
Sets the underlying joint policy
|
void |
setSynchronizeJointActionSelectionAmongAgents(boolean synchronizeJointActionSelectionAmongAgents)
Sets whether actions selection of this agent's policy should be synchronized with the action selection of other agents
following the same underlying joint policy.
|
protected JointPolicy jointPolicy
protected int actingAgent
protected boolean synchronizeJointActionSelectionAmongAgents
public PolicyFromJointPolicy(JointPolicy jointPolicy)
jointPolicy
- the underlying joint polciypublic PolicyFromJointPolicy(JointPolicy jointPolicy, boolean synchronizeJointActionSelectionAmongAgents)
jointPolicy
- the underlying joint polciysynchronizeJointActionSelectionAmongAgents
- whether actions should be synchronized with other agents following the same underlying joint policy.public PolicyFromJointPolicy(int actingAgent, JointPolicy jointPolicy)
actingAgent
- the acting agent namejointPolicy
- the underlying joint polciypublic PolicyFromJointPolicy(int actingAgent, JointPolicy jointPolicy, boolean synchronizeJointActionSelectionAmongAgents)
actingAgent
- the acting agent namejointPolicy
- the underlying joint polciysynchronizeJointActionSelectionAmongAgents
- whether actions should be synchronized with other agents following the same underlying joint policy.public void setJointPolicy(JointPolicy jointPolicy)
jointPolicy
- the underlying joint polciypublic JointPolicy getJointPolicy()
public void setActingAgent(int agentNum)
agentNum
- the acting agentpublic void setSynchronizeJointActionSelectionAmongAgents(boolean synchronizeJointActionSelectionAmongAgents)
synchronizeJointActionSelectionAmongAgents
- whether agent actions should be synchronized or not.public int getActingAgent()
public Action action(State s)
Policy
public double actionProb(State s, Action a)
Policy
actionProb
in interface Policy
s
- the state of interesta
- the action that may be taken in the statepublic java.util.List<ActionProb> policyDistribution(State s)
EnumerablePolicy
policyDistribution
in interface EnumerablePolicy
s
- the state for which an action distribution should be returnedpublic boolean definedFor(State s)
Policy
definedFor
in interface Policy
s
- the input state to test for whether this policy is definedState
s, false otherwise.public PolicyFromJointPolicy copy()