Package org.oristool.models.stpn.trees
Class StochasticTransitionFeature
java.lang.Object
org.oristool.models.stpn.trees.StochasticTransitionFeature
- All Implemented Interfaces:
TransitionFeature
,Feature
Transition feature encoding the distribution and weight.
-
Method Summary
Modifier and TypeMethodDescriptionReturns a TPN transition feature encoding only the minimum and maximum value for a transition timer.Returns the rate used to decrease the firing time of this transitions.density()
Returns the firing time density of this instance.boolean
isEXP()
Checks if this feature represents an exponential transition.boolean
isIMM()
Checks if this feature represents an immediate transition.static StochasticTransitionFeature
newDeterministicInstance
(String value) Builds the stochastic feature of a transition with deterministic timer.static StochasticTransitionFeature
Builds the stochastic feature of a transition with deterministic timer.static StochasticTransitionFeature
newDeterministicInstance
(BigDecimal value, MarkingExpr weight) Builds the stochastic feature of a transition with deterministic timer.static StochasticTransitionFeature
newDeterministicInstance
(BigDecimal value, MarkingExpr weight, MarkingExpr clockRate) Builds the stochastic feature of a transition with deterministic timer.static StochasticTransitionFeature
newErlangInstance
(int k, String rate) Builds the stochastic feature of a transition with Erlang distributed timer.static StochasticTransitionFeature
newErlangInstance
(int k, BigDecimal rate) Builds the stochastic feature of a transition with Erlang distributed timer.static StochasticTransitionFeature
newErlangInstance
(int k, BigDecimal rate, MarkingExpr clockRate, MarkingExpr weight) Builds the stochastic feature of a transition with Erlang distributed timer.static StochasticTransitionFeature
newExpolynomial
(String density, OmegaBigDecimal eft, OmegaBigDecimal lft) Builds the stochastic feature of a transition where the timer distribution is an expolynomial.static StochasticTransitionFeature
newExponentialInstance
(String expRate) Builds the stochastic feature of a transition with exponentially distributed timer.static StochasticTransitionFeature
newExponentialInstance
(BigDecimal expRate) Builds the stochastic feature of a transition with exponentially distributed timer.static StochasticTransitionFeature
newExponentialInstance
(BigDecimal expRate, MarkingExpr clockRate) Builds the stochastic feature of a transition with exponentially distributed timer and variable rate.static StochasticTransitionFeature
newExponentialInstance
(BigDecimal expRate, MarkingExpr clockRate, MarkingExpr weight) Builds the stochastic feature of a transition with exponentially distributed timer and variable rate.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).static StochasticTransitionFeature
newHypoExp
(BigDecimal rate1, BigDecimal rate2) Builds the stochastic feature of a transition where the timer distribution is hypo-exponential (sum of exponentials).static StochasticTransitionFeature
newShiftedExp
(BigDecimal shift, BigDecimal rate) Builds the stochastic feature of a transition where the timer distribution is a shifted exponential.static StochasticTransitionFeature
newUniformInstance
(String eft, String lft) Builds the stochastic feature of a transition with uniformly distributed timer.static StochasticTransitionFeature
newUniformInstance
(BigDecimal eft, BigDecimal lft) Builds the stochastic feature of a transition with uniformly distributed timer.static StochasticTransitionFeature
newUniformInstance
(BigDecimal eft, BigDecimal lft, MarkingExpr clockRate) Builds the stochastic feature of a transition with uniformly distributed timer.static StochasticTransitionFeature
of
(PartitionedFunction density) static StochasticTransitionFeature
of
(PartitionedFunction density, MarkingExpr weight, MarkingExpr rate) weight()
Returns the weight this instance.static Map<Transition,
Double> weightProbs
(Collection<Transition> transitions, Marking marking) Computes the discrete distribution determined by weights.
-
Method Details
-
density
Returns the firing time density of this instance.- Returns:
- firing time PDF
-
weight
Returns the weight this instance. The weight is used to resolve random switches between immediate and deterministic transitions.- Returns:
- transition weight
-
clockRate
Returns the rate used to decrease the firing time of this transitions. Most analysis methods require rate equal toMarkingExpr.ONE
.- Returns:
- transition rate
-
of
-
of
public static StochasticTransitionFeature of(PartitionedFunction density, MarkingExpr weight, MarkingExpr rate) -
newUniformInstance
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
Builds the stochastic feature of a transition with uniformly distributed timer. Weight and rate are equal to 1.- Parameters:
eft
- minimum firing timelft
- 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 timelft
- maximum firing timeclockRate
- scaling rate (depends on the state marking)- Returns:
- a stochastic feature with uniform distribution
-
newDeterministicInstance
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
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 valueweight
- 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 valueweight
- 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
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
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 exponentialclockRate
- 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 exponentialclockRate
- 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
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
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
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 timerate
- 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 expressioneft
- minimum firing timelft
- 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 PDFsrates
- rates of exponential PDFs- Returns:
- mixture distribution
-
newHypoExp
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 exponentialrate2
- 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
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 withStochasticStateFeature
marking
- a marking (weights can depend on the marking)- Returns:
- a map from transitions to probabilities
- Throws:
IllegalArgumentException
- if a weight is not positive
-