S - The State class for the model.E - The Event class for the model.public abstract class MarkovProcess<S extends State,E extends Event> extends java.lang.Object implements JMarkovElement
active,dests and rate.
The user should also determine how to code the space state. This is
accomplished by implementing the State class. A particular
implementation of State is provided where each state is coded with
k integer properties. Examples are included in this release.SimpleMarkovProcess.dests(State, Event),
SimpleMarkovProcess.active(State, Event),
SimpleMarkovProcess.rate(State, State, Event),
State,
Event,
PropertiesState| Modifier and Type | Class and Description |
|---|---|
static class |
MarkovProcess.Status
Status variables
|
| Constructor and Description |
|---|
MarkovProcess(S i0,
EventsSet<E> eSet)
Builds a SimpleMarkovProcess that contains all states reachable
from i0, and with E being the set of all possible events.
|
MarkovProcess(S i0,
EventsSet<E> eSet,
java.lang.String name)
Builds a SimpleMarkovProcess that contains all states reachable
from i0, and with E being the set of all possible events.
|
| Modifier and Type | Method and Description |
|---|---|
abstract Transitions<S> |
activeTransitions(S i,
E e)
The user MUST implement this Function in order to describe the
dynamics of the model.
|
boolean |
addMOP(java.lang.String mopName)
This method declares the existance of a measure of performance
(MOP).
|
java.lang.String |
allToString()
Retuns a String description of the model and solution.
|
boolean |
canGo()
Allos to stop model execution by graphica user interface.
|
void |
clearMOPs()
Clear all MOPs defined in the system.
|
void |
debug(int level,
java.lang.String s)
Prints debug information with this importance level
|
void |
debug(int level,
java.lang.String s,
boolean newline)
Prints debug information with this importance level
|
void |
debug(int level,
java.lang.String s,
boolean newline,
boolean indent)
Prints debug information with this importance level
|
java.lang.String |
denseMatrixToString()
Returns a String with a description of the Model: the States
and the Transition Matrix.
|
java.lang.String |
denseMatrixToString(int width,
int rateDecimals,
boolean printZeros,
boolean useGenerator)
Returns the Transition Matrix as a String.
|
abstract java.lang.String |
description()
This method should be implemented by the subclass to give word
description of the model.
|
java.lang.String |
eventRatesToString(int width,
int decimals)
Return a String as printed by printEventsrates
|
java.lang.String |
eventsRatesToString()
Return a string as eventsRatesToString, with width 8 and 4
decimals
|
void |
generate()
generate() builds the space state and rate matrix using the
algorithm BuildsSR.
|
int |
getDebugLevel() |
DebugReporter |
getDebugReporter()
Gets the DebugReporter currently in use.
|
java.lang.Class |
getEventClass()
The Class for the Events in the system.
|
java.lang.String[] |
getEventNames()
Returns the defined events
|
double |
getEventRate(int eNum)
Return the steadystate rate of occurrance of the Events number
eNum.
|
E[] |
getEvents()
Returns all The events defined in the model.
|
double[] |
getEventsRates()
Return an array with the steadystate rate of occurrance of all
the Events.
|
double |
getFinalRate(S i,
S j)
Gets the total rate form State number i to j.
|
double[][] |
getGenerator()
Returns the infinitesimal generator matrix Q , in dense
format.
|
long |
getMaxStates() |
int |
getMOPIndex(java.lang.String name)
Gets the index that correspond to this MOP.
|
java.lang.String[] |
getMOPNames()
Return all the names of defined MOPs.
|
java.lang.String |
getMOPNames(int mopNum)
Return the names of the i-th MOP.
|
double[] |
getMOPsAvg()
Returns an array with the average of all the steady state
measures of performance.
|
double |
getMOPsAvg(int mopNum)
Returns the steady state measures average of the MOP numbre
mopNum.
|
double |
getMOPsAvg(java.lang.String mopName)
Returns the steady state measures average of the MOP with name
mopName.
|
double[] |
getMOPsMoment(int m)
Returns an array with the m-th moment of all the steady state
measures of performance.
|
double |
getMOPsMoment(int mopNum,
int m)
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.
|
double |
getMOPsMoment(java.lang.String mopName,
int m)
Returns the steady state measures m-th moment of the MOP with
name mopName. m=1 is the long-run expected value.
|
no.uib.cipr.matrix.Matrix |
getMtjGenerator()
The generator Q as an MTJ Matrix
|
no.uib.cipr.matrix.Matrix |
getMtjRates()
Returns the transition rates matrix R in MTJ format.
|
int |
getNumStates()
Return the number of States in the model.
|
long |
getProgress()
Return the number of states processed so far in the current
process.
|
double |
getRate(S i,
S j)
Gets the current total rate form i to j.
|
double[][] |
getRates()
Returns the transition rates matrix R in dense format.
|
Transitions<S> |
getRates(S i)
This method returns a dynamic data structure with the rate from
State i to all reachable states.
|
java.lang.Class |
getStateClass()
The Class for the states in this model.
|
StatesSet<S> |
getStates()
Returns an array with all the States in the model.
|
StatesSet<S> |
getStates(boolean causesGeneration)
Returns an array with the States in the model that have been
checked so far.
|
MarkovProcess.Status |
getStatus()
Returns the current status of the model.
|
java.lang.String |
getStatusMsg()
Returns a String describing the current status of the model.
|
double[] |
getSteadyState()
Returns the steady state probabilities for this model.
|
SteadyStateSolver |
getSteadyStateSolver()
The currently defined solver.
|
TransientSolver |
getTransientSolver()
The currently defined solver for transient state.
|
void |
go()
Runs the model, or resumes execution if it had been suspended.
|
void |
goStep()
Runs the model for a single step.
|
void |
hideGUI()
Hides the Graphic User Interface (GUI) that represent this
Markov Chain if one is defined.
|
boolean |
isGenerated() |
void |
killGUI()
Destroys the Graphic User Interface (GUI) that represent this
Markov Chain if one is defined.
|
java.lang.String |
label()
Returns the name of the model.
|
void |
loadGUI()
Loads the Graphic User Interface (GUI) that represent this
Markov Chain.
|
java.lang.String |
MOPsToString()
Return a String description of all MOPs in steady state (it
reports mean and standard deviation).
|
java.lang.String |
MOPsToString(int width,
int decimals)
Return a String description of all MOPs in steady state (it
reports mean and standard deviation).
|
int |
numMOPs()
Returns the number of defined Measures of performance (MOPs).
|
void |
pause()
Pauses the current execution of the model.
|
void |
printAll()
Prints a description of the Model: the States and the
Transition Matrix.
|
void |
printAll(java.io.PrintWriter out)
Prints to the given PrintWriter a summary of the information
related to this MarkovChain.
|
void |
printDenseMatrix(java.io.PrintWriter out)
Prints a the Transition Matrix.
|
void |
printDenseMatrix(java.io.PrintWriter out,
int width,
int rateDecimals,
boolean printZeros,
boolean useGenerator)
Prints a description of the Model using the given PrintWriter:
the States and the Transition Matrix.
|
void |
printEventsRates(java.io.PrintWriter out)
Prints a table reporting the steadystate occurrance of all
events.
|
void |
printEventsRates(java.io.PrintWriter out,
int width,
int decimals)
Prints a table reporting the steadystate occurrance of all
events.
|
void |
printMOPs()
Prints the Measures of performance (MOPS) on standard output.
|
void |
printMOPs(java.io.PrintWriter out)
Prints a String description of all MOPs in steady state (it
reports mean and standard deviation), with a width of 10 and 5
decimal figures.
|
int |
printMOPs(java.io.PrintWriter out,
int width,
int decimals)
Prints a String description of all MOPs in steady state (it
reports mean and standard deviation).
|
void |
printStates(java.io.PrintWriter out)
Prints a description of the States and the Equilibrium
Probabilities.
|
void |
printStates(java.io.PrintWriter out,
int width,
int probDecimals)
Prints a description of the States and the Equilibrium
Probabilities.
|
void |
reset()
Resets the Model.
|
void |
resetResults()
Resets the result of the model.
|
void |
setDebugLevel(int level)
Sets the debug level, where level=0 means no debug info, level =
5 verbose info.
|
void |
setDebugReporter(DebugReporter reporter)
Sets the DebugReporter to use.
|
void |
setMaxStates(long num)
Sets the maximum number of states to generate.
|
void |
setMOPs(java.lang.String[] mopNames)
Sets the names of all MOPs (measures of performance).
|
void |
setSteadyStateSolver(SteadyStateSolver steadyStateSolver)
Allows the user to set an alternate solver.
|
void |
setTransientSolver(TransientSolver transientSolver)
Allows the user to set an alternate solver.
|
void |
showGUI()
Shows the Graphic User Interface (GUI) that represent this
Markov Chain.
|
int |
statesLableMaxWidth(int width)
Computes the maximum used by the state's labels.
|
java.lang.String |
statesToString()
Prints a description of the States and the Equilibrium
Probabilities.
|
java.lang.String |
toString()
This method returns a short String used in the user interface to describe
this element.
|
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitequalspublic MarkovProcess(S i0, EventsSet<E> eSet, java.lang.String name)
i0 - The initial State.eSet - The set of all Events.name - The name of the Model.public void reset()
public void resetResults()
public abstract Transitions<S> activeTransitions(S i, E e)
public abstract Transitions activeTransitions(MyState i, MyEvent e){
TransitionsSet trans = new TransitionsSet();
case (ARRIVAL)
if (i.size() < capacity)
trans.add(i.doArrival(), arrRate);
break;
case(DEPARTURE)
if (i.size() >=1)
trans.add(i.doDeparture, serviceRate);
break;
}
return trans;
}
i - The current State.e - The ocurring event.Transitions,
TransitionsSet,
Transitionspublic void generate()
getRate(j) of every state.
Alternatively the method getGenerator() and
getRates() access the generator matriz or rate
matrix in compact form.public int getNumStates()
public StatesSet<S> getStates()
public StatesSet<S> getStates(boolean causesGeneration)
generate is true it generates
the model if it has not been generated. If no states have been
generates it returns null.causesGeneration - whether the model should be generated.public E[] getEvents()
public Transitions<S> getRates(S i)
i - StateTransitionspublic double getRate(S i, S j)
generate() first.i - origin Statej - destination stategenerate()public double getFinalRate(S i, S j)
i - origin Statej - destination stategetRate(State, State)public double[][] getRates()
getRate(State, State),
getRates(State),
getMtjRates()public no.uib.cipr.matrix.Matrix getMtjRates()
public boolean isGenerated()
public double[][] getGenerator()
public no.uib.cipr.matrix.Matrix getMtjGenerator()
public double[] getSteadyState()
throws NotUnichainException
NotUnichainExceptionpublic java.lang.Class getStateClass()
public java.lang.Class getEventClass()
public boolean addMOP(java.lang.String mopName)
mopName - The name of the new MOP.public void clearMOPs()
public void setMOPs(java.lang.String[] mopNames)
mopNames - public java.lang.String[] getMOPNames()
public double[] getMOPsAvg()
throws NotUnichainException
NotUnichainExceptiongetMOPsMoment(int)public double[] getMOPsMoment(int m)
throws NotUnichainException
m - the order of the moment desired. m=1 is the expected
value.NotUnichainExceptionpublic int getMOPIndex(java.lang.String name)
name - MOP namepublic int numMOPs()
public double getMOPsAvg(int mopNum)
throws NotUnichainException
mopNum - The Number of the MOP of the which the average is
to be computed.NotUnichainExceptionpublic double getMOPsAvg(java.lang.String mopName)
throws NotUnichainException
mopName - The name whose Averga is to be computed.NotUnichainExceptionpublic double getMOPsMoment(int mopNum,
int m)
throws NotUnichainException
mopNum - The number for the MOPm - The value of m.NotUnichainExceptionpublic double getMOPsMoment(java.lang.String mopName,
int m)
throws NotUnichainException
mopName - The name of the MOP that is to be computedm - Valu of the momentNotUnichainExceptionpublic java.lang.String getMOPNames(int mopNum)
mopNum - The number i of the MOPpublic java.lang.String MOPsToString()
public java.lang.String MOPsToString(int width,
int decimals)
width - the columns widthdecimals - the number of decimals to use.public java.lang.String eventsRatesToString()
eventRatesToString(int,int)public java.lang.String eventRatesToString(int width,
int decimals)
width - Maximum width for each numberdecimals - Number of decimalsprintEventsRates(PrintWriter,int,int)public void printEventsRates(java.io.PrintWriter out)
out - where the table will be printed.public void printEventsRates(java.io.PrintWriter out,
int width,
int decimals)
out - where the table will be printed.width - The column widthdecimals - The number of decimals to use.public java.lang.String[] getEventNames()
public double getEventRate(int eNum)
throws NotUnichainException
eNum - The even number in the event set.NotUnichainExceptionpublic double[] getEventsRates()
throws NotUnichainException
NotUnichainExceptionpublic final void printMOPs()
public final void printMOPs(java.io.PrintWriter out)
out - The printer where the MOPS will be printed.printMOPs(),
printMOPs(PrintWriter, int, int)public int printMOPs(java.io.PrintWriter out,
int width,
int decimals)
public void printMOPs(PrintWriter out, int width, int decimals) {
int namesWidth = super.printMOPs(out,width, decimals);
// your oun code here:
out.println(pad("Another MOP", namesWidth, false)
+ pad(Value, width, decimals);
}
out - The printer where the MOPS will be printed.width - the columns widthdecimals - the number of decimals to use.printMOPs(PrintWriter),
printMOPs(PrintWriter, int, int)public java.lang.String toString()
JMarkovElement
public final String toString() {
return label();
}
toString in interface JMarkovElementtoString in class java.lang.ObjectJMarkovElement.label()public java.lang.String allToString()
printAll()public void printAll()
allToString()public void printAll(java.io.PrintWriter out)
printAll().out - toString(),
printAll()public java.lang.String denseMatrixToString()
public java.lang.String denseMatrixToString(int width,
int rateDecimals,
boolean printZeros,
boolean useGenerator)
width - The width of each column.rateDecimals - The number of decimals for the rates.printZeros - Whether zeros or blanks should be printed.useGenerator - whether the generator matrix Q>,
rather than the rates matrix should be printed.public void printDenseMatrix(java.io.PrintWriter out)
out - The writer to write to.public void printDenseMatrix(java.io.PrintWriter out,
int width,
int rateDecimals,
boolean printZeros,
boolean useGenerator)
out - The writer to write to.width - The width of each column.rateDecimals - The number of decimals for the rates.printZeros - Whether zeros or blanks should be printed.useGenerator - whether the generator matrix Q>,
rather than the rates matrix should be printed.public java.lang.String statesToString()
public void printStates(java.io.PrintWriter out)
out - The writer to write to.public void printStates(java.io.PrintWriter out,
int width,
int probDecimals)
out - The writer to write to.width - The width of each column.probDecimals - The number of decimals for the
probabilities.public abstract java.lang.String description()
description in interface JMarkovElementJMarkovElement.label()public int statesLableMaxWidth(int width)
width - minimum width acceptable.public void setDebugReporter(DebugReporter reporter)
reporter - The reporter tah will capture the debug
information.DebugReporterpublic DebugReporter getDebugReporter()
DebugReporterpublic void debug(int level,
java.lang.String s)
level - s - The message to send.public void debug(int level,
java.lang.String s,
boolean newline)
level - The level of importance (0=show always, 5= show on
debug level is 5).s - The messagenewline - Whether a new line should be written.public void debug(int level,
java.lang.String s,
boolean newline,
boolean indent)
level - The level of importance (0=show always, 5= show on
debug level is 5).s - The string to write.newline - Whether to use a new line.indent - Whether it should indent according to level.public int getDebugLevel()
public void setDebugLevel(int level)
level - New debug levelpublic void loadGUI()
public void showGUI()
public void hideGUI()
public void killGUI()
public boolean canGo()
public void pause()
public void go()
generate() instead.generate()public void goStep()
generate() instead.generate(),
go()public MarkovProcess.Status getStatus()
public long getProgress()
public java.lang.String getStatusMsg()
public long getMaxStates()
public void setMaxStates(long num)
num - Maximum Number of States to generate.public SteadyStateSolver getSteadyStateSolver()
SteadyStateSolverpublic void setSteadyStateSolver(SteadyStateSolver steadyStateSolver)
steadyStateSolver - The steadyStateSolver to set.SteadyStateSolverpublic TransientSolver getTransientSolver()
TransientSolverpublic void setTransientSolver(TransientSolver transientSolver)
transientSolver - The transientSolver to set.TransientSolverpublic java.lang.String label()
label in interface JMarkovElementJMarkovElement.description()