protected class MADynamicProgramming.BackupBasedQSource extends java.lang.Object implements QSourceForSingleAgent
QSourceForSingleAgent
implementation which stores a value function for an agent and produces Joint action Q-values
by marginalizing over the transition dynamics the reward and discounted next state value.QSourceForSingleAgent.HashBackedQSource
Modifier and Type | Field and Description |
---|---|
protected int |
agentNum
The agent for which this value function is assigned.
|
protected java.util.Map<HashableState,java.lang.Double> |
valueFunction
The tabular value function
|
Constructor and Description |
---|
BackupBasedQSource(int agentNum)
Initializes a value function for the agent of the given name.
|
Modifier and Type | Method and Description |
---|---|
JAQValue |
getQValueFor(State s,
JointAction ja)
Returns a Q-value (represented with a
JAQValue object) stored for the given state and joint action. |
double |
getValue(HashableState sh)
Returns the stored state value for hashed state sh, or creates an entry with an initial value corresponding to the
MADynamicProgramming
instance's value function initialization object and returns that value if the the quried state has never previously been indexed. |
void |
setValue(HashableState sh,
double v)
Sets the value of the state in this objects value function map.
|
protected int agentNum
protected java.util.Map<HashableState,java.lang.Double> valueFunction
public BackupBasedQSource(int agentNum)
agentNum
- the name of the agent for which the value function corresponds.public JAQValue getQValueFor(State s, JointAction ja)
QSourceForSingleAgent
JAQValue
object) stored for the given state and joint action. Modification to the returned object
will directly modify the stored value that will be returned in subsequent calls to this method.getQValueFor
in interface QSourceForSingleAgent
s
- the Q-value's associated stateja
- the Q-value's associated joint acitonJAQValue
for the given state and joint action.public double getValue(HashableState sh)
MADynamicProgramming
instance's value function initialization object and returns that value if the the quried state has never previously been indexed.sh
- the state for which the value is to be returned.public void setValue(HashableState sh, double v)
sh
- the hashed state for which the value is to be setv
- the value to set the state to.