jmarkov.jmdp.solvers
Class FiniteSolver<S extends State,A extends Action>

java.lang.Object
  extended by jmarkov.jmdp.solvers.Solver<S,A>
      extended by jmarkov.jmdp.solvers.AbstractFiniteSolver<S,A>
          extended by jmarkov.jmdp.solvers.FiniteSolver<S,A>
Type Parameters:
S - States class.
A - Actions class.
All Implemented Interfaces:
JMarkovElement

public class FiniteSolver<S extends State,A extends Action>
extends AbstractFiniteSolver<S,A>

This class belongs to the set of default solvers included in the jmdp package. It extends Solver and should only be used on FINITE horizon problems. The objective function of the solver is to minimize the the total cost. The result is a deterministic optimal policy for the given structure.

Author:
Germán Riaño and Andres Sarmiento - Universidad de Los Andes

Field Summary
 
Fields inherited from class jmarkov.jmdp.solvers.Solver
policy, printProcessTime, printValueFunction, problem, solved, valueFunction
 
Constructor Summary
FiniteSolver(FiniteMDP<S,A> problem)
          Initialized the solver with the given getProblem().
 
Method Summary
 java.lang.String bestPolicy(S initial)
          Prints out the policy
protected  double future(S i, A a, int t)
          This method calculates the expected value of valueFunction for the current state i and a specified action a at the given stage t.
 long getProcessTime()
           
 java.lang.String label()
          The sub classes must return the Solver name.
 Solution<S,A> solve()
          Called to solve the problem.
 
Methods inherited from class jmarkov.jmdp.solvers.AbstractFiniteSolver
getProblem
 
Methods inherited from class jmarkov.jmdp.solvers.Solver
description, getOptimalPolicy, getOptimalValueFunction, getValueFunction, isSolved, printSolution, printSolution, setPrintProcessTime, setPrintValueFunction, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmarkov.basic.JMarkovElement
equals
 

Constructor Detail

FiniteSolver

public FiniteSolver(FiniteMDP<S,A> problem)
Initialized the solver with the given getProblem().

Parameters:
problem - The problem to be solved.
Method Detail

solve

public final Solution<S,A> solve()
Description copied from class: Solver
Called to solve the problem. This method MUST write the local variable policy and valueFunction.

Specified by:
solve in class Solver<S extends State,A extends Action>
Returns:
The solution Object taht contains the plicy and value fuenction.

future

protected final double future(S i,
                              A a,
                              int t)
                       throws java.lang.NullPointerException
This method calculates the expected value of valueFunction for the current state i and a specified action a at the given stage t.

Parameters:
i - Current State
a - Action taken
t - Time stage
Returns:
The value.
Throws:
java.lang.NullPointerException

bestPolicy

public java.lang.String bestPolicy(S initial)
                            throws SolverException
Prints out the policy

Parameters:
initial -
Returns:
a string with the optimal policy
Throws:
SolverException

getProcessTime

public final long getProcessTime()
Specified by:
getProcessTime in class Solver<S extends State,A extends Action>
Returns:
Returns the processTime.

label

public java.lang.String label()
Description copied from class: Solver
The sub classes must return the Solver name.

Specified by:
label in interface JMarkovElement
Specified by:
label in class Solver<S extends State,A extends Action>
Returns:
A String label.
See Also:
Solver.toString()