|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmarkov.jmdp.MDP<S,A>
S
- Current state.A
- Action taken.public abstract class MDP<S extends State,A extends Action>
This class is the main framework to build a Dynamic Programming Problem. It�s initially created to work over Markov Decision Problems which imply random probabilities but can easily be worked out for deterministic problems if the probabilities are set to one. This class should not me extended directly on problems. The default package has FiniteMDP and InfiniteMDP classes that are intended to be extended on problems. See the examples for a clearer reference.
FiniteMDP
,
DTMDP
Field Summary | |
---|---|
protected boolean |
finite
States whether the problem is a finite horizon problem or not. |
protected States<S> |
initial
Set of initial states. |
protected DebugReporter |
reporter
Reporter used for debug information. |
Constructor Summary | |
---|---|
MDP()
|
Method Summary | |
---|---|
void |
debug(int level,
java.lang.String message)
Prints a message in the reporter. |
void |
debug(int level,
java.lang.String s,
boolean newline)
Prints debug information in the reporter. |
void |
debug(int level,
java.lang.String s,
boolean newline,
boolean indent)
Prints debug information in the reporter. |
int |
getDebugLevel()
Gets the current debug level. |
protected abstract Solver<S,A> |
getDefaultSolver()
The class that extends MDP must define the default solver to use. |
Policy<S,A> |
getOptimalPolicy()
Returns the optimal policy. |
ValueFunction<S> |
getOptimalValueFunction()
Returns the optimal ValueFunction. |
DebugReporter |
getReporter()
|
Solver<S,A> |
getSolver()
|
boolean |
isFinite()
|
boolean |
isSolved()
Indicates if the problems has been solved |
double |
operation(double present,
double future)
The Operator between present and future costs. |
void |
printSolution()
Prints the solution to Standard output. |
void |
printSolution(java.io.PrintWriter pw)
Prints the solution to the given PrintWriter |
void |
setDebugLevel(int level)
Sets teh current level |
void |
setReporter(DebugReporter reporter)
|
void |
setSolver(Solver<S,A> solver)
|
void |
solve()
Solves the problem. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean finite
protected States<S extends State> initial
protected DebugReporter reporter
Constructor Detail |
---|
public MDP()
Method Detail |
---|
public final Policy<S,A> getOptimalPolicy() throws SolverException
SolverException
- Exception thrown if a solution cannot be foundpublic final boolean isSolved()
public final boolean isFinite()
public final void solve() throws SolverException
SolverException
- This Exception is thrown if a solution cannot be found.getDefaultSolver()
public Solver<S,A> getSolver()
public void setSolver(Solver<S,A> solver)
solver
- The solver to set.protected abstract Solver<S,A> getDefaultSolver()
public ValueFunction<S> getOptimalValueFunction() throws SolverException
SolverException
- This exception is thrown if a solution cannot be found.public double operation(double present, double future)
present
- Cost of current transitionfuture
- Cost of future transitions.
public DebugReporter getReporter()
public void setReporter(DebugReporter reporter)
reporter
- The reporter to set.public void debug(int level, java.lang.String message)
level
- maximum debug level at which to show messagemessage
- messageDebugReporter
public void debug(int level, java.lang.String s, boolean newline, boolean indent)
level
- the level for the infos
- Messagenewline
- true if a new line is to be insertedindent
- true if the info is indented according to levelDebugReporter
,
DebugReporter.debug(int, java.lang.String, boolean, boolean)
public void debug(int level, java.lang.String s, boolean newline)
level
- the level for the infos
- Messagenewline
- true if a new line is to be insertedDebugReporter
,
DebugReporter.debug(int, java.lang.String, boolean)
public int getDebugLevel()
DebugReporter
,
DebugReporter.getDebugLevel()
public void setDebugLevel(int level)
level
- The new level to levelDebugReporter
,
DebugReporter.setDebugLevel(int)
public void printSolution()
public void printSolution(java.io.PrintWriter pw)
pw
- The PrintWriter where the solution will be printed. It must
have been initialized.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |