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

java.lang.Object
  extended by jmarkov.jmdp.solvers.Solver<S,A>
      extended by jmarkov.jmdp.solvers.AbstractInfiniteSolver<S,A>
          extended by jmarkov.jmdp.solvers.AbstractAverageSolver<S,A>
              extended by jmarkov.jmdp.solvers.MpsLpAverageSolver<S,A>
Type Parameters:
S - States class.
A - Action class.
All Implemented Interfaces:
JMarkovElement, LPSolver<S,A>, MpsLpSolver<S,A>

public abstract class MpsLpAverageSolver<S extends State,A extends Action>
extends AbstractAverageSolver<S,A>
implements MpsLpSolver<S,A>

This class builds the Dual Linear Program for an average infinite horizon MDP in a MPS file.

Author:
Diego Bello, Germán Riaño - Universidad de Los Andes (C) 2005

Field Summary
 
Fields inherited from class jmarkov.jmdp.solvers.Solver
policy, printProcessTime, printValueFunction, problem, solved, valueFunction
 
Constructor Summary
MpsLpAverageSolver(DTMDP<S,A> problem)
          This cosntructor creates a solver for this problem.
MpsLpAverageSolver(DTMDP<S,A> problem, java.lang.String workingDir, java.lang.String fileName)
          The constructor method receives a problem of the type infinite DTMDP, the working directory where the MPS file will be stored, and the name that the user wants for the MPS File.
 
Method Summary
 long getBuildTime()
          Returns the time taken to build and write the MPS file.
protected  MpsLpDiscountedSolver<S,A> getDiscSolver()
           
 long getIterations()
           
 long getLpSolveTime()
          Return the time taken to solve the LP model.
 java.io.File getMpsFile()
          Returns the MPS file name.
 java.lang.String getMpsFileName()
          Returns the MPS file name.
 long getProcessTime()
           
 long getSolBuildTime()
          Returns the time needed to build the Solution after the LP was solved.
 java.io.File getWorkingDir()
          Returns the working directory (where the MPS file is located).
 Solution<S,A> solve()
          Called to solve the problem.
 
Methods inherited from class jmarkov.jmdp.solvers.AbstractInfiniteSolver
getDiscreteProblem, getProblem, printSolution
 
Methods inherited from class jmarkov.jmdp.solvers.Solver
description, getOptimalPolicy, getOptimalValueFunction, getValueFunction, isSolved, label, 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.jmdp.solvers.LPSolver
buildSolution, solveLP
 
Methods inherited from interface jmarkov.basic.JMarkovElement
equals
 

Constructor Detail

MpsLpAverageSolver

public MpsLpAverageSolver(DTMDP<S,A> problem,
                          java.lang.String workingDir,
                          java.lang.String fileName)
The constructor method receives a problem of the type infinite DTMDP, the working directory where the MPS file will be stored, and the name that the user wants for the MPS File.

Parameters:
problem - The problem to be solved.
workingDir - Where the file will be created.
fileName - Label for the MPS File.

MpsLpAverageSolver

public MpsLpAverageSolver(DTMDP<S,A> problem)
This cosntructor creates a solver for this problem. The created mps file is stored in a temp folder.

Parameters:
problem - The structure of the problem of type infinite DTMDP.
Method Detail

getMpsFileName

public final java.lang.String getMpsFileName()
Description copied from interface: MpsLpSolver
Returns the MPS file name.

Specified by:
getMpsFileName in interface MpsLpSolver<S extends State,A extends Action>
Returns:
Returns the fileName.

getIterations

public final long getIterations()
Specified by:
getIterations in class AbstractInfiniteSolver<S extends State,A extends Action>
Returns:
Returns the iterations in the last solve.

solve

public final Solution<S,A> solve()
                                                       throws SolverException
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.
Throws:
SolverException - This exception is thrown if the solver cannot find a solution for some reason.

getWorkingDir

public final java.io.File getWorkingDir()
Description copied from interface: MpsLpSolver
Returns the working directory (where the MPS file is located).

Specified by:
getWorkingDir in interface MpsLpSolver<S extends State,A extends Action>
Returns:
Returns the MPS File folder.
See Also:
MpsLpSolver.getWorkingDir()

getMpsFile

public final java.io.File getMpsFile()
Description copied from interface: MpsLpSolver
Returns the MPS file name.

Specified by:
getMpsFile in interface MpsLpSolver<S extends State,A extends Action>
Returns:
Returns the MPS generated file.

getDiscSolver

protected MpsLpDiscountedSolver<S,A> getDiscSolver()
Returns:
Returns the discSolver.

getBuildTime

public long getBuildTime()
Description copied from interface: LPSolver
Returns the time taken to build and write the MPS file.

Specified by:
getBuildTime in interface LPSolver<S extends State,A extends Action>
Returns:
Returns the buildTime.

getLpSolveTime

public long getLpSolveTime()
Description copied from interface: LPSolver
Return the time taken to solve the LP model.

Specified by:
getLpSolveTime in interface LPSolver<S extends State,A extends Action>
Returns:
Returns the lpSolveTime.

getSolBuildTime

public long getSolBuildTime()
Description copied from interface: LPSolver
Returns the time needed to build the Solution after the LP was solved.

Specified by:
getSolBuildTime in interface LPSolver<S extends State,A extends Action>
Returns:
Returns the solBuildTime.

getProcessTime

public final long getProcessTime()
Specified by:
getProcessTime in class Solver<S extends State,A extends Action>
Returns:
Returns the processTime of the last solve. Use System.currentTimeMillis() to get the current time.