jmarkov
Class GeomProcess<Sub extends State,E extends Event>

java.lang.Object
  extended by jmarkov.MarkovProcess<S,E>
      extended by jmarkov.SimpleMarkovProcess<GeomState<Sub>,E>
          extended by jmarkov.GeomProcess<Sub,E>
Type Parameters:
Sub - The sub-states.
E - The events class
All Implemented Interfaces:
JMarkovElement

public abstract class GeomProcess<Sub extends State,E extends Event>
extends SimpleMarkovProcess<GeomState<Sub>,E>

The class GeomProcess represents a continuos or discrete Quasi Birth and Death process. This class extends the class SimpleMarkovProcess. The class generate the G matrix through the Logarithmic Reduction algorithm. The user should extend State to generate Sub-States.

Version:
1.0
Author:
Julio G�ez.

Nested Class Summary
 
Nested classes/interfaces inherited from class jmarkov.MarkovProcess
MarkovProcess.Status
 
Field Summary
protected  GeometricSolver defaultGeometrixSolver
          Default Solver
protected  GeometricSolver GeometrixSolver
          Current Solver
 
Fields inherited from class jmarkov.MarkovProcess
cnt, defaultSteadyStateSolver, defaultTransientSolver, name, theStates
 
Constructor Summary
GeomProcess(Sub i0, EventsSet<E> eSet)
          Builds a GeomProcess
 
Method Summary
 boolean active(GeomState<Sub> i, E e)
          The user cannot extend this method.
abstract  boolean active(Sub substate, int iLevel, E e)
          The user must extend this method to determine which events are active.
 States<GeomState<Sub>> dests(GeomState<Sub> i, E e)
          Overrides SimpleMarkovProcess' method
abstract  GeomRelState[] dests(Sub i, int iLevel, E e)
          Determines the destination set of States when events e occurs.
 no.uib.cipr.matrix.Matrix[] getAMatrices()
          Returns the matrices of the repeating levels, A0, A1, and A2.
 no.uib.cipr.matrix.Matrix[] getBMatrices()
          Returns the matrices B00, B01 and B10.
 Sub[] getBoundaryStates()
          Returns an array with the States in the boundary level.
protected  GeometricSolver getDefaultGeometrixSolver()
          Returns the default GeometrixSolver.
 double getEventRate(int eNum)
          Return the steadystate rate of occurrance of the Events number eNum.
 double getExpectedLevel()
          Returns the Expected Value for the Level.
 GeometricSolver getGeometrixSolver()
          The currently defined solver.
 double[] getInitialSol()
          Computes and returns the initial solution [ pi(0), pi(1) ].
 double getMOPsMoment(int mopNum, int m)
          Returns the steady state measures m-th moment of the MOP number mopNum.
 int getNumBoundaryStates()
          The Number of States in the boundary level.
 int getNumTypicalStates()
          The number of states in the typical levels.
 no.uib.cipr.matrix.Matrix getRmatrix()
          The R Matrix of the Geometric solution.
 java.lang.Class getStateClass()
          This return the Sub-States class, rather than GeomState.
 StatesSet<GeomState<Sub>> getStates()
          Returns an array with all the States in the model.
 double[] getSteadyState(int level)
          Return an array with the probabilities for the given level.
 no.uib.cipr.matrix.Matrix getSubMatrices(int rowMin, int rowMax, int colMin, int colMax)
          This method constructs any A_n or B_ij matrix existing in the process and that are necessary to calculated R matrix.
 Sub[] getTypicalStates()
          Returns an array with the States in the typical levels.
 double[] getVectorPi0()
          Returns the steady State probabilities for boundary level.
 double[] getVectorPi1()
          Returns the steady State probabilities for level 1.
 double[] getVectorPi1Mod()
          Returns the steady State probabilities for level 1.
 boolean isStable()
          Determines if the system is stable.
 double[][] matrixRtoArray()
           
 void printAll(java.io.PrintWriter out)
          Prints to the given PrintWriter a summary of the information related to this MarkovChain.
 void printStates(java.io.PrintWriter out, int width, int probDecimals)
          Prints a description of the States and the Equilibrium Probabilities.
 double rate(GeomState<Sub> i, GeomState<Sub> j, E e)
          Returns the rate to go from State i to j when Event e occurs.
abstract  double rate(Sub i, int ilevel, Sub j, int jLevel, E e)
           
 void reset()
          Resets the Model.
 void setGeometrixSolver(GeometricSolver geometrixSolver)
          Allows the user to set an alternate solver.
 double[] steadyProbabilities()
          Computes the steady state probabilities for the generated States (up to level 2).
 
Methods inherited from class jmarkov.SimpleMarkovProcess
activeTransitions
 
Methods inherited from class jmarkov.MarkovProcess
addMOP, allToString, canGo, clearMOPs, debug, debug, debug, denseMatrixToString, denseMatrixToString, description, eventRatesToString, eventsRatesToString, finalize, generate, getDebugLevel, getDebugReporter, getDefaultSteadyStateSolver, getDefaultTransientSolver, getEventClass, getEventNames, getEvents, getEventsRates, getFinalRate, getGenerator, getInitialState, getMaxStates, getMOPIndex, getMOPNames, getMOPNames, getMOPsAvg, getMOPsAvg, getMOPsAvg, getMOPsMoment, getMOPsMoment, getMtjGenerator, getMtjRates, getNumStates, getProgress, getRate, getRates, getRates, getStates, getStatus, getStatusMsg, getSteadyState, getSteadyStateSolver, getTransientSolver, go, goStep, hideGUI, hLine, isGenerated, killGUI, label, loadGUI, MOPsToString, MOPsToString, numMOPs, pad, pad, pad, pad, pad, pad, pause, printAll, printDenseMatrix, printDenseMatrix, printDenseMatrix, printEventsRates, printEventsRates, printMOPs, printMOPs, printMOPs, printStates, reset, resetResults, setDebugLevel, setDebugReporter, setEventSet, setInitialState, setMaxStates, setMOPs, setSteadyStateSolver, setTransientSolver, showGUI, statesLableMaxWidth, statesToString, toString, vLine
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmarkov.basic.JMarkovElement
equals
 

Field Detail

GeometrixSolver

protected GeometricSolver GeometrixSolver
Current Solver


defaultGeometrixSolver

protected GeometricSolver defaultGeometrixSolver
Default Solver

Constructor Detail

GeomProcess

public GeomProcess(Sub i0,
                   EventsSet<E> eSet)
Builds a GeomProcess

Parameters:
i0 - Initial state. MUST be a boundary state!
eSet - the event set.
Method Detail

getStates

public StatesSet<GeomState<Sub>> getStates()
Description copied from class: MarkovProcess
Returns an array with all the States in the model. It generates the model if it has not been generated.

Overrides:
getStates in class MarkovProcess<GeomState<Sub extends State>,E extends Event>
Returns:
an array with all the states in levels: 0 (boundary), 1, and 2.

getBoundaryStates

public Sub[] getBoundaryStates()
Returns an array with the States in the boundary level.

Returns:
an array with the Sub-States

getTypicalStates

public Sub[] getTypicalStates()
Returns an array with the States in the typical levels.

Returns:
an array with the Sub-States

getNumBoundaryStates

public int getNumBoundaryStates()
The Number of States in the boundary level.

Returns:
the Number of States in the boundary level.

getNumTypicalStates

public int getNumTypicalStates()
The number of states in the typical levels.

Returns:
the number of states in the typical levels.

getSubMatrices

public no.uib.cipr.matrix.Matrix getSubMatrices(int rowMin,
                                                int rowMax,
                                                int colMin,
                                                int colMax)
This method constructs any A_n or B_ij matrix existing in the process and that are necessary to calculated R matrix.

Parameters:
rowMax - The upper limit row index.
rowMin - The lower limit row index.
colMax - The upper limit column index.
colMin - The lower limit column index.
Returns:
any A matrix in the process.

getRmatrix

public no.uib.cipr.matrix.Matrix getRmatrix()
                                     throws NotUnichainException
The R Matrix of the Geometric solution. This matrix solves

A0+RA1 + R2A2 = 0

Returns:
The R Matrix of the Geometric solution. If the system is not stable it returns a zero matrix.
Throws:
NotUnichainException

matrixRtoArray

public double[][] matrixRtoArray()
                          throws NotUnichainException
Returns:
Matrix R in an array of doubles.
Throws:
NotUnichainException

getAMatrices

public no.uib.cipr.matrix.Matrix[] getAMatrices()
Returns the matrices of the repeating levels, A0, A1, and A2. If the model has not been generated it will be.

Returns:
[A0, A1, A2]

getBMatrices

public no.uib.cipr.matrix.Matrix[] getBMatrices()
Returns the matrices B00, B01 and B10. It causes the generation of the model if it has not been generated.

Returns:
an array with {B00,B01,B10} in that order.

getInitialSol

public double[] getInitialSol()
                       throws NotUnichainException
Computes and returns the initial solution [ pi(0), pi(1) ].

Returns:
an array with the initial solution [ pi(0), pi(1) ]
Throws:
NotUnichainException

getVectorPi1

public double[] getVectorPi1()
                      throws NotUnichainException
Returns the steady State probabilities for level 1.

Returns:
the array pi(1)
Throws:
NotUnichainException

getVectorPi1Mod

public double[] getVectorPi1Mod()
                         throws NotUnichainException
Returns the steady State probabilities for level 1.

Returns:
the array pi(1)(I-R)^(-1)
Throws:
NotUnichainException

getVectorPi0

public double[] getVectorPi0()
                      throws NotUnichainException
Returns the steady State probabilities for boundary level.

Returns:
the array pi(0)
Throws:
NotUnichainException

getSteadyState

public double[] getSteadyState(int level)
                        throws NotUnichainException
Return an array with the probabilities for the given level.

Parameters:
level -
Returns:
probabilities array pi(k).
Throws:
NotUnichainException

steadyProbabilities

public double[] steadyProbabilities()
                             throws NotUnichainException
Computes the steady state probabilities for the generated States (up to level 2).

Returns:
(pi(0), pi(1), pi(2)).
Throws:
NotUnichainException

getExpectedLevel

public double getExpectedLevel()
                        throws NotUnichainException
Returns the Expected Value for the Level. That is

L = (p1 + 2p2 +3p3 + ... )1= p1(I-R)-21, where 1 is a column vector of ones.

Returns:
L.
Throws:
NotUnichainException

isStable

public boolean isStable()
Determines if the system is stable.

Returns:
true if the system is stable.

printAll

public void printAll(java.io.PrintWriter out)
Description copied from class: MarkovProcess
Prints to the given PrintWriter a summary of the information related to this MarkovChain. The information is the same as as in the method printAll().

Overrides:
printAll in class MarkovProcess<GeomState<Sub extends State>,E extends Event>
See Also:
MarkovProcess.toString(), MarkovProcess.printAll()

printStates

public void printStates(java.io.PrintWriter out,
                        int width,
                        int probDecimals)
Description copied from class: MarkovProcess
Prints a description of the States and the Equilibrium Probabilities.

Overrides:
printStates in class MarkovProcess<GeomState<Sub extends State>,E extends Event>
Parameters:
out - The writer to write to.
width - The width of each column.
probDecimals - The number of decimals for the probabilities.

dests

public abstract GeomRelState[] dests(Sub i,
                                     int iLevel,
                                     E e)
Determines the destination set of States when events e occurs. It has to be implemented by the subclass.

Parameters:
i - current State.
iLevel - absolute level of current State. For QBD this is 0, 1 or 2. Anything above 2 should report the same result.
e - The Event that ocurred.
Returns:
The destination States

dests

public final States<GeomState<Sub>> dests(GeomState<Sub> i,
                                          E e)
Overrides SimpleMarkovProcess' method

Specified by:
dests in class SimpleMarkovProcess<GeomState<Sub extends State>,E extends Event>
Parameters:
i - current state
e - Event
Returns:
the destinations states

active

public abstract boolean active(Sub substate,
                               int iLevel,
                               E e)
The user must extend this method to determine which events are active.

Parameters:
substate - the current sub state
iLevel - Absolute level of current State i. You should test only whether it is 0 (boundary), 1 or greater than 1. Your code should not behave any different if the level is 2, or 3, etc
e - The event being tested.
Returns:
tru if this event occurs

active

public final boolean active(GeomState<Sub> i,
                            E e)
The user cannot extend this method. GeomProcess detemines this based on active

Specified by:
active in class SimpleMarkovProcess<GeomState<Sub extends State>,E extends Event>
Parameters:
i - The current State
e - The current Event.
Returns:
True if the Event is Active.
See Also:
active(State, int, Event), SimpleMarkovProcess.active(State, Event)

rate

public abstract double rate(Sub i,
                            int ilevel,
                            Sub j,
                            int jLevel,
                            E e)
Parameters:
i - current sub state
ilevel - current state's absolute level
j - destination sub state
jLevel - destination level
e - Event
Returns:
rate of occurrance

rate

public double rate(GeomState<Sub> i,
                   GeomState<Sub> j,
                   E e)
Description copied from class: SimpleMarkovProcess
Returns the rate to go from State i to j when Event e occurs. This is called only if Event e is indeed active and j is a valid destination.

Specified by:
rate in class SimpleMarkovProcess<GeomState<Sub extends State>,E extends Event>
Parameters:
i - Current state
j - Destination State
e - The occuring event
Returns:
The rate at which the system goes from i to j when e occurs.
See Also:
SimpleMarkovProcess.dests(State, Event)

reset

public void reset()
Description copied from class: MarkovProcess
Resets the Model. It erases all found states and transition rates. Keeps the initial state and Events set.

Overrides:
reset in class MarkovProcess<GeomState<Sub extends State>,E extends Event>

getMOPsMoment

public double getMOPsMoment(int mopNum,
                            int m)
                     throws NotUnichainException
Description copied from class: MarkovProcess
Returns the steady state measures m-th moment of the MOP number mopNum. m=1 is the long-run expected value, m=2 expected value of the square, etc.

Overrides:
getMOPsMoment in class MarkovProcess<GeomState<Sub extends State>,E extends Event>
Parameters:
mopNum - The number for the MOP
m - The value of m.
Returns:
The m-th moments for this MOP.
Throws:
NotUnichainException
See Also:
MarkovProcess.getMOPsMoment(int, int)

getEventRate

public double getEventRate(int eNum)
                    throws NotUnichainException
Description copied from class: MarkovProcess
Return the steadystate rate of occurrance of the Events number eNum.

Overrides:
getEventRate in class MarkovProcess<GeomState<Sub extends State>,E extends Event>
Parameters:
eNum - The even number in the event set.
Returns:
an array for all the steady state rates. The order is that of the events set.
Throws:
NotUnichainException
See Also:
MarkovProcess.getEventRate(int)

getStateClass

public java.lang.Class getStateClass()
This return the Sub-States class, rather than GeomState.

Overrides:
getStateClass in class MarkovProcess<GeomState<Sub extends State>,E extends Event>
Returns:
The class for the states
See Also:
MarkovProcess.getStateClass()

getDefaultGeometrixSolver

protected final GeometricSolver getDefaultGeometrixSolver()
Returns the default GeometrixSolver.

Returns:
the default GeometrixSolver.

getGeometrixSolver

public GeometricSolver getGeometrixSolver()
The currently defined solver.

Returns:
Returns the GeometrixSolver.
See Also:
GeometricSolver

setGeometrixSolver

public void setGeometrixSolver(GeometricSolver geometrixSolver)
Allows the user to set an alternate solver.

Parameters:
geometrixSolver - The GeometrixSolver to set.
See Also:
GeometricSolver