public abstract class MDPSolver extends java.lang.Object implements MDPSolverInterface
MDPSolverInterface and provides
the common data members and method implementations that most all algorithms will need to use
and provides methods for manipulating them that are common.| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<ActionType> |
actionTypes
The list of actions this solver can use.
|
protected int |
debugCode
The debug code use for calls to
DPrint |
protected SADomain |
domain
The domain to solve
|
protected double |
gamma
The MDP discount factor
|
protected HashableStateFactory |
hashingFactory
The hashing factory to use for hashing states in tabular solvers
|
protected SampleModel |
model |
protected boolean |
usingOptionModel |
| Constructor and Description |
|---|
MDPSolver() |
| Modifier and Type | Method and Description |
|---|---|
void |
addActionType(ActionType a)
Adds an additional action the solver that is not included in the domain definition.
|
protected java.util.List<Action> |
applicableActions(State s)
Returns all applicable actions in the provided state for all the actions that this MDP Solver can use.
|
java.util.List<ActionType> |
getActionTypes()
Returns a copy of all actions this solver uses for reasoning; including added actions that are not part of the
domain specification (e.g.,
Options). |
int |
getDebugCode()
Returns the debug code used by this solver for calls to
DPrint |
Domain |
getDomain()
Returns the
Domain this solver solves. |
double |
getGamma()
Returns gamma, the discount factor used by this solver
|
HashableStateFactory |
getHashingFactory()
Returns the
HashableStateFactory this solver uses. |
SampleModel |
getModel()
Returns the model being used by this solver
|
abstract void |
resetSolver()
This method resets all solver results so that a solver can be restarted fresh
as if had never solved the MDP.
|
void |
setActionTypes(java.util.List<ActionType> actionTypes)
Sets the action set the solver should use.
|
void |
setDebugCode(int code)
Sets the debug code to be used by calls to
DPrint |
void |
setDomain(SADomain domain)
Sets the domain of this solver.
|
void |
setGamma(double gamma)
Sets gamma, the discount factor used by this solver
|
void |
setHashingFactory(HashableStateFactory hashingFactory)
Sets the
HashableStateFactory used to hash states for tabular solvers. |
void |
setModel(SampleModel model)
Sets the model to use for this solver
|
void |
solverInit(SADomain domain,
double gamma,
HashableStateFactory hashingFactory)
Initializes the solver with the common elements.
|
HashableState |
stateHash(State s)
A shorthand method for hashing a state.
|
void |
toggleDebugPrinting(boolean toggle)
Toggles whether the solver's calls to
DPrint should be printed. |
protected SADomain domain
protected SampleModel model
protected HashableStateFactory hashingFactory
protected double gamma
protected java.util.List<ActionType> actionTypes
Options.protected int debugCode
DPrintprotected boolean usingOptionModel
public abstract void resetSolver()
MDPSolverInterfaceresetSolver in interface MDPSolverInterfacepublic void solverInit(SADomain domain, double gamma, HashableStateFactory hashingFactory)
MDPSolverInterfacesolverInit in interface MDPSolverInterfacedomain - the domain to be solved.gamma - the MDP discount factorhashingFactory - the hashing factory used to store states (may be set to null if the solver is not tabular)public void addActionType(ActionType a)
MDPSolverInterfaceOption
should be added using this method.addActionType in interface MDPSolverInterfacea - the action to add to the solverpublic void setModel(SampleModel model)
MDPSolverInterfacesetModel in interface MDPSolverInterfacemodel - the model to usepublic SampleModel getModel()
MDPSolverInterfacegetModel in interface MDPSolverInterfaceSampleModelpublic void setActionTypes(java.util.List<ActionType> actionTypes)
MDPSolverInterfacesetActionTypes in interface MDPSolverInterfaceactionTypes - the actions the solver should use.public java.util.List<ActionType> getActionTypes()
MDPSolverInterfaceOptions). Modifying
the returned list will not modify the action list this solver uses.getActionTypes in interface MDPSolverInterfaceList of all actions this solver uses.public void setHashingFactory(HashableStateFactory hashingFactory)
MDPSolverInterfaceHashableStateFactory used to hash states for tabular solvers.setHashingFactory in interface MDPSolverInterfacehashingFactory - the HashableStateFactory used to hash states for tabular solvers.public HashableStateFactory getHashingFactory()
MDPSolverInterfaceHashableStateFactory this solver uses.getHashingFactory in interface MDPSolverInterfaceHashableStateFactory this solver uses.public double getGamma()
MDPSolverInterfacegetGamma in interface MDPSolverInterfacepublic void setGamma(double gamma)
MDPSolverInterfacesetGamma in interface MDPSolverInterfacegamma - the discount factor used by this solverpublic void setDebugCode(int code)
MDPSolverInterfaceDPrintsetDebugCode in interface MDPSolverInterfacecode - the code to be used by DPrintpublic int getDebugCode()
MDPSolverInterfaceDPrintgetDebugCode in interface MDPSolverInterfaceDPrintpublic void toggleDebugPrinting(boolean toggle)
MDPSolverInterfaceDPrint should be printed.toggleDebugPrinting in interface MDPSolverInterfacetoggle - whether to print the calls to DPrintpublic void setDomain(SADomain domain)
MDPSolverInterfaceMDPSolverInterface.addActionType(ActionType)
method, you will have to do so again.setDomain in interface MDPSolverInterfacedomain - the domain this solver should use.public Domain getDomain()
MDPSolverInterfaceDomain this solver solves.getDomain in interface MDPSolverInterfaceDomain this solver solves.public HashableState stateHash(State s)
s - the state to hashprotected java.util.List<Action> applicableActions(State s)
ActionTypes not included in the domain added (e.g., types for Options),
this method will include those as well.s - the source state for which to get all GroundedActions.