pm4py.algo.conformance.tokenreplay.variants package¶
Submodules¶
pm4py.algo.conformance.tokenreplay.variants.backwards 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.algo.conformance.tokenreplay.variants.backwards.Parameters[source]¶ Bases:
enum.EnumAn enumeration.
-
ACTIVITY_KEY= 'pm4py:param:activity_key'¶
-
CASE_ID_KEY= 'pm4py:param:case_id_key'¶
-
CLEANING_TOKEN_FLOOD= 'cleaning_token_flood'¶
-
CONSIDER_REMAINING_IN_FITNESS= 'consider_remaining_in_fitness'¶
-
DISABLE_VARIANTS= 'disable_variants'¶
-
ENABLE_PLTR_FITNESS= 'enable_pltr_fitness'¶
-
IS_REDUCTION= 'is_reduction'¶
-
PARAMETER_VARIANT_DELIMITER= 'variant_delimiter'¶
-
PLACES_SHORTEST_PATH_BY_HIDDEN= 'places_shortest_path_by_hidden'¶
-
RETURN_NAMES= 'return_names'¶
-
STOP_IMMEDIATELY_UNFIT= 'stop_immediately_unfit'¶
-
THREAD_MAX_EX_TIME= 'thread_maximum_ex_time'¶
-
TRY_TO_REACH_FINAL_MARKING_THROUGH_HIDDEN= 'try_to_reach_final_marking_through_hidden'¶
-
VARIANTS= 'variants'¶
-
WALK_THROUGH_HIDDEN_TRANS= 'walk_through_hidden_trans'¶
-
-
pm4py.algo.conformance.tokenreplay.variants.backwards.apply(log: pm4py.objects.log.obj.EventLog, net: pm4py.objects.petri_net.obj.PetriNet, initial_marking: pm4py.objects.petri_net.obj.Marking, final_marking: pm4py.objects.petri_net.obj.Marking, parameters: Optional[Dict[Union[str, pm4py.algo.conformance.tokenreplay.variants.backwards.Parameters], Any]] = None) → List[Dict[str, Any]][source]¶ Method to apply token-based replay
Parameters: - log – Log
- net – Petri net
- initial_marking – Initial marking
- final_marking – Final marking
- parameters – Parameters of the algorithm
-
pm4py.algo.conformance.tokenreplay.variants.backwards.diff_mark(m, t)[source]¶ Subtract from a marking the postset of t and adds the preset
Parameters: - m – Marking
- t – Transition
Returns: Difference marking
Return type: diff_mark
-
pm4py.algo.conformance.tokenreplay.variants.backwards.explore_backwards(re_list, all_vis, net, m, bmap)[source]¶ Do the backwards state space exploration
Parameters: - re_list – List of remaining markings to visit using the backwards approach
- all_vis – Set of visited transitions
- net – Petri net
- m – Marking
- bmap – B-map of the net
Returns: List of transitions to enable in order to enable a marking (otherwise None)
Return type: list_tr
-
pm4py.algo.conformance.tokenreplay.variants.backwards.get_bmap(net, m, bmap)[source]¶ Updates the B-map with the invisibles enabling marking m
Parameters: - net – Petri net
- m – Marking
- bmap – B-map
Returns: List of invisibles that enable m
Return type: trans_list
-
pm4py.algo.conformance.tokenreplay.variants.backwards.get_diagnostics_dataframe(log: pm4py.objects.log.obj.EventLog, tbr_output: List[Dict[str, Any]], parameters: Optional[Dict[Union[str, pm4py.algo.conformance.tokenreplay.variants.backwards.Parameters], Any]] = None) → pandas.core.frame.DataFrame[source]¶ Gets the results of token-based replay in a dataframe
Parameters: - log – Event log
- tbr_output – Output of the token-based replay technique
Returns: Diagnostics dataframe
Return type: dataframe
-
pm4py.algo.conformance.tokenreplay.variants.backwards.tr_vlist(vlist, net, im, fm, tmap, bmap, parameters=None)[source]¶ Visit a variant using the backwards token basedr eplay
Parameters: - vlist – Variants list
- net – Petri net
- im – Initial marking
- tmap – Transition map (labels to list of transitions)
- bmap – B-map
- parameters – Possible parameters of the execution
Returns: - visited_transitions – List of visited transitions during the replay
- is_fit – Indicates if the replay was successful or not
pm4py.algo.conformance.tokenreplay.variants.token_replay 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.algo.conformance.tokenreplay.variants.token_replay.ApplyTraceTokenReplay(trace, net, initial_marking, final_marking, trans_map, enable_pltr_fitness, place_fitness, transition_fitness, notexisting_activities_in_model, places_shortest_path_by_hidden, consider_remaining_in_fitness, activity_key='concept:name', reach_mark_through_hidden=True, stop_immediately_when_unfit=False, walk_through_hidden_trans=True, post_fix_caching=None, marking_to_activity_caching=None, is_reduction=False, thread_maximum_ex_time=10, cleaning_token_flood=False, s_components=None, trace_occurrences=1, consider_activities_not_in_model_in_fitness=False)[source]¶ Bases:
object
-
class
pm4py.algo.conformance.tokenreplay.variants.token_replay.DebugConst[source]¶ Bases:
object-
REACH_ITF1= -1¶
-
REACH_ITF2= -1¶
-
REACH_MRH= -1¶
-
-
class
pm4py.algo.conformance.tokenreplay.variants.token_replay.MarkingToActivityCaching[source]¶ Bases:
objectMarking to activity caching
-
exception
pm4py.algo.conformance.tokenreplay.variants.token_replay.NoConceptNameException(message)[source]¶ Bases:
Exception
-
class
pm4py.algo.conformance.tokenreplay.variants.token_replay.Parameters[source]¶ Bases:
enum.EnumAn enumeration.
-
ACTIVITY_KEY= 'pm4py:param:activity_key'¶
-
CASE_ID_KEY= 'pm4py:param:case_id_key'¶
-
CLEANING_TOKEN_FLOOD= 'cleaning_token_flood'¶
-
CONSIDER_ACTIVITIES_NOT_IN_MODEL_IN_FITNESS= 'consider_activities_not_in_model_in_fitness'¶
-
CONSIDER_REMAINING_IN_FITNESS= 'consider_remaining_in_fitness'¶
-
DISABLE_VARIANTS= 'disable_variants'¶
-
ENABLE_PLTR_FITNESS= 'enable_pltr_fitness'¶
-
IS_REDUCTION= 'is_reduction'¶
-
PARAMETER_VARIANT_DELIMITER= 'variant_delimiter'¶
-
PLACES_SHORTEST_PATH_BY_HIDDEN= 'places_shortest_path_by_hidden'¶
-
RETURN_NAMES= 'return_names'¶
-
SHOW_PROGRESS_BAR= 'show_progress_bar'¶
-
STOP_IMMEDIATELY_UNFIT= 'stop_immediately_unfit'¶
-
THREAD_MAX_EX_TIME= 'thread_maximum_ex_time'¶
-
TRY_TO_REACH_FINAL_MARKING_THROUGH_HIDDEN= 'try_to_reach_final_marking_through_hidden'¶
-
VARIANTS= 'variants'¶
-
WALK_THROUGH_HIDDEN_TRANS= 'walk_through_hidden_trans'¶
-
-
class
pm4py.algo.conformance.tokenreplay.variants.token_replay.PostFixCaching[source]¶ Bases:
objectPost fix caching object
-
class
pm4py.algo.conformance.tokenreplay.variants.token_replay.TechnicalParameters[source]¶ Bases:
enum.EnumAn enumeration.
-
ENABLE_MARKTOACT_CACHE= False¶
-
ENABLE_POSTFIX_CACHE= False¶
-
MAX_DEF_THR_EX_TIME= 10¶
-
MAX_IT_FINAL1= 5¶
-
MAX_IT_FINAL2= 5¶
-
MAX_NO_THREADS= 1024¶
-
MAX_POSTFIX_SUFFIX_LENGTH= 20¶
-
MAX_REC_DEPTH= 50¶
-
MAX_REC_DEPTH_HIDTRANSENABL= 2¶
-
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.add_missing_tokens(t, marking)[source]¶ Adds missing tokens needed to activate a transition
Parameters: - t – Transition that should be enabled
- marking – Current marking
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.apply(log: pm4py.objects.log.obj.EventLog, net: pm4py.objects.petri_net.obj.PetriNet, initial_marking: pm4py.objects.petri_net.obj.Marking, final_marking: pm4py.objects.petri_net.obj.Marking, parameters: Optional[Dict[Union[str, pm4py.algo.conformance.tokenreplay.variants.token_replay.Parameters], Any]] = None) → List[Dict[str, Any]][source]¶ Method to apply token-based replay
Parameters: - log – Log
- net – Petri net
- initial_marking – Initial marking
- final_marking – Final marking
- parameters – Parameters of the algorithm
Apply hidden transitions in order to enable a given transition
Parameters: - t – Transition to eventually enable
- net – Petri net
- marking – Marking
- places_shortest_paths_by_hidden – Shortest paths between places connected by hidden transitions
- act_tr – All activated transitions
- rec_depth – Current recursion depth
- visit_trans – All visited transitions by hiddenTrans method
- vis_mark – All visited markings
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.apply_log(log, net, initial_marking, final_marking, enable_pltr_fitness=False, consider_remaining_in_fitness=False, activity_key='concept:name', reach_mark_through_hidden=True, stop_immediately_unfit=False, walk_through_hidden_trans=True, places_shortest_path_by_hidden=None, variants=None, is_reduction=False, thread_maximum_ex_time=10, cleaning_token_flood=False, disable_variants=False, return_object_names=False, show_progress_bar=True, consider_activities_not_in_model_in_fitness=False)[source]¶ Apply token-based replay to a log
Parameters: - log – Trace log
- net – Petri net
- initial_marking – Initial marking
- final_marking – Final marking
- enable_pltr_fitness – Enable fitness retrieval at place level
- consider_remaining_in_fitness – Boolean value telling if the remaining tokens should be considered in fitness evaluation
- activity_key – Name of the attribute that contains the activity
- reach_mark_through_hidden – Boolean value that decides if we shall try to reach the final marking through hidden transitions
- stop_immediately_unfit – Boolean value that decides if we shall stop immediately when a non-conformance is detected
- walk_through_hidden_trans – Boolean value that decides if we shall walk through hidden transitions in order to enable visible transitions
- places_shortest_path_by_hidden – Shortest paths between places by hidden transitions
- variants – List of variants contained in the event log
- is_reduction – Expresses if the token-based replay is called in a reduction attempt
- thread_maximum_ex_time – Alignment threads maximum allowed execution time
- cleaning_token_flood – Decides if a cleaning of the token flood shall be operated
- disable_variants – Disable variants grouping
- return_object_names – Decides whether names instead of object pointers shall be returned
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.apply_trace(trace, net, initial_marking, final_marking, trans_map, enable_pltr_fitness, place_fitness, transition_fitness, notexisting_activities_in_model, places_shortest_path_by_hidden, consider_remaining_in_fitness, activity_key='concept:name', try_to_reach_final_marking_through_hidden=True, stop_immediately_unfit=False, walk_through_hidden_trans=True, post_fix_caching=None, marking_to_activity_caching=None, is_reduction=False, thread_maximum_ex_time=10, enable_postfix_cache=False, enable_marktoact_cache=False, cleaning_token_flood=False, s_components=None, trace_occurrences=1, consider_activities_not_in_model_in_fitness=False)[source]¶ Apply the token replaying algorithm to a trace
Parameters: - trace – Trace in the event log
- net – Petri net
- initial_marking – Initial marking
- final_marking – Final marking
- trans_map – Map between transitions labels and transitions
- enable_pltr_fitness – Enable fitness retrieval at place/transition level
- place_fitness – Current dictionary of places associated with unfit traces
- transition_fitness – Current dictionary of transitions associated with unfit traces
- notexisting_activities_in_model – Map that stores the notexisting activities in the model
- places_shortest_path_by_hidden – Shortest paths between places by hidden transitions
- consider_remaining_in_fitness – Boolean value telling if the remaining tokens should be considered in fitness evaluation
- activity_key – Name of the attribute that contains the activity
- try_to_reach_final_marking_through_hidden – Boolean value that decides if we shall try to reach the final marking through hidden transitions
- stop_immediately_unfit – Boolean value that decides if we shall stop immediately when a non-conformance is detected
- walk_through_hidden_trans – Boolean value that decides if we shall walk through hidden transitions in order to enable visible transitions
- post_fix_caching – Stores the post fix caching object
- marking_to_activity_caching – Stores the marking-to-activity cache
- is_reduction – Expresses if the token-based replay is called in a reduction attempt
- thread_maximum_ex_time – Alignment threads maximum allowed execution time
- enable_postfix_cache – Enables postfix cache
- enable_marktoact_cache – Enables marking to activity cache
- cleaning_token_flood – Decides if a cleaning of the token flood shall be operated
- s_components – S-components of the Petri net (if workflow net)
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.apply_variants_dictionary(variants, net, initial_marking, final_marking, parameters=None)[source]¶
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.apply_variants_list(variants_list, net, initial_marking, final_marking, parameters=None)[source]¶
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.apply_variants_list_petri_string(variants_list, petri_string, parameters=None)[source]¶
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.apply_variants_list_petri_string_multiprocessing(output, variants_list, petri_string, parameters=None)[source]¶
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.break_condition_final_marking(marking, final_marking)[source]¶ Verify break condition for final marking
Parameters: - marking – Current marking
- final_marking – Target final marking
Actually enable hidden transitions on the Petri net
Parameters: - net – Petri net
- marking – Current marking
- activated_transitions – All activated transitions during the replay
- visited_transitions – All visited transitions by the recursion
- all_visited_markings – All visited markings
- hidden_transitions_to_enable – List of hidden transition to enable
- t – Transition against we should check if they are enabled
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.get_consumed_tokens(t)[source]¶ Get tokens consumed firing a transition
Parameters: t – Transition that should be enabled
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.get_diagnostics_dataframe(log: pm4py.objects.log.obj.EventLog, tbr_output: List[Dict[str, Any]], parameters: Optional[Dict[Union[str, pm4py.algo.conformance.tokenreplay.variants.token_replay.Parameters], Any]] = None) → pandas.core.frame.DataFrame[source]¶ Gets the results of token-based replay in a dataframe
Parameters: - log – Event log
- tbr_output – Output of the token-based replay technique
Returns: Diagnostics dataframe
Return type: dataframe
Calculate an ordered list of transitions to visit in order to enable a given transition
Parameters: - marking – Current marking
- places_with_missing – List of places with missing tokens
- places_shortest_path_by_hidden – Minimal connection between places by hidden transitions
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.get_places_with_missing_tokens(t, marking)[source]¶ Get places with missing tokens
Parameters: - t – Transition to enable
- marking – Current marking
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.get_produced_tokens(t)[source]¶ Get tokens produced firing a transition
Parameters: t – Transition that should be enabled
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.get_req_transitions_for_final_marking(marking, final_marking, places_shortest_path_by_hidden)[source]¶ Gets required transitions for final marking
Parameters: - marking – Current marking
- final_marking – Final marking assigned to the Petri net
- places_shortest_path_by_hidden – Minimal connection between places by hidden transitions
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.get_variant_from_trace(trace, activity_key, disable_variants=False)[source]¶ Gets the variant from the trace (allow disabling)
Parameters: - trace – Trace
- activity_key – Attribute that is the activity
- disable_variants – Boolean value that disable variants
Returns: Variant describing the trace
Return type: variant
-
pm4py.algo.conformance.tokenreplay.variants.token_replay.get_variants_from_log(log, activity_key, disable_variants=False)[source]¶ Gets the variants from the log (allow disabling by giving each trace a different variant)
Parameters: - log – Trace log
- activity_key – Attribute that is the activity
- disable_variants – Boolean value that disable variants
Returns: Variants contained in the log
Return type: variants
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/>.