pm4py.objects.petri_net.saw_net package#

PM4Py – A Process Mining Library for Python

Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)

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

Submodules#

pm4py.objects.petri_net.saw_net.convert module#

PM4Py – A Process Mining Library for Python

Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)

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

pm4py.objects.petri_net.saw_net.convert.convert_saw_net_to_stochastic_net_global_semantics(saw: StochasticArcWeightNet) StochasticPetriNet[source]#
pm4py.objects.petri_net.saw_net.convert.convert_saw_net_to_stochastic_net_local_semantics(saw: StochasticArcWeightNet, marking: Counter[Place]) Tuple[StochasticPetriNet, Counter[Place]][source]#

pm4py.objects.petri_net.saw_net.obj module#

PM4Py – A Process Mining Library for Python

Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)

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.obj.StochasticArcWeightNet(name: str = None, places: Collection[Place] = None, transitions: Collection[Transition] = None, arcs: Collection[Arc] = None, properties: Dict[str, Any] = None)[source]#

Bases: StochasticPetriNet

Petri nets with stochastic arc weights. Arcs are assumed to desribe distributions of token consumption/production. We utilize the weight attribute that is defined in the Petri net based class to store the distribution.

class Arc(source, target, weight={1: 1.0}, properties=None)[source]#

Bases: Arc

property weight_distribution: Dict[int, float]#
Binding#

alias of List[Tuple[Arc, int]]

pm4py.objects.petri_net.saw_net.semantics module#

PM4Py – A Process Mining Library for Python

Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)

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#

rtype:

bool

param pn:

Petri net

param transition:

transition to check

param marking:

marking to check

Returns#

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

Returns#

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

Returns#

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#

rtype:

bool

param pn:

Petri net

param marking:

marking to use

param transition:

transition to genereate all feasible bindings for

Returns#

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

abstract 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#

rtype:

float

param pn:

Petri net

param transition:

transition to fire

param binding:

binding to consider

param marking:

marking to use

Returns#

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#

rtype:

float

param pn:

Petri net

param transition:

transition to fire

param binding:

binding to consider

param marking:

marking to use

Returns#

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#

type seed:

int

param pn:

Petri net

param marking:

marking to use

Returns#

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#

rtype:

float

param pn:

Petri net

param transition:

transition to fire

param binding:

binding to consider

param marking:

marking to use

Returns#

return:

firing probability of transition t under binding b