Introduce new ways to split an automaton

The explicit way of splitting suffers if there are
too many input APs, two new ways of splitting
are introduced as well as a heuristic to chose
between them.

* NEWS: update
* spot/twaalgos/synthesis.cc,
spot/twaalgos/synthesis.hh: New fonctions
* bin/ltlsynt.cc: Add corresponding option
* tests/core/gamehoa.test,
tests/core/ltlsynt.test,
tests/python/_partitioned_relabel.ipynb,
tests/python/_synthesis.ipynb,
tests/python/game.py,
tests/python/split.py,
tests/python/synthesis.py: Adjusting and adding test
This commit is contained in:
Philipp Schlehuber 2024-03-03 22:15:27 +01:00
parent 2274308cad
commit 5ddac258e1
11 changed files with 1372 additions and 138 deletions

View file

@ -135,3 +135,169 @@ aut, s = do_split('((G (((! g_0) || (! g_1)) && ((r_0 && (X r_1)) -> (F (g_0 \
&& g_1))))) && (G (r_0 -> F g_0))) && (G (r_1 -> F g_1))',
['g_0', 'g_1'])
tc.assertTrue(equiv(aut, spot.unsplit_2step(s)))
# check equivalence of split automata
# for the different methods for certain cases
autstr = """HOA: v1
name: "r2b_ack0 | F((!b2r_req0 & Xr2b_ack0) | (b2r_req0 & XG!r2b_ack0)) \
| (!b2r_req0 & G(!r2b_ack0 | ((!b2r_req0 | !b2r_req1) & X!b2r_req0 \
& (!(s2b_req0 | s2b_req1) | XF(b2r_req0 | b2r_req1)) & (!b2r_req0 \
| X(b2r_req0 | (b2r_req1 M !b2r_req0))) & (!b2r_req0 | r2b_ack0 \
| Xb2r_req0))))"
States: 12
Start: 7
AP: 5 "r2b_ack0" "b2r_req0" "b2r_req1" "s2b_req0" "s2b_req1"
controllable-AP: 2 1
acc-name: parity max even 4
Acceptance: 4 Fin(3) & (Inf(2) | (Fin(1) & Inf(0)))
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic
--BODY--
State: 0
[!0&!1] 0 {2}
[0] 1 {1}
[!0&1] 3 {2}
State: 1
[t] 1 {2}
State: 2
[!0&1] 2 {2}
[0&1] 2 {3}
[!0&!1] 4 {2}
[0&!1] 5 {3}
State: 3
[!0&!1] 0 {2}
[0&1&2] 2 {1}
[!0&1] 3 {2}
[0&!1&3 | 0&!1&4] 6 {2}
[0&!1&!3&!4] 7 {2}
[0&1&!2] 8 {2}
State: 4
[0] 1 {1}
[!0&1] 2 {2}
[!0&!1] 4 {2}
State: 5
[0] 1 {1}
[!0&1] 2 {1}
[!0&!1] 5 {1}
State: 6
[!0&!1&2] 0 {2}
[0] 1 {1}
[!0&1] 2 {1}
[!0&!1&!2] 9 {1}
State: 7
[!0&!1] 0 {2}
[0] 1 {1}
[!0&1] 2 {1}
State: 8
[!0&!1&2] 0 {2}
[1] 2 {1}
[0&!1&2&3 | 0&!1&2&4] 6 {2}
[0&!1&2&!3&!4] 7 {2}
[!0&!1&!2] 10 {1}
[0&!1&!2] 11 {1}
State: 9
[!0&!1&2] 0 {2}
[0] 1 {1}
[!0&1] 3 {2}
[!0&!1&!2] 9 {1}
State: 10
[!0&!1&2] 0 {2}
[0] 1 {1}
[!0&1] 2 {1}
[!0&!1&!2] 10 {2}
State: 11
[!0&!1&2] 0 {2}
[0] 1 {1}
[!0&1] 2 {1}
[!0&!1&!2] 11 {1}
--END--
HOA: v1
States: 2
Start: 0
AP: 15 "u0room29light0f1dturn2off1b" "u0room29light0f1dturn2on1b" \
"p0b0room29window29opened" "u0room29light0f1dtoggle1b" \
"p0b0room29window29closed" "p0p0all2windows2closed0room" \
"u0system29start2new2timer0f1dmin25231b" \
"u0system29start2new2timer0f1dhour241b" \
"u0room29warnlight29control0room29warnlight29control" \
"u0system29start2new2timer0system29start2new2timer" \
"u0room29warnlight29control0f1dturn2on1b" \
"u0room29warnlight29control0f1dturn2off1b" "u0room29light0room29light" \
"u0system29start2new2timer0f1dhour251b" "p0b0timeout"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
controllable-AP: 0 1 3 6 7 8 9 10 11 12 13
--BODY--
State: 0
[!0&!1&!3&!6&!7&!8&!9&!10&11&12&13 | !0&!1&!3&!6&!7&!8&!9&10&!11&12&13 \
| !0&!1&!3&!6&!7&!8&9&!10&11&12&!13 | !0&!1&!3&!6&!7&!8&9&10&!11&12&!13 \
| !0&!1&!3&!6&!7&8&!9&!10&!11&12&13 | !0&!1&!3&!6&!7&8&9&!10&!11&12&!13 \
| !0&!1&!3&!6&7&!8&!9&!10&11&12&!13 | !0&!1&!3&!6&7&!8&!9&10&!11&12&!13 \
| !0&!1&!3&!6&7&8&!9&!10&!11&12&!13 | !0&!1&!3&6&!7&!8&!9&!10&11&12&!13 \
| !0&!1&!3&6&!7&!8&!9&10&!11&12&!13 | !0&!1&!3&6&!7&8&!9&!10&!11&12&!13 \
| !0&!1&3&!6&!7&!8&!9&!10&11&!12&13 | !0&!1&3&!6&!7&!8&!9&10&!11&!12&13 \
| !0&!1&3&!6&!7&!8&9&!10&11&!12&!13 | !0&!1&3&!6&!7&!8&9&10&!11&!12&!13 \
| !0&!1&3&!6&!7&8&!9&!10&!11&!12&13 | !0&!1&3&!6&!7&8&9&!10&!11&!12&!13 \
| !0&!1&3&!6&7&!8&!9&!10&11&!12&!13 | !0&!1&3&!6&7&!8&!9&10&!11&!12&!13 \
| !0&!1&3&!6&7&8&!9&!10&!11&!12&!13 | !0&!1&3&6&!7&!8&!9&!10&11&!12&!13 \
| !0&!1&3&6&!7&!8&!9&10&!11&!12&!13 | !0&!1&3&6&!7&8&!9&!10&!11&!12&!13 \
| !0&1&!3&!6&!7&!8&!9&!10&11&!12&13 | !0&1&!3&!6&!7&!8&!9&10&!11&!12&13 \
| !0&1&!3&!6&!7&!8&9&!10&11&!12&!13 | !0&1&!3&!6&!7&!8&9&10&!11&!12&!13 \
| !0&1&!3&!6&!7&8&!9&!10&!11&!12&13 | !0&1&!3&!6&!7&8&9&!10&!11&!12&!13 \
| !0&1&!3&!6&7&!8&!9&!10&11&!12&!13 | !0&1&!3&!6&7&!8&!9&10&!11&!12&!13 \
| !0&1&!3&!6&7&8&!9&!10&!11&!12&!13 | !0&1&!3&6&!7&!8&!9&!10&11&!12&!13 \
| !0&1&!3&6&!7&!8&!9&10&!11&!12&!13 | !0&1&!3&6&!7&8&!9&!10&!11&!12&!13 \
| 0&!1&!3&!6&!7&!8&!9&!10&11&!12&13 | 0&!1&!3&!6&!7&!8&!9&10&!11&!12&13 \
| 0&!1&!3&!6&!7&!8&9&!10&11&!12&!13 | 0&!1&!3&!6&!7&!8&9&10&!11&!12&!13 \
| 0&!1&!3&!6&!7&8&!9&!10&!11&!12&13 | 0&!1&!3&!6&!7&8&9&!10&!11&!12&!13 \
| 0&!1&!3&!6&7&!8&!9&!10&11&!12&!13 | 0&!1&!3&!6&7&!8&!9&10&!11&!12&!13 \
| 0&!1&!3&!6&7&8&!9&!10&!11&!12&!13 | 0&!1&!3&6&!7&!8&!9&!10&11&!12&!13 \
| 0&!1&!3&6&!7&!8&!9&10&!11&!12&!13 | 0&!1&!3&6&!7&8&!9&!10&!11&!12&!13] 1
State: 1
[!0&!1&!3&!6&!7&!8&!9&!10&11&12&13 | !0&!1&!3&!6&!7&!8&!9&10&!11&12&13 \
| !0&!1&!3&!6&!7&!8&9&!10&11&12&!13 | !0&!1&!3&!6&!7&!8&9&10&!11&12&!13 \
| !0&!1&!3&!6&!7&8&!9&!10&!11&12&13 | !0&!1&!3&!6&!7&8&9&!10&!11&12&!13 \
| !0&!1&!3&!6&7&!8&!9&!10&11&12&!13 | !0&!1&!3&!6&7&!8&!9&10&!11&12&!13 \
| !0&!1&!3&!6&7&8&!9&!10&!11&12&!13 | !0&!1&!3&6&!7&!8&!9&!10&11&12&!13 \
| !0&!1&!3&6&!7&!8&!9&10&!11&12&!13 | !0&!1&!3&6&!7&8&!9&!10&!11&12&!13 \
| !0&!1&3&!6&!7&!8&!9&!10&11&!12&13 | !0&!1&3&!6&!7&!8&!9&10&!11&!12&13 \
| !0&!1&3&!6&!7&!8&9&!10&11&!12&!13 | !0&!1&3&!6&!7&!8&9&10&!11&!12&!13 \
| !0&!1&3&!6&!7&8&!9&!10&!11&!12&13 | !0&!1&3&!6&!7&8&9&!10&!11&!12&!13 \
| !0&!1&3&!6&7&!8&!9&!10&11&!12&!13 | !0&!1&3&!6&7&!8&!9&10&!11&!12&!13 \
| !0&!1&3&!6&7&8&!9&!10&!11&!12&!13 | !0&!1&3&6&!7&!8&!9&!10&11&!12&!13 \
| !0&!1&3&6&!7&!8&!9&10&!11&!12&!13 | !0&!1&3&6&!7&8&!9&!10&!11&!12&!13 \
| !0&1&!3&!6&!7&!8&!9&!10&11&!12&13 | !0&1&!3&!6&!7&!8&!9&10&!11&!12&13 \
| !0&1&!3&!6&!7&!8&9&!10&11&!12&!13 | !0&1&!3&!6&!7&!8&9&10&!11&!12&!13 \
| !0&1&!3&!6&!7&8&!9&!10&!11&!12&13 | !0&1&!3&!6&!7&8&9&!10&!11&!12&!13 \
| !0&1&!3&!6&7&!8&!9&!10&11&!12&!13 | !0&1&!3&!6&7&!8&!9&10&!11&!12&!13 \
| !0&1&!3&!6&7&8&!9&!10&!11&!12&!13 | !0&1&!3&6&!7&!8&!9&!10&11&!12&!13 \
| !0&1&!3&6&!7&!8&!9&10&!11&!12&!13 | !0&1&!3&6&!7&8&!9&!10&!11&!12&!13 \
| 0&!1&!3&!6&!7&!8&!9&!10&11&!12&13 | 0&!1&!3&!6&!7&!8&!9&10&!11&!12&13 \
| 0&!1&!3&!6&!7&!8&9&!10&11&!12&!13 | 0&!1&!3&!6&!7&!8&9&10&!11&!12&!13 \
| 0&!1&!3&!6&!7&8&!9&!10&!11&!12&13 | 0&!1&!3&!6&!7&8&9&!10&!11&!12&!13 \
| 0&!1&!3&!6&7&!8&!9&!10&11&!12&!13 | 0&!1&!3&!6&7&!8&!9&10&!11&!12&!13 \
| 0&!1&!3&!6&7&8&!9&!10&!11&!12&!13 | 0&!1&!3&6&!7&!8&!9&!10&11&!12&!13 \
| 0&!1&!3&6&!7&!8&!9&10&!11&!12&!13 | 0&!1&!3&6&!7&8&!9&!10&!11&!12&!13] 1
--END--
"""
for autus in spot.automata(autstr):
si = spot.synthesis_info()
all_split = []
for sp in [spot.synthesis_info.splittype_EXPL,
spot.synthesis_info.splittype_SEMISYM,
spot.synthesis_info.splittype_FULLYSYM,
spot.synthesis_info.splittype_AUTO
]:
all_split.append(spot.split_2step(autus, si))
for i in range(len(all_split)):
for j in range(i+1, len(all_split)):
tc.assertTrue(spot.are_equivalent(all_split[i], all_split[j]))
del autus
del si
del all_split
gcollect()