public class TabularModel extends Model
Modifier and Type | Field and Description |
---|---|
protected HashableStateFactory |
hashingFactory
The hashing factory to use for indexing states
|
protected RewardFunction |
modeledRF
The modeled reward function.
|
protected TerminalFunction |
modeledTF
The modeled terminal funciton.
|
protected int |
nConfident
The number of transitions necessary to be confident in a model's prediction.
|
protected Domain |
sourceDomain
The source actual domain object for which actions will be modeled.
|
protected java.util.Map<HashableState,burlap.behavior.singleagent.learning.modellearning.models.TabularModel.StateNode> |
stateNodes
A mapping from (hashed) states to state nodes that store transition statistics
|
protected java.util.Set<HashableState> |
terminalStates
The set of states marked as terminal states.
|
Constructor and Description |
---|
TabularModel(Domain sourceDomain,
HashableStateFactory hashingFactory,
int nConfident)
Initializes.
|
Modifier and Type | Method and Description |
---|---|
RewardFunction |
getModelRF()
Returns the learned reward function in this model
|
TerminalFunction |
getModelTF()
Returns the learned terminal function in this model
|
protected burlap.behavior.singleagent.learning.modellearning.models.TabularModel.StateActionNode |
getOrCreateActionNode(HashableState sh,
GroundedAction ga)
Returns the
TabularModel.StateActionNode object associated with the given hashed state and action. |
protected burlap.behavior.singleagent.learning.modellearning.models.TabularModel.StateActionNode |
getStateActionNode(HashableState sh,
GroundedAction ga)
Returns the
TabularModel.StateActionNode object associated with the given hashed state and action. |
java.util.List<TransitionProbability> |
getTransitionProbabilities(State s,
GroundedAction ga)
Returns this model's transition probabilities for the given source state and action
|
java.util.List<AbstractGroundedAction> |
getUnmodeledActionsForState(State s)
Returns a list specifying the actions for which the transition dynamics are not yet "known."
|
void |
resetModel()
Resets the model data so that learning can begin anew.
|
State |
sampleModelHelper(State s,
GroundedAction ga)
A helper method to sample this model's transition dynamics for the given state and action.
|
boolean |
stateTransitionsAreModeled(State s)
Indicates whether this model "knows" the transition dynamics from the given input state for all applicable actions.
|
boolean |
transitionIsModeled(State s,
GroundedAction ga)
Indicates whether this model "knows" how the transition dynamics from the given input state and action work.
|
void |
updateModel(State s,
GroundedAction ga,
State sprime,
double r,
boolean sprimeIsTerminal)
Causes this model to be updated with a new interaction with the world.
|
sampleModel, sampleTransitionFromTransitionProbabilities, updateModel
protected Domain sourceDomain
protected HashableStateFactory hashingFactory
protected java.util.Map<HashableState,burlap.behavior.singleagent.learning.modellearning.models.TabularModel.StateNode> stateNodes
protected java.util.Set<HashableState> terminalStates
protected int nConfident
protected TerminalFunction modeledTF
protected RewardFunction modeledRF
public TabularModel(Domain sourceDomain, HashableStateFactory hashingFactory, int nConfident)
sourceDomain
- the source domain whose actions will be modeled.hashingFactory
- the hashing factory to index statesnConfident
- the number of observed transitions to be confidnent in the model's prediction.public RewardFunction getModelRF()
Model
getModelRF
in class Model
public TerminalFunction getModelTF()
Model
getModelTF
in class Model
public boolean transitionIsModeled(State s, GroundedAction ga)
Model
transitionIsModeled
in class Model
s
- the state that is checkedga
- the action to take in state spublic boolean stateTransitionsAreModeled(State s)
Model
stateTransitionsAreModeled
in class Model
s
- the state that is checked.public java.util.List<AbstractGroundedAction> getUnmodeledActionsForState(State s)
Model
getUnmodeledActionsForState
in class Model
s
- the state for which the un-modeled actions should be returned.List
of AbstractGroundedAction
objectspublic State sampleModelHelper(State s, GroundedAction ga)
Model
sampleModelHelper
in class Model
s
- a copied source state which can be directly modified.ga
- the action taken in the source statepublic java.util.List<TransitionProbability> getTransitionProbabilities(State s, GroundedAction ga)
Model
getTransitionProbabilities
in class Model
s
- the source statega
- an action taken in the source statepublic void updateModel(State s, GroundedAction ga, State sprime, double r, boolean sprimeIsTerminal)
Model
updateModel
in class Model
s
- a source statega
- an action that was taken in the source statesprime
- the state to which the agent transitioned for taking actionr
- a reward that was received for taking the given action in the given source state and transitioning to the given next statesprimeIsTerminal
- whether the next state is a terminal state or notprotected burlap.behavior.singleagent.learning.modellearning.models.TabularModel.StateActionNode getStateActionNode(HashableState sh, GroundedAction ga)
TabularModel.StateActionNode
object associated with the given hashed state and action.
If there is not an associated TabularModel.StateActionNode
object, then null is returned.sh
- the hashed statega
- the grounded actionTabularModel.StateActionNode
or null if it does not exist.protected burlap.behavior.singleagent.learning.modellearning.models.TabularModel.StateActionNode getOrCreateActionNode(HashableState sh, GroundedAction ga)
TabularModel.StateActionNode
object associated with the given hashed state and action.
If there is not an associated TabularModel.StateActionNode
object, then one will be created.sh
- the hashed statega
- the grounded actionTabularModel.StateActionNode
public void resetModel()
Model
resetModel
in class Model