Skip to content

Commit

Permalink
revised examples. increased version number
Browse files Browse the repository at this point in the history
  • Loading branch information
fit-alessandro-berti committed Jun 20, 2020
1 parent 2af4791 commit 8e6a4a7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
11 changes: 6 additions & 5 deletions examples/alignments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from micropm4py.log import xes_import_traces_file
from micropm4py.log import xes_import_traces_file_minimal_dfg
from micropm4py.log import xes_import_traces_file_minimal_it
from micropm4py.discovery import alpha
from micropm4py.petrinet import alignments
import time
Expand All @@ -7,19 +8,19 @@

def main():
log_file = os.path.join("..", "micro_tests", "reviewing.xes")
dfg = xes_import_traces_file.imp_dfg_file(log_file)
dfg = xes_import_traces_file_minimal_dfg.imp_dfg_file(log_file)
net, im, fm = alpha.alpha(dfg)
del dfg
it = xes_import_traces_file.get_it_from_file(log_file)
nxt = xes_import_traces_file.get_nxt_trace(it)
it = xes_import_traces_file_minimal_it.get_it_from_file(log_file)
nxt = xes_import_traces_file_minimal_it.get_nxt_trace(it)
aa = time.ticks_ms()
while nxt:
try:
align = alignments.apply(nxt, net, im, fm, ret_tuple_as_trans_desc=False, enable_gc=True)
print(align)
except:
print("MemoryError")
nxt = xes_import_traces_file.get_nxt_trace(it)
nxt = xes_import_traces_file_minimal_it.get_nxt_trace(it)
bb = time.ticks_ms()
print(bb - aa)

Expand Down
12 changes: 8 additions & 4 deletions examples/simpler/alignments.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import gc
from micropm4py.petrinet import petrinet_import_file

model_path = "running-example.pnml"
net, im, fm = petrinet_import_file.imp_file(model_path)
del model_path
gc.collect()

from micropm4py.log import xes_import_traces_file_minimal_it
from micropm4py.petrinet import alignments

log_path = "running-example.xes"

net = ((0, 0, 0, 0, 0, 0, 0), (('decide', (5, 2), (4,)), ('examine casually', (6,), (2,)), ('examine thoroughly', (6,), (2,)), ('register request', (0,), (1, 6)), ('check ticket', (1,), (5,)), ('reinitiate request', (4,), (6, 1)), ('pay compensation', (4,), (3,)), ('reject request', (4,), (3,))))
im = {0: 1}
fm = {3: 1}

# creates an iterator from the log: a single trace is fetched per time
it = xes_import_traces_file_minimal_it.get_it_from_file(log_path)
# let's pick the first trace
Expand Down
12 changes: 8 additions & 4 deletions examples/simpler/token_replay.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import gc
from micropm4py.petrinet import petrinet_import_file

model_path = "running-example.pnml"
net, im, fm = petrinet_import_file.imp_file(model_path)
del model_path
gc.collect()

from micropm4py.log import xes_import_traces_file_minimal_it
from micropm4py.petrinet import petrinet_exec
from micropm4py.util import copy

log_path = "running-example.xes"

net = ((0, 0, 0, 0, 0, 0, 0), (('decide', (5, 2), (4,)), ('examine casually', (6,), (2,)), ('examine thoroughly', (6,), (2,)), ('register request', (0,), (1, 6)), ('check ticket', (1,), (5,)), ('reinitiate request', (4,), (6, 1)), ('pay compensation', (4,), (3,)), ('reject request', (4,), (3,))))
im = {0: 1}
fm = {3: 1}

# creates an iterator from the log: a single trace is fetched per time
it = xes_import_traces_file_minimal_it.get_it_from_file(log_path)
# let's pick the first trace
Expand Down
2 changes: 1 addition & 1 deletion micropm4py/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.1.8'
__version__ = '0.2.0'
__doc__ = "MicroPM4Py - Process Mining for Micro-Controllers"
__author__ = 'Alessandro Berti'
__author_email__ = '[email protected]'
Expand Down

0 comments on commit 8e6a4a7

Please sign in to comment.