jmarkov.solvers
Class MtjSolver

java.lang.Object
  extended by jmarkov.solvers.Solver
      extended by jmarkov.solvers.SteadyStateSolver
          extended by jmarkov.solvers.MtjSolver
All Implemented Interfaces:
JMarkovElement

public class MtjSolver
extends SteadyStateSolver

This class uses MTJ to solve Steady State probabilities.

Author:
Germán Riaño. Universidad de los Andes.

Nested Class Summary
static class MtjSolver.EnumPrecond
          This is the list of preconditioner offered in MTJ.
static class MtjSolver.EnumSolver
          This is the list of solvers provided by MTJ.
 
Field Summary
 
Fields inherited from class jmarkov.solvers.Solver
mp
 
Constructor Summary
MtjSolver(MarkovProcess mp)
          Default constructor.
MtjSolver(MarkovProcess mp, MtjSolver.EnumSolver solver)
          Construct a solver for the given SimpleMarkovProcess.
MtjSolver(MarkovProcess mp, MtjSolver.EnumSolver solver, boolean tryOthers)
          Construct a solver for the given SimpleMarkovProcess.
 
Method Summary
 java.lang.String description()
          This method return a complete verbal describtion of this element.
 MtjSolver.EnumSolver getCurrentIterSolver()
           
 MtjSolver.EnumPrecond getCurrentPreConditioner()
           
 no.uib.cipr.matrix.Matrix getGenerator()
          Returns the Generator matrix.
 no.uib.cipr.matrix.Matrix getGenMatrix()
           
 no.uib.cipr.matrix.sparse.IterativeSolver getIteartiveSolver(no.uib.cipr.matrix.Vector pi)
           
 no.uib.cipr.matrix.sparse.IterativeSolver getIterativeSolver(no.uib.cipr.matrix.Vector pi0, MtjSolver.EnumSolver solver)
           
 long getProcessTime()
           
 double[] getSteadyState()
          This process should be extended in order to compute the steady State probabilities of the MarkovChain.
 boolean isTryOthers()
           
 java.lang.String label()
          The name of this solver.
 void setCurrentIterSolver(MtjSolver.EnumSolver iterSolver)
          Sets the solver to use.
 void setCurrentPreConditioner(MtjSolver.EnumPrecond preConditioner)
           
 void setIterSolver(MtjSolver.EnumSolver iterSolver, boolean tryOthers)
          Sets the solver to use.
 void setTryOthers(boolean tryOthers)
          Sets whether the solver shall try other solvers when it fails.
 
Methods inherited from class jmarkov.solvers.Solver
getMP, 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

MtjSolver

public MtjSolver(MarkovProcess mp)
Default constructor. Uses as default solver BiCGStab first. If it fails, it tries other solvers.

Parameters:
mp -

MtjSolver

public MtjSolver(MarkovProcess mp,
                 MtjSolver.EnumSolver solver)
Construct a solver for the given SimpleMarkovProcess. It uses the given solver enumeration to determine what solver to use.

Parameters:
mp - Tha Markov process solved
solver - The solver to use.

MtjSolver

public MtjSolver(MarkovProcess mp,
                 MtjSolver.EnumSolver solver,
                 boolean tryOthers)
Construct a solver for the given SimpleMarkovProcess. It uses the given solver enumeration to determine what solver to use. If it fails it tries other solvers.

Parameters:
mp - the Markov Process to solve.
solver - the iterative solver form the enumeration IterSolver.
tryOthers - whether a different solver should be tried if the first one fails.
Method Detail

getGenerator

public no.uib.cipr.matrix.Matrix getGenerator()
Returns the Generator matrix.

Returns:
the Generator Matrix G.

getSteadyState

public double[] getSteadyState()
                        throws NotUnichainException
Description copied from class: SteadyStateSolver
This process should be extended in order to compute the steady State probabilities of the MarkovChain. The user can get information of the SimpleMarkovProcess associated with this solver though the methods getRates(), getGenerator, and getRate(State,State)

Specified by:
getSteadyState in class SteadyStateSolver
Returns:
an array with the Steady state probabilities for the given problem.
Throws:
NotUnichainException
See Also:
MarkovProcess.getGenerator(), MarkovProcess.getRates(), MarkovProcess.getRate(State, State)

label

public java.lang.String label()
Description copied from class: Solver
The name of this solver. This should be implemented by the extending classes..

Specified by:
label in interface JMarkovElement
Specified by:
label in class Solver
Returns:
A String label.
See Also:
Solver.label()

getCurrentIterSolver

public MtjSolver.EnumSolver getCurrentIterSolver()
Returns:
Returns the currentIterSolver.

setIterSolver

public void setIterSolver(MtjSolver.EnumSolver iterSolver,
                          boolean tryOthers)
Sets the solver to use.

Parameters:
iterSolver - The currentIterSolver to set.
tryOthers - whether other solvers should be tryed if this fails.

setCurrentIterSolver

public void setCurrentIterSolver(MtjSolver.EnumSolver iterSolver)
Sets the solver to use. It will not try other solvers if this one fails.

Parameters:
iterSolver -

getCurrentPreConditioner

public MtjSolver.EnumPrecond getCurrentPreConditioner()
Returns:
Returns the currentPreConditioner.

setCurrentPreConditioner

public void setCurrentPreConditioner(MtjSolver.EnumPrecond preConditioner)
Parameters:
preConditioner - The currentPreConditioner to set.

isTryOthers

public final boolean isTryOthers()
Returns:
Returns true if the solver shall try other solvers when it fails.

setTryOthers

public final void setTryOthers(boolean tryOthers)
Sets whether the solver shall try other solvers when it fails.

Parameters:
tryOthers - true if the solver shall try other solvers when it fails.

getGenMatrix

public final no.uib.cipr.matrix.Matrix getGenMatrix()
Returns:
Returns the generator Matrix.

getProcessTime

public final long getProcessTime()
Returns:
Returns the Process Time of the last solved problem.

getIteartiveSolver

public no.uib.cipr.matrix.sparse.IterativeSolver getIteartiveSolver(no.uib.cipr.matrix.Vector pi)
Parameters:
pi - The probability vector.
Returns:
Returns the iteartiveSolver.

getIterativeSolver

public no.uib.cipr.matrix.sparse.IterativeSolver getIterativeSolver(no.uib.cipr.matrix.Vector pi0,
                                                                    MtjSolver.EnumSolver solver)
Parameters:
pi0 - Initial guess value.
solver - The solver used.
Returns:
Returns the iterativeSolver.

description

public java.lang.String description()
Description copied from interface: JMarkovElement
This method return a complete verbal describtion of this element. This description may contain multiple text rows.

Returns:
A String describing this element.
See Also:
JMarkovElement.label()