public class EGreedyJointPolicy extends MAQSourcePolicy implements EnumerablePolicy
| Modifier and Type | Field and Description |
|---|---|
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
|
protected int |
targetAgent
The agent whose q-values dictate which joint actions to return
|
agentsInJointPolicy, agentsSynchronizedSoFar, lastSyncedState, lastSynchronizedJointAction| Constructor and Description |
|---|
EGreedyJointPolicy(double epsilon)
Initializes for a given epsilon value.
|
EGreedyJointPolicy(MultiAgentQLearning actingAgent,
double epsilon,
int targetAgentNum)
Initializes for a multi-agent Q-learning object and epsilon value.
|
| 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.
|
JointPolicy |
copy()
Creates a copy of this joint policy and returns it.
|
boolean |
definedFor(State s)
Specifies whether this policy is defined for the input state.
|
java.util.List<ActionProb> |
policyDistribution(State s)
This method will return action probability distribution defined by the policy.
|
void |
setQSourceProvider(MultiAgentQSourceProvider provider)
Sets the
MultiAgentQSourceProvider that will be used to define this object's joint policy. |
void |
setTargetAgent(int agentNum)
Sets the target privileged agent from which this joint policy is defined.
|
getAgentsInJointPolicy, getAgentSynchronizedActionSelection, getAllJointActions, setAgentsInJointPolicy, setAgentsInJointPolicyFromWorld, setAgentTypesInJointPolicyprotected MultiAgentQSourceProvider qSourceProvider
protected double epsilon
protected java.util.Random rand
protected int targetAgent
public EGreedyJointPolicy(double epsilon)
JointPolicy.setAgentsInJointPolicy(List),
setTargetAgent(int), 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 EGreedyJointPolicy(MultiAgentQLearning actingAgent, double epsilon, int targetAgentNum)
JointPolicy.setAgentsInJointPolicy(List). Note that the MultiAgentQLearning and MultiAgentDPPlanningAgent
agents may do this themselves. Consult the documentation to check.actingAgent - the agent whose Q-values are maximized.epsilon - the fraction of the time [0, 1] that the agent selections random actions.targetAgentNum - the target agent identifier whose Q-values should be usedpublic Action action(State s)
Policypublic double actionProb(State s, Action a)
PolicyactionProb in interface Policys - the state of interesta - the action that may be taken in the statepublic java.util.List<ActionProb> policyDistribution(State s)
EnumerablePolicypolicyDistribution in interface EnumerablePolicys - the state for which an action distribution should be returnedpublic boolean definedFor(State s)
PolicydefinedFor in interface Policys - the input state to test for whether this policy is definedState s, false otherwise.public void setQSourceProvider(MultiAgentQSourceProvider provider)
MAQSourcePolicyMultiAgentQSourceProvider that will be used to define this object's joint policy.setQSourceProvider in class MAQSourcePolicyprovider - the MultiAgentQSourceProvider that will be used to define this object's joint policy.public void setTargetAgent(int agentNum)
JointPolicysetTargetAgent in class JointPolicyagentNum - the target agent.public JointPolicy copy()
JointPolicycopy in class JointPolicy