public abstract class Model
extends java.lang.Object
transitionIsModeled(State, GroundedAction)
method, which can be used to determine when the model is confident in its predictions from a given input state and action. This is useful for RMax
algorithms which treat "unknown" states-action (or under sampled state-actions) specially.Modifier and Type | Field and Description |
---|---|
protected java.util.Random |
rand
Random number generator
|
Constructor and Description |
---|
Model() |
Modifier and Type | Method and Description |
---|---|
abstract RewardFunction |
getModelRF()
Returns the learned reward function in this model
|
abstract TerminalFunction |
getModelTF()
Returns the learned terminal function in this model
|
abstract java.util.List<TransitionProbability> |
getTransitionProbabilities(State s,
GroundedAction ga)
Returns this model's transition probabilities for the given source state and action
|
abstract java.util.List<AbstractGroundedAction> |
getUnmodeledActionsForState(State s)
Returns a list specifying the actions for which the transition dynamics are not yet "known."
|
abstract void |
resetModel()
Resets the model data so that learning can begin anew.
|
State |
sampleModel(State s,
GroundedAction ga)
A method to sample this model's transition dynamics for the given state and action.
|
abstract State |
sampleModelHelper(State s,
GroundedAction ga)
A helper method to sample this model's transition dynamics for the given state and action.
|
protected State |
sampleTransitionFromTransitionProbabilities(State s,
GroundedAction ga)
Will return a sampled outcome state by calling the
getTransitionProbabilities(State, GroundedAction) method and randomly drawing a state
according to its distribution |
abstract boolean |
stateTransitionsAreModeled(State s)
Indicates whether this model "knows" the transition dynamics from the given input state for all applicable actions.
|
abstract boolean |
transitionIsModeled(State s,
GroundedAction ga)
Indicates whether this model "knows" how the transition dynamics from the given input state and action work.
|
abstract 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.
|
public abstract RewardFunction getModelRF()
public abstract TerminalFunction getModelTF()
public abstract boolean transitionIsModeled(State s, GroundedAction ga)
s
- the state that is checkedga
- the action to take in state spublic abstract boolean stateTransitionsAreModeled(State s)
s
- the state that is checked.public abstract java.util.List<AbstractGroundedAction> getUnmodeledActionsForState(State s)
s
- the state for which the unmodeled actions should be returned.List
of AbstractGroundedAction
objectspublic final State sampleModel(State s, GroundedAction ga)
s
- The source statega
- the action taken in the source statepublic abstract State sampleModelHelper(State s, GroundedAction ga)
s
- a copied source state which can be directly modified.ga
- the action taken in the source statepublic abstract java.util.List<TransitionProbability> getTransitionProbabilities(State s, GroundedAction ga)
s
- the source statega
- an action taken in the source statepublic abstract void updateModel(State s, GroundedAction ga, State sprime, double r, boolean sprimeIsTerminal)
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 notpublic abstract void resetModel()
protected State sampleTransitionFromTransitionProbabilities(State s, GroundedAction ga)
getTransitionProbabilities(State, GroundedAction)
method and randomly drawing a state
according to its distributions
- a source statega
- the action taken in the source state