zlktree: use a cache in the construction of zielonka_tree

This largely speeds up the computation for conditions
like "Rabin n" sharing a lot of subtrees.

Also implement options to stop the construction if the shape is wrong.

* spot/twaalgos/zlktree.cc, spot/twaalgos/zlktree.hh: Implement the
cache and the options.
* tests/python/zlktree.ipynb, tests/python/zlktree.py: New tests.
This commit is contained in:
Alexandre Duret-Lutz 2022-05-20 16:51:16 +02:00
parent f784e40548
commit b11208440b
5 changed files with 517 additions and 151 deletions

View file

@ -152,3 +152,12 @@ tc.assertTrue(a.equivalent_to(b))
b = spot.acd_transform_sbacc(a, False)
tc.assertEqual(str(b.acc()), '(2, Fin(0) & Inf(1))')
tc.assertTrue(a.equivalent_to(b))
# This used to be very slow.
c = spot.acc_cond("Rabin 9")
n = spot.zielonka_tree(c).num_branches()
tc.assertEqual(n, 362880)
opt = spot.zielonka_tree_options_MERGE_SUBTREES;
n = spot.zielonka_tree(c, opt).num_branches()
tc.assertEqual(n, 9)