Skip to content

Commit ea9126c

Browse files
Merge branch 'release' of https://github.com/pm4py/pm4py-core into release
2 parents 18c7f06 + e211902 commit ea9126c

14 files changed

Lines changed: 147 additions & 454 deletions

File tree

pm4py/algo/discovery/genetic/__init__.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
'''
2-
PM4Py – A Process Mining Library for Python
3-
Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)
4-
5-
This program is free software: you can redistribute it and/or modify
6-
it under the terms of the GNU Affero General Public License as
7-
published by the Free Software Foundation, either version 3 of the
8-
License, or any later version.
9-
10-
This program is distributed in the hope that it will be useful,
11-
but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
GNU Affero General Public License for more details.
14-
15-
You should have received a copy of the GNU Affero General Public License
16-
along with this program. If not, see this software project's root or
17-
visit <https://www.gnu.org/licenses/>.
18-
19-
Website: https://processintelligence.solutions
20-
Contact: info@processintelligence.solutions
21-
'''
221
'''
232
PM4Py – A Process Mining Library for Python
243
Copyright (C) 2026 Process Intelligence Solutions UG (haftungsbeschränkt)

pm4py/algo/discovery/genetic/algorithm.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
'''
2-
PM4Py – A Process Mining Library for Python
3-
Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)
4-
5-
This program is free software: you can redistribute it and/or modify
6-
it under the terms of the GNU Affero General Public License as
7-
published by the Free Software Foundation, either version 3 of the
8-
License, or any later version.
9-
10-
This program is distributed in the hope that it will be useful,
11-
but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
GNU Affero General Public License for more details.
14-
15-
You should have received a copy of the GNU Affero General Public License
16-
along with this program. If not, see this software project's root or
17-
visit <https://www.gnu.org/licenses/>.
18-
19-
Website: https://processintelligence.solutions
20-
Contact: info@processintelligence.solutions
21-
'''
221
'''
232
PM4Py – A Process Mining Library for Python
243
Copyright (C) 2026 Process Intelligence Solutions UG (haftungsbeschränkt)
@@ -42,11 +21,12 @@
4221
'''
4322
from enum import Enum
4423
from pm4py.util import exec_utils
45-
from typing import Union, Optional, Dict, Any, Tuple
24+
from pm4py.algo.discovery.genetic.variants import classic
4625
from pm4py.objects.petri_net.obj import PetriNet, Marking
4726
from pm4py.objects.log.obj import EventLog, EventStream
4827
import pandas as pd
4928
from pm4py.util import constants
29+
from typing import Union, Optional, Dict, Any, Tuple
5030

5131

5232
class Parameters(Enum):
@@ -59,13 +39,8 @@ class Parameters(Enum):
5939
MUTATION_RATE = "mutation_rate"
6040
GENERATIONS = "generations"
6141
ELITISM_MIN_SAMPLE = "elitism_min_sample"
62-
TOURNAMENT_TIMEOUT = "tournament_timeout"
6342
LOG_CSV = "log_csv"
6443

65-
66-
from pm4py.algo.discovery.genetic.variants import classic
67-
68-
6944
class Variants(Enum):
7045
CLASSIC = classic
7146

pm4py/algo/discovery/genetic/util.py

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
2-
PM4Py – A Process Mining Library for Python
3-
Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)
2+
PM4Py A Process Mining Library for Python
3+
Copyright (C) 2026 Process Intelligence Solutions UG (haftungsbeschränkt)
44
55
This program is free software: you can redistribute it and/or modify
66
it under the terms of the GNU Affero General Public License as
@@ -25,22 +25,22 @@
2525
import itertools
2626

2727
# typing
28+
from typing import Self, Union
2829
from collections.abc import Iterable
29-
from typing import Dict, FrozenSet, List, Tuple
30-
InputMap = Dict[str, List[FrozenSet]]
31-
OutputMap = Dict[str, List[FrozenSet]]
32-
Individual = Tuple[InputMap, OutputMap]
30+
TransitionMap = dict[str,list[frozenset]]
31+
InputMap = OutputMap = TransitionMap
32+
Individual = tuple[InputMap,OutputMap]
3333

3434
class iset(frozenset):
3535
"Indexable frozenset printing as set, i.e. without `frozenset(…)`"
3636
def __repr__(self):
3737
return "{" + repr(sorted(self))[1:-1] + "}"
3838

3939
@staticmethod
40-
def flat(item: Iterable) -> "iset":
40+
def flat(item: Iterable) -> Self:
4141
return iset(itertools.chain(*item))
4242

43-
def rand_partition(pool: Iterable) -> List[iset]:
43+
def rand_partition(pool: Iterable) -> list[Union[set,frozenset]]:
4444
pool = set(pool)
4545
# also ensures no activity in two partitions
4646
# s. 4. Causal Matrix, Def. 4; https://doi.org/10.1007/11494744_5
@@ -54,7 +54,23 @@ def rand_partition(pool: Iterable) -> List[iset]:
5454
pool -= draw
5555
return partition
5656

57-
def get_src_sink_sets_for_wfnet(I: InputMap, O: OutputMap, T: List[str]) -> Tuple[List[str], List[str]]:
57+
def add_singleton_partition(tmap: TransitionMap, key: str, t: str):
58+
partitions = tmap.setdefault(key, []) # tmap[key] or []
59+
if not any(t in partition for partition in partitions):
60+
partitions.append(iset({t}))
61+
62+
def remove_transition_from_partitions(tmap: TransitionMap, key: str, t: str):
63+
partitions = tmap.setdefault(key, []) # tmap[key] or []
64+
for i,partition in enumerate(partitions):
65+
if t in partition:
66+
updated = iset(partition - {t})
67+
if updated:
68+
partitions[i] = updated
69+
else:
70+
del partitions[i]
71+
return
72+
73+
def get_src_sink_sets_for_wfnet(I: InputMap, O: OutputMap, T: list[str]) -> tuple[list[str],list[str]]:
5874
"""Determines input set and output set, which need to be connected by a place to create a WF-net"""
5975
def add2graphs(graphs, t, nextT):
6076
# find graph
@@ -70,8 +86,8 @@ def add2graphs(graphs, t, nextT):
7086
else:
7187
successors.extend(S)
7288
graph += successors
73-
# merge if end = start
74-
for tn in successors:
89+
# merge if path end = start
90+
for tn in successors: # tn = end
7591
for g2 in graphs[:]: # [:] = copy
7692
if g2[0] == tn and g2 != graph:
7793
graph += g2
@@ -82,6 +98,6 @@ def add2graphs(graphs, t, nextT):
8298
for t in T:
8399
graphsI = add2graphs(graphsI, t, I)
84100
graphsO = add2graphs(graphsO, t, O)
85-
first = [g[0] for g in graphsO] # ⋃first = reachable via O[∀t]
86-
last = [g[0] for g in graphsI] # ⋃first = reachable via I[∀t]
87-
return first, last
101+
sources = [g[0] for g in graphsO] # ⋃sources = ∀t reachable from O[∀sources]
102+
sinks = [g[0] for g in graphsI] # ⋃sinks = ∀t reachable from I[∀sinks]
103+
return sources, sinks

pm4py/algo/discovery/genetic/variants/__init__.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
'''
2-
PM4Py – A Process Mining Library for Python
3-
Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)
4-
5-
This program is free software: you can redistribute it and/or modify
6-
it under the terms of the GNU Affero General Public License as
7-
published by the Free Software Foundation, either version 3 of the
8-
License, or any later version.
9-
10-
This program is distributed in the hope that it will be useful,
11-
but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
GNU Affero General Public License for more details.
14-
15-
You should have received a copy of the GNU Affero General Public License
16-
along with this program. If not, see this software project's root or
17-
visit <https://www.gnu.org/licenses/>.
18-
19-
Website: https://processintelligence.solutions
20-
Contact: info@processintelligence.solutions
21-
'''
221
'''
232
PM4Py – A Process Mining Library for Python
243
Copyright (C) 2026 Process Intelligence Solutions UG (haftungsbeschränkt)

0 commit comments

Comments
 (0)