pm4py.algo.conformance.tokenreplay.variants.token_replay module#
- class pm4py.algo.conformance.tokenreplay.variants.token_replay.Parameters(*values)[source]#
Bases:
Enum- CASE_ID_KEY = 'pm4py:param:case_id_key'#
- ACTIVITY_KEY = 'pm4py:param:activity_key'#
- PARAMETER_VARIANT_DELIMITER = 'variant_delimiter'#
- VARIANTS = 'variants'#
- PLACES_SHORTEST_PATH_BY_HIDDEN = 'places_shortest_path_by_hidden'#
- THREAD_MAX_EX_TIME = 'thread_maximum_ex_time'#
- DISABLE_VARIANTS = 'disable_variants'#
- CLEANING_TOKEN_FLOOD = 'cleaning_token_flood'#
- IS_REDUCTION = 'is_reduction'#
- WALK_THROUGH_HIDDEN_TRANS = 'walk_through_hidden_trans'#
- RETURN_NAMES = 'return_names'#
- STOP_IMMEDIATELY_UNFIT = 'stop_immediately_unfit'#
- TRY_TO_REACH_FINAL_MARKING_THROUGH_HIDDEN = 'try_to_reach_final_marking_through_hidden'#
- CONSIDER_REMAINING_IN_FITNESS = 'consider_remaining_in_fitness'#
- CONSIDER_ACTIVITIES_NOT_IN_MODEL_IN_FITNESS = 'consider_activities_not_in_model_in_fitness'#
- ENABLE_PLTR_FITNESS = 'enable_pltr_fitness'#
- SHOW_PROGRESS_BAR = 'show_progress_bar'#
- class pm4py.algo.conformance.tokenreplay.variants.token_replay.TechnicalParameters(*values)[source]#
Bases:
Enum- MAX_REC_DEPTH = 50#
- MAX_IT_FINAL1 = 5#
- MAX_IT_FINAL2 = 5#
- MAX_REC_DEPTH_HIDTRANSENABL = 2#
- MAX_POSTFIX_SUFFIX_LENGTH = 20#
- MAX_NO_THREADS = 1024#
- MAX_DEF_THR_EX_TIME = 10#
- ENABLE_POSTFIX_CACHE = False#
- ENABLE_MARKTOACT_CACHE = False#
- class pm4py.algo.conformance.tokenreplay.variants.token_replay.DebugConst[source]#
Bases:
object- REACH_MRH = -1#
- REACH_ITF1 = -1#
- REACH_ITF2 = -1#
- exception pm4py.algo.conformance.tokenreplay.variants.token_replay.NoConceptNameException(message)[source]#
Bases:
Exception
- 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.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_produced_tokens(t)[source]#
Get tokens produced firing a transition
- Parameters:
t – Transition that should be enabled
- pm4py.algo.conformance.tokenreplay.variants.token_replay.merge_dicts(x, y)[source]#
Merge two dictionaries keeping the least value
- Parameters:
x – First map (string, integer)
y – Second map (string, integer)
- 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
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_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
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
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.break_condition_final_marking(marking, final_marking)[source]#
Verify break condition for final marking
- Parameters:
marking – Current marking
final_marking – Target final marking
- 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)
- 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.PostFixCaching[source]#
Bases:
objectPost fix caching object
- class pm4py.algo.conformance.tokenreplay.variants.token_replay.MarkingToActivityCaching[source]#
Bases:
objectMarking to activity caching
- 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.transcribe_result(t, return_object_names=True)[source]#
- 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, 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, case_id_key='case:concept:name')[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
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(log: EventLog, net: PetriNet, initial_marking: Marking, final_marking: Marking, parameters: Dict[str | Parameters, Any] | None = 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.token_replay.apply_variants_list(variants_list, net, initial_marking, final_marking, parameters=None)[source]#
- 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_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.get_diagnostics_dataframe(log: EventLog, tbr_output: List[Dict[str, Any]], parameters: Dict[str | Parameters, Any] | None = None) 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