Class MarkovProcess
-
- All Implemented Interfaces:
-
java.io.Serializable
public class MarkovProcess extends Process
A class for a continuous time Markov chain
-
-
Field Summary
Fields Modifier and Type Field Description protected MatrixinfGenprotected MatrixstateSpaceprotected booleanisfiniteprotected Stringnameprotected List<NamedParam>params
-
Constructor Summary
Constructors Constructor Description MarkovProcess(Matrix infGen)Creates a CTMC with the specified infinitesimal generator MarkovProcess(Matrix infGen, boolean isFinite)Creates a CTMC with the specified infinitesimal generator and finite flag MarkovProcess(Matrix infGen, boolean isFinite, Matrix stateSpace)Creates a CTMC with the specified infinitesimal generator, finite flag, and state space
-
Method Summary
Modifier and Type Method Description MarkovChaintoDTMC()Convert to DTMC using uniformization MarkovChaintoDTMC(double q)MarkovProcesstoTimeReversed()Get time-reversed CTMC voidsetStateSpace(Matrix stateSpace)Set the state space MatrixgetGenerator()Get the infinitesimal generator matrix doublegetProbState(int state)Get probability of a specific state using steady-state analysis MatrixgetProbState(Matrix state)Get probability of a specific state using Cramer's rule Matrixsolve()Solve the CTMC for steady-state probabilities Matrixsample()Sample from the CTMC Matrixsample(int n)Sample n state transitions from the CTMC starting from steady-state Matrixsample(int n, Matrix pi0, Random random)Sample n state transitions from the CTMC MatrixgetStateSpace()Get the state space booleanisFinite()Check if the CTMC is finite static MarkovProcessrand(int nStates)Create a random CTMC static MarkovProcessfromSampleSysAggr(Matrix samples, Matrix sojournTimes)Create CTMC from sample system aggregation static MarkovProcessfromSampleSysAggr(Matrix samples, Matrix sojournTimes, int numStates)Create CTMC from sample system aggregation static MarkovProcessfromSampleSysAggr(Matrix samples)Create CTMC from sample system aggregation (assuming unit sojourn times) static MarkovProcessfromSampleSysAggr(Object sa)Create CTMC from sample system aggregation (legacy interface) -
-
Constructor Detail
-
MarkovProcess
MarkovProcess(Matrix infGen)
Creates a CTMC with the specified infinitesimal generator- Parameters:
infGen- the infinitesimal generator matrix
-
MarkovProcess
MarkovProcess(Matrix infGen, boolean isFinite)
Creates a CTMC with the specified infinitesimal generator and finite flag- Parameters:
infGen- the infinitesimal generator matrixisFinite- whether the CTMC is finite
-
MarkovProcess
MarkovProcess(Matrix infGen, boolean isFinite, Matrix stateSpace)
Creates a CTMC with the specified infinitesimal generator, finite flag, and state space- Parameters:
infGen- the infinitesimal generator matrixisFinite- whether the CTMC is finitestateSpace- the state space representation
-
-
Method Detail
-
toDTMC
MarkovChain toDTMC()
Convert to DTMC using uniformization
- Returns:
the equivalent DTMC
-
toDTMC
MarkovChain toDTMC(double q)
-
toTimeReversed
MarkovProcess toTimeReversed()
Get time-reversed CTMC
- Returns:
time-reversed CTMC
-
setStateSpace
void setStateSpace(Matrix stateSpace)
Set the state space
- Parameters:
stateSpace- the state space matrix
-
getGenerator
Matrix getGenerator()
Get the infinitesimal generator matrix
- Returns:
the generator matrix
-
getProbState
double getProbState(int state)
Get probability of a specific state using steady-state analysis
- Parameters:
state- the state index (0-based)- Returns:
the probability of the specified state
-
getProbState
Matrix getProbState(Matrix state)
Get probability of a specific state using Cramer's rule
- Parameters:
state- the state vector (if state space is defined) or single state index- Returns:
the probability matrix containing the state probability
-
solve
Matrix solve()
Solve the CTMC for steady-state probabilities
- Returns:
the steady-state probability vector
-
sample
Matrix sample(int n)
Sample n state transitions from the CTMC starting from steady-state
- Parameters:
n- number of state transitions to sample- Returns:
matrix containing sampled states (column vector)
-
sample
Matrix sample(int n, Matrix pi0, Random random)
Sample n state transitions from the CTMC
- Parameters:
n- number of state transitions to samplepi0- initial state distribution (if null, uses steady-state)random- random number generator- Returns:
matrix containing sampled states (column vector)
-
getStateSpace
Matrix getStateSpace()
Get the state space
- Returns:
the state space matrix
-
isFinite
boolean isFinite()
Check if the CTMC is finite
- Returns:
true if finite
-
rand
static MarkovProcess rand(int nStates)
Create a random CTMC
- Parameters:
nStates- number of states- Returns:
random CTMC
-
fromSampleSysAggr
static MarkovProcess fromSampleSysAggr(Matrix samples, Matrix sojournTimes)
Create CTMC from sample system aggregation
- Parameters:
samples- matrix where each row is a sample trajectory, each column is a time stepsojournTimes- matrix of sojourn times corresponding to each state in samples- Returns:
CTMC constructed from samples by estimating transition rates
-
fromSampleSysAggr
static MarkovProcess fromSampleSysAggr(Matrix samples, Matrix sojournTimes, int numStates)
Create CTMC from sample system aggregation
- Parameters:
samples- matrix where each row is a sample trajectory, each column is a time stepsojournTimes- matrix of sojourn times corresponding to each state in samplesnumStates- number of states (if -1, infer from data)- Returns:
CTMC constructed from samples by estimating transition rates
-
fromSampleSysAggr
static MarkovProcess fromSampleSysAggr(Matrix samples)
Create CTMC from sample system aggregation (assuming unit sojourn times)
- Parameters:
samples- matrix where each row is a sample trajectory, each column is a time step- Returns:
CTMC constructed from samples with unit time steps
-
fromSampleSysAggr
static MarkovProcess fromSampleSysAggr(Object sa)
Create CTMC from sample system aggregation (legacy interface)
- Parameters:
sa- the sample aggregation object- Returns:
CTMC constructed from samples
-
-
-
-