pm4py.objects.petri_net.saw_net.semantics module#

PM4Py – A Process Mining Library for Python Copyright (C) 2026 Process Intelligence Solutions GmbH

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.

Website: https://processintelligence.solutions Contact: info@processintelligence.solutions

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_

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