Class StochasticTransitionFeature

java.lang.Object
org.oristool.models.stpn.trees.StochasticTransitionFeature
All Implemented Interfaces:
TransitionFeature, Feature

public class StochasticTransitionFeature extends Object implements TransitionFeature
Transition feature encoding the distribution and weight.
  • Method Details

    • density

      public PartitionedFunction density()
      Returns the firing time density of this instance.
      Returns:
      firing time PDF
    • weight

      public MarkingExpr weight()
      Returns the weight this instance. The weight is used to resolve random switches between immediate and deterministic transitions.
      Returns:
      transition weight
    • clockRate

      public MarkingExpr clockRate()
      Returns the rate used to decrease the firing time of this transitions. Most analysis methods require rate equal to MarkingExpr.ONE.
      Returns:
      transition rate
    • of

    • of

      public static StochasticTransitionFeature of(PartitionedFunction density, MarkingExpr weight, MarkingExpr rate)
    • newUniformInstance

      public static StochasticTransitionFeature newUniformInstance(String eft, String lft)
      Builds the stochastic feature of a transition with uniformly distributed timer.
      Parameters:
      eft - minimum firing time (as a string)
      lft - maximum firing time (as a string)
      Returns:
      a stochastic feature with uniform distribution
    • newUniformInstance

      public static StochasticTransitionFeature newUniformInstance(BigDecimal eft, BigDecimal lft)
      Builds the stochastic feature of a transition with uniformly distributed timer. Weight and rate are equal to 1.
      Parameters:
      eft - minimum firing time
      lft - maximum firing time
      Returns:
      a stochastic feature with uniform distribution
    • newUniformInstance

      public static StochasticTransitionFeature newUniformInstance(BigDecimal eft, BigDecimal lft, MarkingExpr clockRate)
      Builds the stochastic feature of a transition with uniformly distributed timer. Weight is equal to 1.
      Parameters:
      eft - minimum firing time
      lft - maximum firing time
      clockRate - scaling rate (depends on the state marking)
      Returns:
      a stochastic feature with uniform distribution
    • newDeterministicInstance

      public static StochasticTransitionFeature newDeterministicInstance(String value)
      Builds the stochastic feature of a transition with deterministic timer. The rate and weight are equal to 1.
      Parameters:
      value - timer value
      Returns:
      a stochastic feature with deterministic distribution
    • newDeterministicInstance

      public static StochasticTransitionFeature newDeterministicInstance(BigDecimal value)
      Builds the stochastic feature of a transition with deterministic timer. The rate and weight are equal to 1.
      Parameters:
      value - timer value
      Returns:
      a stochastic feature with deterministic distribution
    • newDeterministicInstance

      public static StochasticTransitionFeature newDeterministicInstance(BigDecimal value, MarkingExpr weight)
      Builds the stochastic feature of a transition with deterministic timer. The rate is always equal to 1.
      Parameters:
      value - timer value
      weight - weight of the transition (depends on the state marking)
      Returns:
      a stochastic feature with deterministic distribution
    • newDeterministicInstance

      public static StochasticTransitionFeature newDeterministicInstance(BigDecimal value, MarkingExpr weight, MarkingExpr clockRate)
      Builds the stochastic feature of a transition with deterministic timer. The rate is always equal to 1.
      Parameters:
      value - timer value
      weight - weight of the transition (depends on the state marking)
      clockRate - scaling rate (depends on the state marking)
      Returns:
      a stochastic feature with deterministic distribution
    • newExponentialInstance

      public static StochasticTransitionFeature newExponentialInstance(String expRate)
      Builds the stochastic feature of a transition with exponentially distributed timer. The transition rate does not depend on the current marking.
      Parameters:
      expRate - rate of the exponential
      Returns:
      a stochastic feature with exponential distribution
    • newExponentialInstance

      public static StochasticTransitionFeature newExponentialInstance(BigDecimal expRate)
      Builds the stochastic feature of a transition with exponentially distributed timer. The transition rate does not depend on the current marking.
      Parameters:
      expRate - rate of the exponential
      Returns:
      a stochastic feature with exponential distribution
    • newExponentialInstance

      public static StochasticTransitionFeature newExponentialInstance(BigDecimal expRate, MarkingExpr clockRate)
      Builds the stochastic feature of a transition with exponentially distributed timer and variable rate. The rate of the exponential is rescaled in each state after evaluating the input rate parameter.
      Parameters:
      expRate - rate of the exponential
      clockRate - scaling rate (depends on the state marking)
      Returns:
      a stochastic feature with exponential distribution and variable rate
    • newExponentialInstance

      public static StochasticTransitionFeature newExponentialInstance(BigDecimal expRate, MarkingExpr clockRate, MarkingExpr weight)
      Builds the stochastic feature of a transition with exponentially distributed timer and variable rate. The rate of the exponential is rescaled in each state after evaluating the input rate parameter.
      Parameters:
      expRate - rate of the exponential
      clockRate - scaling rate (depends on the state marking)
      weight - weight of the transition (depends on the state marking)
      Returns:
      a stochastic feature with exponential distribution and variable rate
    • newErlangInstance

      public static StochasticTransitionFeature newErlangInstance(int k, String rate)
      Builds the stochastic feature of a transition with Erlang distributed timer. Weight and rescaling rate are set to 1.
      Parameters:
      rate - rate of the exponentials in the Erlang (rate)
      k - number of exponentials in the Erlang (shape)
      Returns:
      a stochastic feature with Erlang distribution
    • newErlangInstance

      public static StochasticTransitionFeature newErlangInstance(int k, BigDecimal rate)
      Builds the stochastic feature of a transition with Erlang distributed timer. Weight and rescaling rate are set to 1.
      Parameters:
      rate - rate of the exponentials in the Erlang (rate)
      k - number of exponentials in the Erlang (shape)
      Returns:
      a stochastic feature with Erlang distribution
    • newErlangInstance

      public static StochasticTransitionFeature newErlangInstance(int k, BigDecimal rate, MarkingExpr clockRate, MarkingExpr weight)
      Builds the stochastic feature of a transition with Erlang distributed timer. The weight is set to 1.
      Parameters:
      rate - rate of the exponentials in the Erlang (rate)
      k - number of exponentials in the Erlang (shape)
      clockRate - scaling rate (depends on the state marking)
      weight - weight of the transition (depends on the state marking)
      Returns:
      a stochastic feature with Erlang distribution
    • newShiftedExp

      public static StochasticTransitionFeature newShiftedExp(BigDecimal shift, BigDecimal rate)
      Builds the stochastic feature of a transition where the timer distribution is a shifted exponential. Weight and rescaling rate are set to 1.
      Parameters:
      shift - maximum firing time
      rate - rate of the exponential
      Returns:
      a stochastic feature with truncated exponential distribution
    • newExpolynomial

      public static StochasticTransitionFeature newExpolynomial(String density, OmegaBigDecimal eft, OmegaBigDecimal lft)
      Builds the stochastic feature of a transition where the timer distribution is an expolynomial. Weight and rescaling rate are set to 1.
      Parameters:
      density - density expression
      eft - minimum firing time
      lft - maximum firing time
      Returns:
      a stochastic feature with expolynomial distribution
    • newHyperExp

      public static StochasticTransitionFeature newHyperExp(List<BigDecimal> probs, List<BigDecimal> rates)
      Builds the stochastic feature of a transition where the timer distribution is hyper-exponential (mixture of exponentials). Weight and rescaling rate are set to 1.
      Parameters:
      probs - probability distribution over exponential PDFs
      rates - rates of exponential PDFs
      Returns:
      mixture distribution
    • newHypoExp

      public static StochasticTransitionFeature newHypoExp(BigDecimal rate1, BigDecimal rate2)
      Builds the stochastic feature of a transition where the timer distribution is hypo-exponential (sum of exponentials). Weight and rescaling rate are set to 1.
      Parameters:
      rate1 - rate of the first exponential
      rate2 - rate of the second exponential
      Returns:
      transition feature distributed as the sum of the exponentials
    • isIMM

      public boolean isIMM()
      Checks if this feature represents an immediate transition.
      Returns:
      true if this feature is immediate
    • isEXP

      public boolean isEXP()
      Checks if this feature represents an exponential transition.
      Returns:
      true if this feature is exponential
    • asTimedTransitionFeature

      public TimedTransitionFeature asTimedTransitionFeature()
      Returns a TPN transition feature encoding only the minimum and maximum value for a transition timer.
      Returns:
      a timed transition feature discarding the PDF
    • weightProbs

      public static Map<Transition,Double> weightProbs(Collection<Transition> transitions, Marking marking)
      Computes the discrete distribution determined by weights.

      Note that transitions with zero weight are always assigned zero probability, even if they are the only ones in the input set.

      Parameters:
      transitions - a group of transitions with StochasticStateFeature
      marking - a marking (weights can depend on the marking)
      Returns:
      a map from transitions to probabilities
      Throws:
      IllegalArgumentException - if a weight is not positive