pm4py.objects.petri package
Subpackages
Submodules
pm4py.objects.petri.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.align_utils.DijkstraSearchTupleForAntiAndMulti(g, m, r)[source]
Bases:
object
- class pm4py.objects.petri.align_utils.SearchTuple(f, g, h, m, p, t, x, trust)[source]
Bases:
object
- class pm4py.objects.petri.align_utils.TweakedSearchTuple(f, g, h, m, p, t, x, trust, virgin)[source]
Bases:
object
- pm4py.objects.petri.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.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.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.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.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.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.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.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.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.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.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.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.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.consumption_matrix.construct(net: pm4py.objects.petri_net.obj.PetriNet) pm4py.objects.petri.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.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.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.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.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.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.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.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.obj 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.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.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.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.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.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.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.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.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.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.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.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.petrinet 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.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.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.properties 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.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.reachability_graph.Parameters(value)[source]
Bases:
enum.Enum
An enumeration.
- MAX_ELAB_TIME = 'max_elab_time'
- pm4py.objects.petri.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.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.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.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.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.reduction.apply_simple_reduction(net)[source]
Apply a simple reduction to the Petri net
- Parameters
net – Petri net
pm4py.objects.petri.semantics 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.semantics.enabled_transitions(pn, m)[source]
Returns a set of enabled transitions in a Petri net and given marking
- Parameters
param pn: Petri net
param m: marking of the pn
- Returns
- Return type
return: set of enabled transitions
- pm4py.objects.petri.semantics.execute(t, pn, m)[source]
Executes a given transition in a given Petri net and Marking
- Parameters
param t: transition to execute
param pn: Petri net
param m: marking to use
- Returns
- Return type
return: newly reached marking if :param t: is enabled, None otherwise
pm4py.objects.petri.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.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.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,>>)
pm4py.objects.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.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.utils.add_arc_from_to(fr, to, net, weight=1)[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.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.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.utils.decorate_places_preset_trans(net)[source]
Decorate places with information useful for the replay
- Parameters
net – Petri net
- pm4py.objects.petri.utils.decorate_transitions_prepostset(net)[source]
Decorate transitions with sub and addition markings
- Parameters
net – Petri net
- pm4py.objects.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
- pm4py.objects.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
- pm4py.objects.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.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.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
- pm4py.objects.petri.utils.get_transition_by_name(net, transition_name)[source]
Get a transition by its name
- Parameters
net – Petri net
transition_name – Transition name
- Returns
Transition object
- Return type
transition
- pm4py.objects.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.utils.remove_arc(net, arc)[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.utils.remove_place(net, place)[source]
Remove a place from a Petri net
- Parameters
net – Petri net
place – Place to remove
- Returns
Petri net
- Return type
net
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/>.