pm4py.algo.conformance.alignments.petri_net.algorithm module#

PM4Py – A Process Mining Library for Python

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

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.

Website: https://processintelligence.solutions Contact: info@processintelligence.solutions

class pm4py.algo.conformance.alignments.petri_net.algorithm.Variants(*values)[source]#

Bases: Enum

VERSION_STATE_EQUATION_A_STAR = <module 'pm4py.algo.conformance.alignments.petri_net.variants.state_equation_a_star' from '/home/berti/pm4py/pm4py/algo/conformance/alignments/petri_net/variants/state_equation_a_star.py'>#
VERSION_DIJKSTRA_NO_HEURISTICS = <module 'pm4py.algo.conformance.alignments.petri_net.variants.dijkstra_no_heuristics' from '/home/berti/pm4py/pm4py/algo/conformance/alignments/petri_net/variants/dijkstra_no_heuristics.py'>#
VERSION_DIJKSTRA_LESS_MEMORY = <module 'pm4py.algo.conformance.alignments.petri_net.variants.dijkstra_less_memory' from '/home/berti/pm4py/pm4py/algo/conformance/alignments/petri_net/variants/dijkstra_less_memory.py'>#
VERSION_DISCOUNTED_A_STAR = <module 'pm4py.algo.conformance.alignments.petri_net.variants.discounted_a_star' from '/home/berti/pm4py/pm4py/algo/conformance/alignments/petri_net/variants/discounted_a_star.py'>#
class pm4py.algo.conformance.alignments.petri_net.algorithm.Parameters(*values)[source]#

Bases: Enum

PARAM_TRACE_COST_FUNCTION = 'trace_cost_function'#
PARAM_MODEL_COST_FUNCTION = 'model_cost_function'#
PARAM_SYNC_COST_FUNCTION = 'sync_cost_function'#
PARAM_ALIGNMENT_RESULT_IS_SYNC_PROD_AWARE = 'ret_tuple_as_trans_desc'#
PARAM_TRACE_NET_COSTS = 'trace_net_costs'#
TRACE_NET_CONSTR_FUNCTION = 'trace_net_constr_function'#
TRACE_NET_COST_AWARE_CONSTR_FUNCTION = 'trace_net_cost_aware_constr_function'#
PARAM_MAX_ALIGN_TIME_TRACE = 'max_align_time_trace'#
PARAM_MAX_ALIGN_TIME = 'max_align_time'#
PARAMETER_VARIANT_DELIMITER = 'variant_delimiter'#
CASE_ID_KEY = 'pm4py:param:case_id_key'#
ACTIVITY_KEY = 'pm4py:param:activity_key'#
VARIANTS_IDX = 'variants_idx'#
SHOW_PROGRESS_BAR = 'show_progress_bar'#
CORES = 'cores'#
BEST_WORST_COST_INTERNAL = 'best_worst_cost_internal'#
FITNESS_ROUND_DIGITS = 'fitness_round_digits'#
SYNCHRONOUS = 'synchronous_dijkstra'#
EXPONENT = 'theta'#
ENABLE_BEST_WORST_COST = 'enable_best_worst_cost'#
pm4py.algo.conformance.alignments.petri_net.algorithm.apply(obj: EventLog | EventStream | DataFrame | Trace, petri_net: PetriNet, initial_marking: Marking, final_marking: Marking, parameters: Dict[Any, Any] | None = None, variant=Variants.VERSION_STATE_EQUATION_A_STAR) Dict[str, Any] | List[Dict[str, Any]][source]#
pm4py.algo.conformance.alignments.petri_net.algorithm.apply_trace(trace, petri_net, initial_marking, final_marking, parameters=None, variant=Variants.VERSION_STATE_EQUATION_A_STAR)[source]#

Apply alignments to a trace.

Parameters:
  • tracepm4py.log.log.Trace trace of events

  • petri_netpm4py.objects.petri.petrinet.PetriNet the model to use for the alignment

  • initial_markingpm4py.objects.petri.petrinet.Marking initial marking of the net

  • final_markingpm4py.objects.petri.petrinet.Marking final marking of the net

  • variant – selected variant of the algorithm, possible values: {‘Variants.VERSION_STATE_EQUATION_A_STAR, Variants.VERSION_DIJKSTRA_NO_HEURISTICS ‘}

  • parameters

    dict parameters of the algorithm, for key ‘state_equation_a_star’:

    Parameters.ACTIVITY_KEY -> Attribute in the log that contains the activity Parameters.PARAM_MODEL_COST_FUNCTION -> mapping of each transition in the model to corresponding synchronous costs Parameters.PARAM_SYNC_COST_FUNCTION -> mapping of each transition in the model to corresponding model cost Parameters.PARAM_TRACE_COST_FUNCTION -> mapping of each index of the trace to a positive cost value

Returns:

dict with keys alignment, cost, visited_states, queued_states and traversed_arcs The alignment is a sequence of labels of the form (a,t), (a,>>), or (>>,t) representing synchronous/log/model-moves.

Return type:

alignment

pm4py.algo.conformance.alignments.petri_net.algorithm.apply_log(log, petri_net, initial_marking, final_marking, parameters=None, variant=Variants.VERSION_STATE_EQUATION_A_STAR)[source]#

Apply alignments to a log.

Parameters:
  • log – object of the form pm4py.log.log.EventLog event log

  • petri_netpm4py.objects.petri.petrinet.PetriNet the model to use for the alignment

  • initial_markingpm4py.objects.petri.petrinet.Marking initial marking of the net

  • final_markingpm4py.objects.petri.petrinet.Marking final marking of the net

  • variant – selected variant of the algorithm, possible values: {‘Variants.VERSION_STATE_EQUATION_A_STAR, Variants.VERSION_DIJKSTRA_NO_HEURISTICS ‘}

  • parametersdict parameters of the algorithm,

Returns:

list of dict with keys alignment, cost, visited_states, queued_states and traversed_arcs The alignment is a sequence of labels of the form (a,t), (a,>>), or (>>,t) representing synchronous/log/model-moves.

Return type:

alignment

pm4py.algo.conformance.alignments.petri_net.algorithm.apply_multiprocessing(log, petri_net, initial_marking, final_marking, parameters=None, variant=Variants.VERSION_STATE_EQUATION_A_STAR)[source]#

Applies the alignments using a process pool (multiprocessing)

Parameters:
  • log – Event log

  • petri_net – Petri net

  • initial_marking – Initial marking

  • final_marking – Final marking

  • parameters – Parameters of the algorithm

Returns:

Alignments

Return type:

aligned_traces

pm4py.algo.conformance.alignments.petri_net.algorithm.get_diagnostics_dataframe(log, align_output, parameters=None)[source]#

Gets the diagnostics results of alignments (of a log) in a dataframe

Parameters:
  • log – Event log

  • align_output – Output of the alignments

Returns:

Diagnostics dataframe

Return type:

dataframe