pm4py.objects.petri_net.utils package
Submodules
pm4py.objects.petri_net.utils.align_utils module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- class pm4py.objects.petri_net.utils.align_utils.DijkstraSearchTuple(g, m, p, t, l)[source]
Bases:
object
- class pm4py.objects.petri_net.utils.align_utils.DijkstraSearchTupleForAntiAndMulti(g, m, r)[source]
Bases:
object
- class pm4py.objects.petri_net.utils.align_utils.SearchTuple(f, g, h, m, p, t, x, trust)[source]
Bases:
object
- class pm4py.objects.petri_net.utils.align_utils.TweakedSearchTuple(f, g, h, m, p, t, x, trust, virgin)[source]
Bases:
object
- pm4py.objects.petri_net.utils.align_utils.construct_standard_cost_function(synchronous_product_net, skip)[source]
Returns the standard cost function, which is: * event moves: cost 1000 * model moves: cost 1000 * tau moves: cost 1 * sync moves: cost 0 :param synchronous_product_net: :param skip: :return:
- pm4py.objects.petri_net.utils.align_utils.discountedEditDistance(s1, s2, exponent=2, modeled=True)[source]
Fast implementation of the discounted distance Inspired from the faster version of the edit distance
- pm4py.objects.petri_net.utils.align_utils.get_visible_transitions_eventually_enabled_by_marking(net, marking)[source]
Get visible transitions eventually enabled by marking (passing possibly through hidden transitions) :Parameters: * net – Petri net
marking – Current marking
- pm4py.objects.petri_net.utils.align_utils.levenshtein(seq1, seq2)[source]
Edit distance without substitution
- pm4py.objects.petri_net.utils.align_utils.pretty_print_alignments(alignments)[source]
- Takes an alignment and prints it to the console, e.g.:
A | B | C | D |
A | B | C | >> |
- Parameters
alignment – <class ‘list’>
- Returns
Nothing
- pm4py.objects.petri_net.utils.align_utils.search_path_among_sol(sync_net: pm4py.objects.petri_net.obj.PetriNet, ini: pm4py.objects.petri_net.obj.Marking, fin: pm4py.objects.petri_net.obj.Marking, activated_transitions: List[pm4py.objects.petri_net.obj.PetriNet.Transition], skip='>>') Tuple[List[pm4py.objects.petri_net.obj.PetriNet.Transition], bool, int] [source]
(Efficient method) Searches a firing sequence among the X vector that is the solution of the (extended) marking equation
- Parameters
sync_net – Synchronous product net
ini – Initial marking of the net
fin – Final marking of the net
activated_transitions – Transitions that have non-zero occurrences in the X vector
skip – Skip transition
- Returns
firing_sequence – Firing sequence
reach_fm – Boolean value that tells if the final marking is reached by the firing sequence
explained_events – Number of explained events
pm4py.objects.petri_net.utils.check_soundness module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- pm4py.objects.petri_net.utils.check_soundness.check_easy_soundness_net_in_fin_marking(net, ini, fin)[source]
Checks the easy soundness of a Petri net having the initial and the final marking
- Parameters
net – Petri net
ini – Initial marking
fin – Final marking
- Returns
Boolean value
- Return type
boolean
- pm4py.objects.petri_net.utils.check_soundness.check_easy_soundness_of_wfnet(net)[source]
Checks the easy soundness of a workflow net
- Parameters
net – Petri net
- Returns
Boolean value
- Return type
boolean
- pm4py.objects.petri_net.utils.check_soundness.check_sink_place_presence(net)[source]
Check if there is a unique sink place with empty connections
- Parameters
net – Petri net
- Returns
Unique source place (or None otherwise)
- Return type
place
- pm4py.objects.petri_net.utils.check_soundness.check_source_and_sink_reachability(net, unique_source, unique_sink)[source]
Checks reachability of the source and the sink place from all simulation nodes (places/transitions) of the Petri net
- Parameters
net – Petri net
unique_source – Unique source place of the Petri net
unique_sink – Unique sink place of the Petri net
- Returns
Boolean value that is true if each node is in a path from the source place to the sink place
- Return type
boolean
- pm4py.objects.petri_net.utils.check_soundness.check_source_place_presence(net)[source]
Check if there is a unique source place with empty connections
- Parameters
net – Petri net
- Returns
Unique source place (or None otherwise)
- Return type
place
pm4py.objects.petri_net.utils.consumption_matrix module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- class pm4py.objects.petri_net.utils.consumption_matrix.ConsumptionMatrix(net: pm4py.objects.petri_net.obj.PetriNet)[source]
Bases:
object
- property c_matrix: numpy.ndarray
Gets the Numpy representation of the consumption matrix
- Returns
C matrix
- Return type
C
- property places: Dict[pm4py.objects.petri_net.obj.PetriNet.Place, int]
Gets the places in the order in which they have been inserted in the consumption matrix
- Returns
Dictionary associating to each place an incremental number
- Return type
place_indices
- property transitions: Dict[pm4py.objects.petri_net.obj.PetriNet.Transition, int]
Gets the transitions in the order in which they have been inserted in the consumption matrix
- Returns
Dictionary associating to each transition an incremental number
- Return type
trans_indices
- pm4py.objects.petri_net.utils.consumption_matrix.construct(net: pm4py.objects.petri_net.obj.PetriNet) pm4py.objects.petri_net.utils.consumption_matrix.ConsumptionMatrix [source]
Construct a consumption matrix given a Petri net
- Parameters
net – Petri net
- Returns
Consumption matrix object
- Return type
cons_mat
pm4py.objects.petri_net.utils.decomposition module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
pm4py.objects.petri_net.utils.embed_stochastic_map module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
pm4py.objects.petri_net.utils.explore_path module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
pm4py.objects.petri_net.utils.final_marking module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
pm4py.objects.petri_net.utils.incidence_matrix module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
pm4py.objects.petri_net.utils.initial_marking module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
pm4py.objects.petri_net.utils.networkx_graph module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- pm4py.objects.petri_net.utils.networkx_graph.create_networkx_directed_graph(net, weight=None)[source]
Create a NetworkX directed graph from a Petri net
- Parameters
net – Petri net
- Returns
graph – NetworkX digraph
inv_dictionary – Correspondence between NetworkX nodes and Petri net entities
- pm4py.objects.petri_net.utils.networkx_graph.create_networkx_directed_graph_ret_dict_both_ways(net, weight=None)[source]
Create a NetworkX directed graph from a Petri net
- Parameters
net – Petri net
- Returns
graph – NetworkX digraph
dictionary – dict mapping Petri net nodes to NetworkX nodes
inv_dictionary – dict mapping NetworkX nodes to Petri net nodes
- pm4py.objects.petri_net.utils.networkx_graph.create_networkx_undirected_graph(net, unique_source, unique_sink)[source]
Create a NetworkX undirected graph from a Petri net, returning also correspondences for the unique source and the unique sink places that were discovered
- Parameters
net – Petri net
unique_source – Unique source place
unique_sink – Unique sink place
- Returns
graph – NetworkX graph
unique_source_corr – Correspondence in the NetworkX graph of the unique source place
unique_sink_corr – Correspondence in the NetworkX graph of the unique sink place
inv_dictionary – Correspondence between NetworkX nodes and Petri net entities
pm4py.objects.petri_net.utils.performance_map module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- pm4py.objects.petri_net.utils.performance_map.aggregate_statistics(statistics, measure='frequency', aggregation_measure=None, stat_locale: dict = {})[source]
Gets aggregated statistics
- Parameters
statistics – Individual element statistics (including unaggregated performances)
measure – Desidered view on data (frequency or performance)
aggregation_measure – Aggregation measure (e.g. mean, min) to use
stat_locale – Dict to locale the stat strings
- Returns
Aggregated statistics for arcs, transitions, places
- Return type
aggregated_statistics
- pm4py.objects.petri_net.utils.performance_map.aggregate_stats(statistics, elem, aggregation_measure)[source]
Aggregate the statistics
- Parameters
statistics – Element statistics
elem – Current element
aggregation_measure – Aggregation measure (e.g. mean, min) to use
- Returns
Aggregated statistics
- Return type
aggr_stat
- pm4py.objects.petri_net.utils.performance_map.calculate_annotation_for_trace(trace, net, initial_marking, act_trans, activity_key, ht_perf_method='last')[source]
Calculate annotation for a trace in the variant, in order to retrieve information useful for calculate frequency/performance for all the traces belonging to the variant
- Parameters
trace – Trace
net – Petri net
initial_marking – Initial marking
act_trans – Activated transitions during token replay of the given trace
activity_key – Attribute that identifies the activity (must be specified if different from concept:name)
ht_perf_method – Method to use in order to annotate hidden transitions (performance value could be put on the last possible point (last) or in the first possible point (first)
- Returns
Statistics annotation for the given trace
- Return type
annotation
- pm4py.objects.petri_net.utils.performance_map.filter_cases_exceeding_specified_acti_performance(log, transition_performance, activity, lower_bound)[source]
Filter cases exceeding the specified activity performance threshold
- Parameters
log – Event log
transition_performance – Dictionary where each transition label is associated to performance measures
activity – Target activity (of the filter)
lower_bound – Lower bound (filter cases which have a duration of the activity exceeding)
- Returns
Filtered log
- Return type
filtered_log
- pm4py.objects.petri_net.utils.performance_map.find_min_max_arc_frequency(statistics)[source]
Find minimum and maximum arc frequency
- Parameters
statistics – Element statistics
- Returns
min_frequency – Minimum arc frequency
max_frequency – Maximum arc frequency
- pm4py.objects.petri_net.utils.performance_map.find_min_max_arc_performance(statistics, aggregation_measure)[source]
Find minimum and maximum arc performance
- Parameters
statistics – Element statistics
aggregation_measure – Aggregation measure (e.g. mean, min) to use
- Returns
min_performance – Minimum performance
max_performance – Maximum performance
- pm4py.objects.petri_net.utils.performance_map.find_min_max_trans_frequency(statistics)[source]
Find minimum and maximum transition frequency
- Parameters
statistics – Element statistics
- Returns
min_frequency – Minimum transition frequency (in the replay)
max_frequency – Maximum transition frequency (in the replay)
- pm4py.objects.petri_net.utils.performance_map.get_idx_exceeding_specified_acti_performance(log, transition_performance, activity, lower_bound)[source]
Get indexes of the cases exceeding the specified activity performance threshold
- Parameters
log – Event log
transition_performance – Dictionary where each transition label is associated to performance measures
activity – Target activity (of the filter)
lower_bound – Lower bound (filter cases which have a duration of the activity exceeding)
- Returns
A list of indexes in the log
- Return type
idx
- pm4py.objects.petri_net.utils.performance_map.get_transition_performance_with_token_replay(log, net, im, fm)[source]
Gets the transition performance through the usage of token-based replay
- Parameters
log – Event log
net – Petri net
im – Initial marking
fm – Final marking
- Returns
Dictionary where each transition label is associated to performance measures
- Return type
transition_performance
- pm4py.objects.petri_net.utils.performance_map.single_element_statistics(log, net, initial_marking, aligned_traces, variants_idx, activity_key='concept:name', timestamp_key='time:timestamp', ht_perf_method='last', parameters=None)[source]
Get single Petrinet element statistics
- Parameters
log – Log
net – Petri net
initial_marking – Initial marking
aligned_traces – Result of the token-based replay
variants_idx – Variants along with indexes of belonging traces
activity_key – Activity key (must be specified if different from concept:name)
timestamp_key – Timestamp key (must be specified if different from time:timestamp)
ht_perf_method – Method to use in order to annotate hidden transitions (performance value could be put on the last possible point (last) or in the first possible point (first)
parameters – Possible parameters of the algorithm
- Returns
Petri net element statistics (frequency, unaggregated performance)
- Return type
statistics
pm4py.objects.petri_net.utils.petri_utils module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- pm4py.objects.petri_net.utils.petri_utils.acyclic_net_variants(net, initial_marking, final_marking, activity_key='concept:name')[source]
Given an acyclic accepting Petri net, initial and final marking extracts a set of variants (in form of traces) replayable on the net. Warning: this function is based on a marking exploration. If the accepting Petri net contains loops, the method will not work properly as it stops the search if a specific marking has already been encountered.
- Parameters
param net: An acyclic workflow net
param initial_marking: The initial marking of the net.
param final_marking: The final marking of the net.
param activity_key: activity key to use
- Returns
- Return type
return: variants:
list
Set of variants - in the form of Trace objects - obtainable executing the net
- pm4py.objects.petri_net.utils.petri_utils.add_arc_from_to(fr, to, net: pm4py.objects.petri_net.obj.PetriNet, weight=1, type=None) pm4py.objects.petri_net.obj.PetriNet.Arc [source]
Adds an arc from a specific element to another element in some net. Assumes from and to are in the net!
- Parameters
fr (transition/place from)
to (transition/place to)
net (net to use)
weight (weight associated to the arc)
- Returns
- Return type
None
- pm4py.objects.petri_net.utils.petri_utils.add_place(net: pm4py.objects.petri_net.obj.PetriNet, name=None) pm4py.objects.petri_net.obj.PetriNet.Place [source]
- pm4py.objects.petri_net.utils.petri_utils.add_transition(net: pm4py.objects.petri_net.obj.PetriNet, name=None, label=None) pm4py.objects.petri_net.obj.PetriNet.Transition [source]
- pm4py.objects.petri_net.utils.petri_utils.construct_trace_net(trace, trace_name_key='concept:name', activity_key='concept:name')[source]
Creates a trace net, i.e. a trace in Petri net form.
- Parameters
trace (
list
input trace, assumed to be a list of events)trace_name_key (
str
key of the attribute that defines the name of the trace)activity_key (
str
key of the attribute of the events that defines the activity name)
- Returns
tuple
- Return type
tuple
of the net, initial marking and the final marking
- pm4py.objects.petri_net.utils.petri_utils.construct_trace_net_cost_aware(trace, costs, trace_name_key='concept:name', activity_key='concept:name')[source]
Creates a trace net, i.e. a trace in Petri net form mapping specific costs to transitions.
- Parameters
trace (
list
input trace, assumed to be a list of events)costs (
list
list of costs, length should be equal to the length of the input trace)trace_name_key (
str
key of the attribute that defines the name of the trace)activity_key (
str
key of the attribute of the events that defines the activity name)
- Returns
tuple
- Return type
tuple
of the net, initial marking, final marking and map of costs
- pm4py.objects.petri_net.utils.petri_utils.decorate_places_preset_trans(net: pm4py.objects.petri_net.obj.PetriNet)[source]
Decorate places with information useful for the replay
- Parameters
net – Petri net
- pm4py.objects.petri_net.utils.petri_utils.decorate_transitions_prepostset(net: pm4py.objects.petri_net.obj.PetriNet)[source]
Decorate transitions with sub and addition markings
- Parameters
net – Petri net
- pm4py.objects.petri_net.utils.petri_utils.get_cycles_petri_net_places(net)[source]
Get the cycles of a Petri net (returning only list of places belonging to the cycle)
- Parameters
net – Petri net
- Returns
Cycles (places) of the Petri net
- Return type
cycles
Deprecated since version 2.2.7: This will be removed in 3.0.0.
- pm4py.objects.petri_net.utils.petri_utils.get_cycles_petri_net_transitions(net)[source]
Get the cycles of a Petri net (returning only list of transitions belonging to the cycle)
- Parameters
net – Petri net
- Returns
Cycles (transitions) of the Petri net
- Return type
cycles
Deprecated since version 2.2.7: This will be removed in 3.0.0.
- pm4py.objects.petri_net.utils.petri_utils.get_places_shortest_path(net, place_to_populate, current_place, places_shortest_path, actual_list, rec_depth, max_rec_depth)[source]
Get shortest path between places lead by hidden transitions
- Parameters
net – Petri net
place_to_populate – Place that we are populating the shortest map of
current_place – Current visited place (must explore its transitions)
places_shortest_path – Current dictionary
actual_list – Actual list of transitions to enable
rec_depth – Recursion depth
max_rec_depth – Maximum recursion depth
Get shortest path between places lead by hidden transitions
- Parameters
net – Petri net
max_rec_depth – Maximum recursion depth
- pm4py.objects.petri_net.utils.petri_utils.get_s_components_from_petri(net, im, fm, rec_depth=0, curr_s_comp=None, visited_places=None, list_s_components=None, max_rec_depth=6)[source]
Gets the S-components from a Petri net
- Parameters
net – Petri net
im – Initial marking
fm – Final marking
curr_s_comp – Current S component
visited_places – Visited places
list_s_components – List of S-components
max_rec_depth – Maximum recursion depth
- Returns
List of S-components
- Return type
s_components
- pm4py.objects.petri_net.utils.petri_utils.get_strongly_connected_subnets(net)[source]
Get the strongly connected components subnets in the Petri net
- Parameters
net – Petri net
- Returns
List of strongly connected transitions of the Petri net
- Return type
strongly_connected_transitions
Deprecated since version 2.2.7: This will be removed in 3.0.0.
- pm4py.objects.petri_net.utils.petri_utils.get_transition_by_name(net: pm4py.objects.petri_net.obj.PetriNet, transition_name) Optional[pm4py.objects.petri_net.obj.PetriNet.Transition] [source]
Get a transition by its name
- Parameters
net – Petri net
transition_name – Transition name
- Returns
Transition object
- Return type
transition
- pm4py.objects.petri_net.utils.petri_utils.invert_spaths_dictionary(spaths)[source]
Invert the shortest paths (between places) dictionary, from target-source to source-target
- Parameters
spaths – Shortest paths dictionary
- Returns
Inverted shortest paths dictionary
- Return type
inv_spaths
- pm4py.objects.petri_net.utils.petri_utils.is_sub_marking(sub_marking: pm4py.objects.petri_net.obj.Marking, marking: pm4py.objects.petri_net.obj.Marking) bool [source]
- pm4py.objects.petri_net.utils.petri_utils.merge(trgt: Optional[pm4py.objects.petri_net.obj.PetriNet] = None, nets=None) pm4py.objects.petri_net.obj.PetriNet [source]
- pm4py.objects.petri_net.utils.petri_utils.place_set_as_marking(places) pm4py.objects.petri_net.obj.Marking [source]
- pm4py.objects.petri_net.utils.petri_utils.remove_arc(net: pm4py.objects.petri_net.obj.PetriNet, arc: pm4py.objects.petri_net.obj.PetriNet.Arc) pm4py.objects.petri_net.obj.PetriNet [source]
Removes an arc from a Petri net
- Parameters
net – Petri net
arc – Arc of the Petri net
- Returns
Petri net
- Return type
net
- pm4py.objects.petri_net.utils.petri_utils.remove_place(net: pm4py.objects.petri_net.obj.PetriNet, place: pm4py.objects.petri_net.obj.PetriNet.Place) pm4py.objects.petri_net.obj.PetriNet [source]
Remove a place from a Petri net
- Parameters
net – Petri net
place – Place to remove
- Returns
Petri net
- Return type
net
- pm4py.objects.petri_net.utils.petri_utils.remove_transition(net: pm4py.objects.petri_net.obj.PetriNet, trans: pm4py.objects.petri_net.obj.PetriNet.Transition) pm4py.objects.petri_net.obj.PetriNet [source]
Remove a transition from a Petri net
- Parameters
net – Petri net
trans – Transition to remove
- Returns
Petri net
- Return type
net
- pm4py.objects.petri_net.utils.petri_utils.remove_unconnected_components(net: pm4py.objects.petri_net.obj.PetriNet) pm4py.objects.petri_net.obj.PetriNet [source]
Remove unconnected components from a Petri net
- Parameters
net – Petri net
- Returns
Cleaned Petri net
- Return type
net
pm4py.objects.petri_net.utils.projection module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- pm4py.objects.petri_net.utils.projection.project_net_on_matrix(net, activities, parameters=None)[source]
Project a Petri net with: - only visible transitions - where each place preset/postset is disjoint - with unique visible transitions on a numeric matrix
- Parameters
net – Petri net
activities – List of activities
parameters – Possible parameters of the algorithm
pm4py.objects.petri_net.utils.reachability_graph module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- class pm4py.objects.petri_net.utils.reachability_graph.Parameters(value)[source]
Bases:
enum.Enum
An enumeration.
- MAX_ELAB_TIME = 'max_elab_time'
- PETRI_SEMANTICS = 'petri_semantics'
- pm4py.objects.petri_net.utils.reachability_graph.construct_reachability_graph(net, initial_marking, use_trans_name=False, parameters=None)[source]
Creates a reachability graph of a certain Petri net. DO NOT ATTEMPT WITH AN UNBOUNDED PETRI NET, EVER.
- Parameters
net (Petri net)
initial_marking (initial marking of the Petri net.)
- Returns
re_gr
- Return type
Transition system that represents the reachability graph of the input Petri net.
- pm4py.objects.petri_net.utils.reachability_graph.construct_reachability_graph_from_flow(incoming_transitions, outgoing_transitions, use_trans_name=False, parameters=None)[source]
Construct the reachability graph from the marking flow
- Parameters
incoming_transitions – Incoming transitions
outgoing_transitions – Outgoing transitions
use_trans_name – Use the transition name
- Returns
Transition system that represents the reachability graph of the input Petri net.
- Return type
re_gr
- pm4py.objects.petri_net.utils.reachability_graph.marking_flow_petri(net, im, return_eventually_enabled=False, parameters=None)[source]
Construct the marking flow of a Petri net
- Parameters
net – Petri net
im – Initial marking
return_eventually_enabled – Return the eventually enabled (visible) transitions
- pm4py.objects.petri_net.utils.reachability_graph.staterep(name)[source]
Creates a string representation for a state of a transition system. Necessary because graphviz does not support symbols simulation than alphanimerics and ‘_’. TODO: find a better representation.
- Parameters
name (the name of a state)
- Returns
- Return type
Version of the name filtered of non-alphanumerical characters (except ‘_’)
pm4py.objects.petri_net.utils.reduction module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- pm4py.objects.petri_net.utils.reduction.apply_a_rule(net)[source]
Apply the Abstraction (A) rule
- Parameters
net – Reset Inhibitor net
- pm4py.objects.petri_net.utils.reduction.apply_elp_rule(net, im=None)[source]
Apply the Elimination of Self-Loop Places (ELP) rule
- Parameters
net – Reset Inhibitor net
- pm4py.objects.petri_net.utils.reduction.apply_elt_rule(net)[source]
Apply the Elimination of Self-Loop Transitions (ELT) rule
- Parameters
net – Reset Inhibitor net
- pm4py.objects.petri_net.utils.reduction.apply_fpp_rule(net, im=None)[source]
Apply the Fusion of Parallel Places (FPP) rule
- Parameters
net – Reset Inhibitor net
- pm4py.objects.petri_net.utils.reduction.apply_fpt_rule(net)[source]
Apply the Fusion of Parallel Transitions (FPT) rule
- Parameters
net – Reset Inhibitor net
- pm4py.objects.petri_net.utils.reduction.apply_fsp_rule(net, im=None, fm=None)[source]
Apply the Fusion of Series Places (FSP) rule
- Parameters
net – Reset Inhibitor net
- pm4py.objects.petri_net.utils.reduction.apply_fst_rule(net)[source]
Apply the Fusion of Series Transitions (FST) rule
- Parameters
net – Reset Inhibitor net
- pm4py.objects.petri_net.utils.reduction.apply_r_rule(net)[source]
Apply the Reset Reduction (R) rule
- Parameters
net – Reset Inhibitor net
- pm4py.objects.petri_net.utils.reduction.apply_reset_inhibitor_net_reduction(net, im=None, fm=None)[source]
Apply a thorough reduction to the Reset Inhibitor net
- Parameters
net – Reset Inhibitor net
- pm4py.objects.petri_net.utils.reduction.apply_simple_reduction(net)[source]
Apply a simple reduction to the Petri net
- Parameters
net – Petri net
pm4py.objects.petri_net.utils.synchronous_product module
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
- pm4py.objects.petri_net.utils.synchronous_product.construct(pn1, im1, fm1, pn2, im2, fm2, skip)[source]
Constructs the synchronous product net of two given Petri nets.
- Parameters
pn1 – Petri net 1
im1 – Initial marking of Petri net 1
fm1 – Final marking of Petri net 1
pn2 – Petri net 2
im2 – Initial marking of Petri net 2
fm2 – Final marking of Petri net 2
skip – Symbol to be used as skip
- Returns
- Return type
return: Synchronous product net and associated marking labels are of the form (a,>>)
- pm4py.objects.petri_net.utils.synchronous_product.construct_cost_aware(pn1, im1, fm1, pn2, im2, fm2, skip, pn1_costs, pn2_costs, sync_costs)[source]
Constructs the synchronous product net of two given Petri nets.
- Parameters
pn1 – Petri net 1
im1 – Initial marking of Petri net 1
fm1 – Final marking of Petri net 1
pn2 – Petri net 2
im2 – Initial marking of Petri net 2
fm2 – Final marking of Petri net 2
skip – Symbol to be used as skip
pn1_costs – dictionary mapping transitions of pn1 to corresponding costs
pn2_costs – dictionary mapping transitions of pn2 to corresponding costs
pn1_costs – dictionary mapping pairs of transitions in pn1 and pn2 to costs
sync_costs – Costs of sync moves
- Returns
- Return type
return: Synchronous product net and associated marking labels are of the form (a,>>)
Module contents
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PM4Py 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.