pm4py.objects.petri_net.saw_net.semantics module#
- class pm4py.objects.petri_net.saw_net.semantics.StochasticArcWeightNetSemantics[source]#
Bases:
StochasticPetriNetSemantics[N],Generic[N],ABC- classmethod is_enabled(pn: N, transition: T, marking: Counter[P]) bool[source]#
Checks whether a given transition is enabled in a given Petri net and marking. Every place should at least have the same number of tokens as the minimum binding that has a weight above 0
- Parameters:
param pn: Petri net
param transition: transition to check
param marking: marking to check
- Return type:
return: true if enabled, false otherwise
- classmethod fire(pn: N, binding: B, marking: Counter[P]) Counter[P][source]#
fires the binding in the given marking. Does not check if the the binding is feasible (this should be handled by the invoking code)
- Args:
pn (N): saw net to use marking (TCounter[P]): marking to use binding (B): binding to use
- Returns:
TCounter[P]: _description_
- classmethod all_legal_bindings(pn: N, transition: T) List[List[Tuple[A, int]]][source]#
Creates all possible bindings for a given input transition
- Parameters:
param pn: Petri net
param transition: transition to genereate all bindings for
- Return type:
return: list containing all posible bindings
- classmethod all_enabled_bindings(pn: N, transition: T, marking: Counter[P]) List[List[Tuple[A, int]]][source]#
Creates all possible feasible bindings for a given input transition in a given marking
- Parameters:
param pn: Petri net
param marking: marking to use
param transition: transition to genereate all feasible bindings for
- Return type:
return: list containing all posible feasible bindings
- classmethod is_enabled_binding(pn: N, transition: T, binding: List[Tuple[Arc, int]], marking: Counter[P]) bool[source]#
Checks if the provided binding is enabled
- Parameters:
param pn: Petri net
param marking: marking to use
param transition: transition to genereate all feasible bindings for
- Return type:
return: bool indicates if the binding is enabled
- classmethod amortized_priority(binding: List[Tuple[Arc, int]]) float[source]#
Computes the amortized priority (a.k.a weight) of a binding. The amortized priority is equal to the product of all individual weights of the arc weights includec in the binding.
- Args:
binding (StochasticArcWeightNet.Binding): input binding
- Returns:
float: amortized weight
- abstractmethod classmethod probability_of_binding(pn: N, transition: T, binding: List[Tuple[Arc, int]], marking: Counter[P]) float[source]#
Calculates the probability of firing a transition t under binding b in the net, in the given marking.
- Parameters:
param pn: Petri net
param transition: transition to fire
param binding: binding to consider
param marking: marking to use
- Return type:
return: firing probability of transition t under binding b
- class pm4py.objects.petri_net.saw_net.semantics.LocalStochasticArcWeightNetSemantics[source]#
Bases:
StochasticArcWeightNetSemantics[N],Generic[N]- classmethod probability_of_binding(pn: N, transition: T, binding: List[Tuple[Arc, int]], marking: Counter[P]) float[source]#
Calculates the probability of firing a transition t under binding b in the net, in the given marking.
- Parameters:
param pn: Petri net
param transition: transition to fire
param binding: binding to consider
param marking: marking to use
- Return type:
return: firing probability of transition t under binding b
- class pm4py.objects.petri_net.saw_net.semantics.GlobalStochasticArcWeightNetSemantics[source]#
Bases:
StochasticArcWeightNetSemantics[N],Generic[N]- classmethod probability_of_transition(pn: N, transition: T, marking: Counter[P]) float[source]#
Compute the probability of firing a transition in the net and marking.
- Args:
pn (N): Stochastic net transition (T): transition to fire marking (Counter[P]): marking to use
- Returns:
float: _description_
- classmethod sample_enabled_transition(pn: N, marking: Counter[P], seed: int = None) Tuple[T, B] | None[source]#
Randomly samples a transition from all enabled transitions
- Parameters:
param pn: Petri net
param marking: marking to use
- Return type:
return: a transition sampled from the enabled transitions
- classmethod probability_of_binding(pn: N, transition: T, binding: List[Tuple[Arc, int]], marking: Counter[P]) float[source]#
Calculates the probability of firing a transition t under binding b in the net, in the given marking.
- Parameters:
param pn: Petri net
param transition: transition to fire
param binding: binding to consider
param marking: marking to use
- Return type:
return: firing probability of transition t under binding b