public static class QSourceForSingleAgent.HashBackedQSource extends java.lang.Object implements QSourceForSingleAgent
QSourceForSingleAgent
interface that has Q-values backed by hashmaps. Specifically, a map from
hashed stats to a map from joint actions to stored JAQValue
objects. This object also takes as ValueFunctionInitialization
object so that Q-values for state-jointaction pairs not previously stored can be intitialized.QSourceForSingleAgent.HashBackedQSource
Modifier and Type | Field and Description |
---|---|
protected HashableStateFactory |
hashingFactory |
protected ValueFunctionInitialization |
qInit |
protected java.util.HashMap<HashableState,java.util.Map<JointAction,JAQValue>> |
qValues |
Constructor and Description |
---|
QSourceForSingleAgent.HashBackedQSource(HashableStateFactory hashingFactory,
ValueFunctionInitialization qInit)
Initializes with a given state hashing factory and value funciton initialization for Q-values.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<JointAction,JAQValue> |
getJAMap(State s)
Returns the Map from joint actions to q-values for a given state.
|
JAQValue |
getQValueFor(State s,
JointAction ja)
Returns a Q-value (represented with a
JAQValue object) stored for the given state and joint action. |
protected java.util.HashMap<HashableState,java.util.Map<JointAction,JAQValue>> qValues
protected HashableStateFactory hashingFactory
protected ValueFunctionInitialization qInit
public QSourceForSingleAgent.HashBackedQSource(HashableStateFactory hashingFactory, ValueFunctionInitialization qInit)
hashingFactory
- the state hashing factory used to index statesqInit
- the value function intitliazaiton to use for previously unqueried statespublic 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.protected java.util.Map<JointAction,JAQValue> getJAMap(State s)
s
- the state for which the map is returned.