Class SimpleMC

  • All Implemented Interfaces:
    RandomNumberGenerator, Seedable
    Direct Known Subclasses:
    HMMRNG

    public class SimpleMC
    extends Object
    implements RandomNumberGenerator
    This is a time-homogeneous Markov chain with a finite state space. It is a mathematical system that undergoes transitions from one state to another, between a finite or countable number of possible states. It is a random process characterized as memoryless: the next state depends only on the current state and not on the sequence of events that preceded it. This specific kind of "memorylessness" is called the Markov property.
    See Also:
    Wikipedia: Markov chain
    • Constructor Detail

      • SimpleMC

        public SimpleMC​(Vector PI,
                        Matrix A)
        Constructs a time-homogeneous Markov chain with a finite state space.
        Parameters:
        PI - the initial state probabilities
        A - the state transition probabilities
    • Method Detail

      • seed

        public void seed​(long... seeds)
        Description copied from interface: Seedable
        Seed the random number/vector/scenario generator to produce repeatable experiments.
        Specified by:
        seed in interface Seedable
        Parameters:
        seeds - the seeds
      • nextState

        public int nextState()
        Gets the next simulated state.
        Returns:
        next state
      • PI

        public ImmutableVector PI()
        Gets the initial state probabilities.
        Returns:
        the initial state probabilities
      • A

        public ImmutableMatrix A()
        Gets the state transition probabilities.
        Returns:
        the state transition probabilities
      • nStates

        public int nStates()
        Gets the number of states.
        Returns:
        the number of states
      • getStationaryProbabilities

        public static Vector getStationaryProbabilities​(Matrix A)
        Gets the stationary state probabilities of a Markov chain that is irreducible, aperiodic and strongly connected (positive recurrent). A stationary distribution vector x (if exists) satisfies \[ x' \times A = x' \] where x' denotes the transpose of x, and the sum of all elements of x is 1.
        Parameters:
        A - the transition matrix
        Returns:
        the stationary state probabilities
      • bin

        public static int bin​(MultinomialRVG rvg)
        Picks the first non-empty bin.
        Parameters:
        rvg - a MultinomialRVG
        Returns:
        the first non-empty bin