public class EGreedyMaxWellfare extends MAQSourcePolicy
Policy.ActionProb, Policy.GroundedAnnotatedAction, Policy.PolicyUndefinedException
Modifier and Type | Field and Description |
---|---|
protected boolean |
breakTiesRandomly
Whether ties should be broken randomly or not.
|
protected double |
epsilon
The epsilon parameter specifying how often random joint actions are returned
|
protected MultiAgentQSourceProvider |
qSourceProvider
The multi-agent q-source provider
|
protected java.util.Random |
rand
A random object used for sampling
|
agentsInJointPolicy, agentsSyncrhonizedSoFar, lastSyncedState, lastSynchronizedJointAction
annotateOptionDecomposition, evaluateDecomposesOptions
Constructor and Description |
---|
EGreedyMaxWellfare(double epsilon)
Initializes for a given epsilon value.
|
EGreedyMaxWellfare(double epsilon,
boolean breakTiesRandomly)
Initializes for a given epsilon value and whether to break ties randomly.
|
EGreedyMaxWellfare(MultiAgentQLearning actingAgent,
double epsilon)
Initializes for a multi-agent Q-learning object and epsilon value.
|
EGreedyMaxWellfare(MultiAgentQLearning actingAgent,
double epsilon,
boolean breakTiesRandomly)
Initializes for a multi-agent Q-learning object and epsilon value.
|
Modifier and Type | Method and Description |
---|---|
JointPolicy |
copy()
Creates a copy of this joint policy and returns it.
|
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.
|
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 |
setBreakTiesRandomly(boolean breakTiesRandomly)
Whether to break ties randomly or deterministically.
|
void |
setQSourceProvider(MultiAgentQSourceProvider provider)
Sets the
MultiAgentQSourceProvider that will be used to define this object's joint policy. |
void |
setTargetAgent(java.lang.String agentName)
Sets the target privledged agent from which this joint policy is defined.
|
getAgentsInJointPolicy, getAgentSynchronizedActionSelection, getAllJointActions, setAgentsInJointPolicy, setAgentsInJointPolicy, setAgentsInJointPolicyFromWorld
evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateMethodsShouldAnnotateOptionDecomposition, evaluateMethodsShouldDecomposeOption, followAndRecordPolicy, followAndRecordPolicy, getDeterministicPolicy, getProbOfAction, getProbOfActionGivenDistribution, getProbOfActionGivenDistribution, sampleFromActionDistribution
protected MultiAgentQSourceProvider qSourceProvider
protected double epsilon
protected java.util.Random rand
protected boolean breakTiesRandomly
public EGreedyMaxWellfare(double epsilon)
JointPolicy.setAgentsInJointPolicy(java.util.Map)
,
and setQSourceProvider(MultiAgentQSourceProvider)
before the policy can be queried.
Note that the MultiAgentQLearning
and MultiAgentDPPlanningAgent
agents may do this themselves. Consult the documentation
to check.epsilon
- the fraction of the time [0, 1] that the agent selections random actions.public EGreedyMaxWellfare(double epsilon, boolean breakTiesRandomly)
JointPolicy.setAgentsInJointPolicy(java.util.Map)
,
and setQSourceProvider(MultiAgentQSourceProvider)
before the policy can be queried.
Note that the MultiAgentQLearning
and MultiAgentDPPlanningAgent
agents may do this themselves. Consult the documentation
to check.epsilon
- the fraction of the time [0, 1] that the agent selections random actions.breakTiesRandomly
- whether ties should be broken randomly (true) or not (false)public EGreedyMaxWellfare(MultiAgentQLearning actingAgent, double epsilon)
JointPolicy.setAgentsInJointPolicy(java.util.Map)
. Note that the MultiAgentQLearning
and MultiAgentDPPlanningAgent
agents may do this themselves. Consult the documentation to check.actingAgent
- the agent who will use this policy.epsilon
- the fraction of the time [0, 1] that the agent selections random actions.public EGreedyMaxWellfare(MultiAgentQLearning actingAgent, double epsilon, boolean breakTiesRandomly)
JointPolicy.setAgentsInJointPolicy(java.util.Map)
. Note that the MultiAgentQLearning
and MultiAgentDPPlanningAgent
agents may do this themselves. Consult the documentation to check.actingAgent
- the agent who will use this policy.epsilon
- the fraction of the time [0, 1] that the agent selections random actions.breakTiesRandomly
- whether ties should be broken randomly (true) or not (false)public void setBreakTiesRandomly(boolean breakTiesRandomly)
breakTiesRandomly
- true if ties will be broken randomly; false if ties will be broken detemrinistically.public void setQSourceProvider(MultiAgentQSourceProvider provider)
MAQSourcePolicy
MultiAgentQSourceProvider
that will be used to define this object's joint policy.setQSourceProvider
in class MAQSourcePolicy
provider
- the MultiAgentQSourceProvider
that will be used to define this object's joint policy.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 void setTargetAgent(java.lang.String agentName)
JointPolicy
setTargetAgent
in class JointPolicy
agentName
- the name of the target agent.public JointPolicy copy()
JointPolicy
copy
in class JointPolicy