The core matrix of a semi-Markov system is defined on a joint discrete and continuous space, where the discrete set is of next possible states of the system and the continuous space is of the next times when the system arrives at that state. A competing process description of a semi-Markov system, describes decides which state is next and when that state happens by asking which of a set of continuous distributions, one per competing process, is next to fire.
The GSPN, in particular, decides that, at the moment a transition first becomes enabled by the marking, it chooses the distribution of firing times. At any later time when a different, independent, transition has fired without affecting the first, the first’s distribution doesn’t change. It just gets renormalized to account for knowledge that it has not yet fired. If we label the cumulative distribution by \(F(t)\) and a distribution is shifted by a time \(\Delta=t_0-t_e\), then the new distribution is sampled with a shifted quantile. If we know the original cumulative distribution function, \(F(t,t_e),\) where \(t_e\) is the enabling time of the distribution function, then we can calulate the distribution, given that it hasn’t fired before time \(t_0\), with
This makes the calculation of the quantile, using the original quantile, \(F^{-1},\) look like
Given any distributions from Boost::Random or std::random, this formula calculates the shifted quantile from the original quantile and cumulative distribution.
Transitions for this library implement the following interface.
This is the pure virtual base class for distributions.
Return a sample from the random variable in absolute time after the given current time.
Each distribution remembers its enabling time in absolute time since the start of the simulation.
Some distributions have a hazard function, defined as the ratio of the probability density to the survival, which is bounded for finite times. These functions will have a well-defined hazard integral. This method tells the caller whether the hazard integral is a reasonable approach to sample the distribution.
This returns the integral of the hazard between absolute time \(t_0\) and \(t_1\).
This implicitly solves for a quantile by integrating the hazard. For certain distributions, this is analytic. The function returns \(t\) in
The template argument RandomGenerator fulfills the concept of the Boost random number generator concept and the std::random random number generator concept. Each sample can be taken from the difference between the two times, \((t_c-t_e)\), but passing both separately will be better for vectorization of sampling.
The following distributions are currently in the library.
The exponential distribution is the classic Markovian distribution. The cumulative distribution and quantile are defined as the following.
The constructor takes the parameter lambda, an enabling time for the distribution as an absolute system time.
The exponential distribution is the classic Markovian distribution. The shift is a displacement of the cumulative distribution function by an amount \(t_s.\)
The constructor takes the parameter lambda, an enabling time for the distribution as an absolute system time, and a normalization constant. If normal is less than one, it represents the probability that this distribution will fire at all.
Weibull distributions can model either infant mortality or aging processes. Parameters may be defined different ways. This class uses the following cumulative distribution and quantile.
This creates a Weibull distribution with parameters as defined above. The shift moves the distribution to the right.
This uses the Boost::Math::gamma_distribution. It has two parameters, shape and scale.
The constructor initializes the two parameters, \(\alpha\) and \(\theta.\) It also sets the enabling time and optional shift and normal.
This distribution represents piecewise, linear, continuous distributions. It is an expansion on the std::piecewise_linear_distribution from the std::random header. The piecewise curve defines an un-normalized probability density function, from which the cumulative distribution function is calculated.
The vector b specifies intercepts on the x-axis. The domain of the probability distribution function is from the first to last value of b. The weight vector, w, is the height of the unnormalized function at each point b. The arrays b and w must have at least two points and must be the same length. The shift moves the whole distribution to the right. normal is the probability that this distribution will fire at all.