public class PolicyFromJointPolicy extends Policy
JointPolicy.setTargetAgent(String)
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.Policy.ActionProb, Policy.PolicyUndefinedException, Policy.RandomPolicy
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
actingAgentName
The acting agent's name whose actions from the joint policy will be returned.
|
protected JointPolicy |
jointPolicy
The underlying joint policy from which actions are selected.
|
protected boolean |
synchronizeJointActionSelectionAmongAgents |
annotateOptionDecomposition, evaluateDecomposesOptions
Constructor and Description |
---|
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.
|
PolicyFromJointPolicy(java.lang.String actingAgentName,
JointPolicy jointPolicy)
Initializes with the acting agent name whose actions from the underlying joint policy will be returned.
|
PolicyFromJointPolicy(java.lang.String actingAgentName,
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.
|
Modifier and Type | Method and Description |
---|---|
PolicyFromJointPolicy |
copy()
Returns a copy of this policy, which entails of first making a copy of the joint policy.
|
java.lang.String |
getActingAgentName()
Returns the acting agent's name
|
AbstractGroundedAction |
getAction(State s)
This method will return an action sampled by the policy for the given state.
|
java.util.List<Policy.ActionProb> |
getActionDistributionForState(State s)
This method will return action probability distribution defined by the policy.
|
JointPolicy |
getJointPolicy()
Returns the underlying joint policy
|
boolean |
isDefinedFor(State s)
Specifies whether this policy is defined for the input state.
|
boolean |
isStochastic()
Indicates whether the policy is stochastic or deterministic.
|
void |
setActingAgentName(java.lang.String agentName)
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.
|
evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateMethodsShouldAnnotateOptionDecomposition, evaluateMethodsShouldDecomposeOption, getDeterministicPolicy, getProbOfAction, getProbOfActionGivenDistribution, getProbOfActionGivenDistribution, sampleFromActionDistribution
protected JointPolicy jointPolicy
protected java.lang.String actingAgentName
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(java.lang.String actingAgentName, JointPolicy jointPolicy)
actingAgentName
- the acting agent namejointPolicy
- the underlying joint polciypublic PolicyFromJointPolicy(java.lang.String actingAgentName, JointPolicy jointPolicy, boolean synchronizeJointActionSelectionAmongAgents)
actingAgentName
- 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 setActingAgentName(java.lang.String agentName)
agentName
- the acting agent's namepublic void setSynchronizeJointActionSelectionAmongAgents(boolean synchronizeJointActionSelectionAmongAgents)
synchronizeJointActionSelectionAmongAgents
- whether agent actions should be synchronized or not.public java.lang.String getActingAgentName()
public AbstractGroundedAction getAction(State s)
Policy
public java.util.List<Policy.ActionProb> getActionDistributionForState(State s)
Policy
getActionDistributionForState
in class Policy
s
- the state for which an action distribution should be returnedpublic boolean isStochastic()
Policy
isStochastic
in class Policy
public boolean isDefinedFor(State s)
Policy
isDefinedFor
in class Policy
s
- the input state to test for whether this policy is definedState
s, false otherwise.public PolicyFromJointPolicy copy()