stats: speed up the computation of transitions

Juraj Major reported a case with 32 APs where ltlcross would take
forever to gather statistics.  It turns out that for each edge,
twa_sub_statistics was enumerating all compatible assignments of 32
APs.  This uses bdd_satcountset() instead, and also store the result
in a long long to avoid overflows.

* spot/twaalgos/stats.cc (twa_sub_statistics): Improve the code for
counting transitions.
* bin/common_aoutput.hh, bin/ltlcross.cc, spot/twaalgos/stats.hh:
Store transition counts are long long.
* tests/core/readsave.test: Add test case.
* NEWS: Mention the bug.
This commit is contained in:
Alexandre Duret-Lutz 2020-05-18 16:52:31 +02:00
parent da96a509e9
commit 208d0f7885
6 changed files with 45 additions and 21 deletions

View file

@ -1119,3 +1119,28 @@ f="{{!a;!b}:{{c <-> d} && {e xor f} && {m | {l && {k | {j <-> {i xor {g && h}"
f="$f}}}}} && {{n && o} | {!n && p}} && {q -> {r <-> s}}}:{[*0..1];t}}[]-> u"
ltl2tgba -f "$f" --dot=bar > out.dot
grep 'label too long' out.dot
# genltl --and-fg=32 | ltlfilt --relabel=abc | ltldo ltl3ba produces a
# few edges equivalent to a lot of transitions. The code used to
# count those transitions used to be very inefficient.
cat >andfg32.hoa <<EOF
HOA: v1
States: 2
Start: 0
AP: 32 "a" "ab" "b" "bb" "c" "cb" "d" "db" "e" "eb" "f" "fb" "g" "h"
"i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[t] 0
[0&1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17
&18&19&20&21&22&23&24&25&26&27&28&29&30&31] 1
State: 1 {0}
[0&1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17
&18&19&20&21&22&23&24&25&26&27&28&29&30&31] 1
--END--
EOF
test `autfilt andfg32.hoa --stats=%t` = 4294967298 # 2^32 + 2