Skip to content

Commit

Permalink
Merge branch 'PMPY-1707' into 'integration'
Browse files Browse the repository at this point in the history
PMPY-1707 ZeroDivisionError when calculating alignments for an empty trace with a model that allows a complete firing sequence with only tau model moves

Closes PMPY-1707

See merge request process-mining/pm4py/pm4py-core!662
  • Loading branch information
fit-sebastiaan-van-zelst committed May 12, 2022
2 parents 03817c5 + f99ec31 commit 8470f22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pm4py/algo/conformance/alignments/petri_net/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ def apply_trace(trace, petri_net, initial_marking, final_marking, parameters=Non

ltrace_bwc = trace_cost_function_sum + best_worst_cost

fitness = 1 - (ali['cost'] // align_utils.STD_MODEL_LOG_MOVE_COST) / (
ltrace_bwc // align_utils.STD_MODEL_LOG_MOVE_COST) if ltrace_bwc > 0 else 0
fitness_num = ali['cost'] // align_utils.STD_MODEL_LOG_MOVE_COST
fitness_den = ltrace_bwc // align_utils.STD_MODEL_LOG_MOVE_COST
fitness = 1 - fitness_num / fitness_den if fitness_den > 0 else 0

# other possibility: avoid integer division but proceed to rounding.
# could lead to small differences with respect to the adopted-since-now fitness
Expand Down

0 comments on commit 8470f22

Please sign in to comment.