Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion from Petri net to process tree - Assertion Error #516

Open
OleSeifert opened this issue Jan 24, 2025 · 0 comments
Open

Conversion from Petri net to process tree - Assertion Error #516

OleSeifert opened this issue Jan 24, 2025 · 0 comments

Comments

@OleSeifert
Copy link

I am trying to run conformance checking using alignments on models mined by the inductive miner. To speed up the process, I am converting the Petri net to a process tree first. When trying to run this conversion, I get an assertion error.

Version: pm4py 2.7.13.1
OS: Ubuntu
Python: 3.12.2

Code to reproduce:

if __name__ == "__main__":
    event_log = read_xes(EVENT_LOG_PATH)

    pnml_path = os.path.join(PETRI_NET_FOLDER_PATH, pnml_file)

    petri_net, inital_marking, final_marking = pnml_importer.apply(pnml_path)

    tree = pm4py.convert_to_process_tree(petri_net, inital_marking, final_marking)

Where EVENT_LOG_PATH and PETRI_NET_FOLDER_PATH are constants pointing to the corresponding file paths.

The Error:

Traceback (most recent call last):
  File "/home/ole/conformance_checking/conformance_inductive_trees.py", line 144, in <module>
    main()
  File "/home/ole/conformance_checking/conformance_inductive_trees.py", line 107, in main
    tree = pm4py.convert_to_process_tree(petri_net, inital_marking, final_marking)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/convert.py", line 265, in convert_to_process_tree
    tree = to_process_tree.apply(net, im, fm)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/conversion/wf_net/variants/to_process_tree.py", line 367, in apply
    pt = parse(pt_str)
         ^^^^^^^^^^^^^
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 234, in parse
    return parse_recursive(string_rep, depth_cache, depth)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 286, in parse_recursive
    parse_recursive(string_rep[1:], depth_cache, depth)
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 286, in parse_recursive
    parse_recursive(string_rep[1:], depth_cache, depth)
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 286, in parse_recursive
    parse_recursive(string_rep[1:], depth_cache, depth)
  [Previous line repeated 3 more times]
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 311, in parse_recursive
    parse_recursive((string_rep.strip())[1:], depth_cache, depth)
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 286, in parse_recursive
    parse_recursive(string_rep[1:], depth_cache, depth)
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 286, in parse_recursive
    parse_recursive(string_rep[1:], depth_cache, depth)
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 286, in parse_recursive
    parse_recursive(string_rep[1:], depth_cache, depth)
  [Previous line repeated 1 more time]
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 311, in parse_recursive
    parse_recursive((string_rep.strip())[1:], depth_cache, depth)
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 286, in parse_recursive
    parse_recursive(string_rep[1:], depth_cache, depth)
...
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 286, in parse_recursive
    parse_recursive(string_rep[1:], depth_cache, depth)
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 286, in parse_recursive
    parse_recursive(string_rep[1:], depth_cache, depth)
  [Previous line repeated 2 more times]
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 311, in parse_recursive
    parse_recursive((string_rep.strip())[1:], depth_cache, depth)
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 311, in parse_recursive
    parse_recursive((string_rep.strip())[1:], depth_cache, depth)
  File "/home/ole/anaconda3/envs/conf/lib/python3.12/site-packages/pm4py/objects/process_tree/utils/generic.py", line 295, in parse_recursive
    assert (string_rep.startswith('tau') or string_rep.startswith('τ') or string_rep.startswith(u'\u03c4'))
AssertionError

This pattern repeats multiple times...

The .pnml file used can be found under Petri net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant