public abstract class OOMDPPlanner
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Action> |
actions
The list of actions this planner can use.
|
protected boolean |
containsParameterizedActions
Indicates whether the action set for this planner includes parametrized actions
|
protected int |
debugCode
The debug code use for calls to
DPrint |
protected Domain |
domain
The domain in which planning will be performed
|
protected double |
gamma
The discount factor
|
protected StateHashFactory |
hashingFactory
The hashing factory to use for hashing states
|
protected java.util.Map<StateHashTuple,StateHashTuple> |
mapToStateIndex
A mapping to internal states that are stored.
|
protected RewardFunction |
rf
The reward function used for planning
|
protected TerminalFunction |
tf
The terminal function for identifying terminal states
|
Constructor and Description |
---|
OOMDPPlanner() |
Modifier and Type | Method and Description |
---|---|
void |
addNonDomainReferencedAction(Action a)
Adds an additional action the planner that is not included in the domain definition.
|
java.util.List<Action> |
getActions()
Returns a copy of all actions this planner uses for reasoning; including added actions that are not part of the
domain specification (e.g.,
Option s). |
protected java.util.List<GroundedAction> |
getAllGroundedActions(State s)
Returns all grounded actions in the provided state for all the actions that this planner can use.
|
int |
getDebugCode()
Returns the debug code used by this planner for calls to
DPrint |
Domain |
getDomain() |
double |
getGamma()
Returns gamma, the discount factor used by this planner
|
StateHashFactory |
getHashingFactory()
Returns the
StateHashFactory this planner uses. |
RewardFunction |
getRf() |
RewardFunction |
getRF()
Returns the
RewardFunction this planner uses. |
TerminalFunction |
getTf() |
TerminalFunction |
getTF()
Returns the
TerminalFunction this planner uses. |
abstract void |
planFromState(State initialState)
This method will cause the planner to begin planning from the specified initial state
|
void |
plannerInit(Domain domain,
RewardFunction rf,
TerminalFunction tf,
double gamma,
StateHashFactory hashingFactory)
Initializes the planner with the common planning elements
|
abstract void |
resetPlannerResults()
Use this method to reset all planner results so that planning can be started fresh with a call to
planFromState(State)
as if no planning had ever been performed before. |
void |
setActions(java.util.List<Action> actions)
Sets the action set the planner should use.
|
void |
setDebugCode(int code)
Sets the debug code to be used by calls to
DPrint |
void |
setDomain(Domain domain)
Sets the domain of this planner.
|
void |
setGamma(double gamma)
Sets gamma, the discount factor used by this planner
|
void |
setRf(RewardFunction rf)
Sets the reward function used by this planner
|
void |
setTf(TerminalFunction tf)
Sets the terminal state function used by this planner
|
StateHashTuple |
stateHash(State s)
A shorthand method for hashing a state.
|
void |
toggleDebugPrinting(boolean toggle)
Toggles whether the planner's calls to
DPrint should be printed. |
protected GroundedAction |
translateAction(GroundedAction a,
java.util.Map<java.lang.String,java.lang.String> matching)
Takes a source parameterized GroundedAction and a matching between object instances of two different states and returns a GroudnedAction
with parameters using the matched parameters.
|
protected Domain domain
protected StateHashFactory hashingFactory
protected RewardFunction rf
protected TerminalFunction tf
protected double gamma
protected java.util.List<Action> actions
protected java.util.Map<StateHashTuple,StateHashTuple> mapToStateIndex
protected boolean containsParameterizedActions
protected int debugCode
DPrint
public abstract void planFromState(State initialState)
initialState
- the initial state of the planning problempublic abstract void resetPlannerResults()
planFromState(State)
as if no planning had ever been performed before. Specifically, data produced from calls to the
planFromState(State)
will be cleared, but all other planner settings should remain the same.
This is useful if the reward function or transition dynamics have changed, thereby
requiring new results to be computed. If there were other objects this planner was provided that may have changed
and need to be reset, you will need to reset them yourself. For instance, if you told a planner to follow a policy
that had a temperature parameter decrease with time, you will need to reset the policy's temperature yourself.public void plannerInit(Domain domain, RewardFunction rf, TerminalFunction tf, double gamma, StateHashFactory hashingFactory)
domain
- the domain in which planning will be performedrf
- the reward functiontf
- the terminal state functiongamma
- the discount factorhashingFactory
- the hashing factory used to store states (may be set to null if the planner is not tabular)public void addNonDomainReferencedAction(Action a)
Option
should be added using this method.a
- the action to add to the plannerpublic void setActions(java.util.List<Action> actions)
actions
- the actions the planner should use.public java.util.List<Action> getActions()
Option
s). Modifying
the returned list will not modify the action list this planner uses.List
of all actions this planner uses.public TerminalFunction getTF()
TerminalFunction
this planner uses.TerminalFunction
this planner uses.public RewardFunction getRF()
RewardFunction
this planner uses.RewardFunction
this planner uses.public StateHashFactory getHashingFactory()
StateHashFactory
this planner uses.StateHashFactory
this planner uses.public void setRf(RewardFunction rf)
rf
- the reward function to be used by this plannerpublic void setTf(TerminalFunction tf)
tf
- the terminal function to be used by this plannerpublic double getGamma()
public void setGamma(double gamma)
gamma
- the discount factor used by this plannerpublic void setDebugCode(int code)
DPrint
code
- the code to be used by DPrint
public int getDebugCode()
DPrint
DPrint
public void toggleDebugPrinting(boolean toggle)
DPrint
should be printed.toggle
- whether to print the calls to DPrint
public void setDomain(Domain domain)
addNonDomainReferencedAction(burlap.oomdp.singleagent.Action)
method, you will have to do so again.domain
- the domain this planner should use.public Domain getDomain()
public RewardFunction getRf()
public TerminalFunction getTf()
protected GroundedAction translateAction(GroundedAction a, java.util.Map<java.lang.String,java.lang.String> matching)
a
- the source action that needs to be translatedmatching
- a map from object instance names to other object instance names.public StateHashTuple stateHash(State s)
s
- the state to hashprotected java.util.List<GroundedAction> getAllGroundedActions(State s)
s
- the source state for which to get all GroundedActions.