Class MarkovChain

  • All Implemented Interfaces:
    java.io.Serializable

    
    public class MarkovChain
    extends Process
                        

    A class for a discrete time Markov chain

    • Constructor Detail

      • MarkovChain

        MarkovChain(Matrix transMat)
        Creates a DTMC with the specified transition matrix
        Parameters:
        transMat - the transition matrix
      • MarkovChain

        MarkovChain(Matrix transMat, boolean isFinite)
        Creates a DTMC with the specified transition matrix and finite flag
        Parameters:
        transMat - the transition matrix
        isFinite - whether the DTMC is finite
    • Method Detail

      • toCTMC

         MarkovProcess toCTMC()

        Convert to CTMC by subtracting identity matrix

        Returns:

        the equivalent CTMC

      • getTransMat

         Matrix getTransMat()

        Get the transition matrix

        Returns:

        the transition matrix

      • setStateSpace

         void setStateSpace(Matrix stateSpace)

        Set the state space

        Parameters:
        stateSpace - the state space matrix
      • isFinite

         boolean isFinite()

        Check if the DTMC is finite

        Returns:

        true if finite

      • sample

         Matrix sample()

        Sample from the DTMC

        Returns:

        sampled value

      • sample

         Matrix sample(int n)

        Sample n steps from the DTMC starting from initial distribution

        Parameters:
        n - number of steps to sample
        Returns:

        matrix containing sampled states (column vector)

      • sample

         Matrix sample(int n, Matrix pi0, Random random)

        Sample n steps from the DTMC

        Parameters:
        n - number of steps to sample
        pi0 - initial state distribution (if null, uses uniform distribution)
        random - random number generator
        Returns:

        matrix containing sampled states (column vector)

      • rand

         static MarkovChain rand(int nStates)

        Create a random DTMC

        Parameters:
        nStates - number of states
        Returns:

        random DTMC

      • fromSampleSysAggr

         static MarkovChain fromSampleSysAggr(Matrix samples)

        Create DTMC from sample system aggregation

        Parameters:
        samples - matrix where each row is a sample trajectory, each column is a time step
        Returns:

        DTMC constructed from samples by estimating transition probabilities

      • fromSampleSysAggr

         static MarkovChain fromSampleSysAggr(Matrix samples, int numStates)

        Create DTMC from sample system aggregation

        Parameters:
        samples - matrix where each row is a sample trajectory, each column is a time step
        numStates - number of states (if -1, infer from data)
        Returns:

        DTMC constructed from samples by estimating transition probabilities

      • fromSampleSysAggr

         static MarkovChain fromSampleSysAggr(Object sa)

        Create DTMC from sample system aggregation (legacy interface)

        Parameters:
        sa - the sample aggregation object
        Returns:

        DTMC constructed from samples