twaalgos: Implement dt*a_sat_minimize_incr(...) functions

* python/spot/__init__.py: Add 'incr' boolean argument.
* spot/twaalgos/dtbasat.cc: Implement dtba_sat_minimize_incr(...).
* spot/twaalgos/dtbasat.hh: Declare it.
* spot/twaalgos/dtwasat.cc: Implement dtwa_sat_minimize_incr(...) and
deal with options.
* spot/twaalgos/dtwasat.hh: Declare it.
* spot/twaalgos/postproc.cc: Add option --sat-minimize=incr.
* spot/twaalgos/postproc.hh: Add incr parameter.
* tests/core/satmin.test: Add tests for incremental version.
Update expected result.
* tests/core/satmin2.test: Add tests for incremental version.
* tests/python/satmin.py: Add tests for incremental version.
This commit is contained in:
Alexandre GBAGUIDI AISSE 2016-09-20 11:58:24 +02:00
parent 9acd7370b2
commit ee17c2dee4
10 changed files with 1051 additions and 26 deletions

File diff suppressed because it is too large Load diff

View file

@ -46,22 +46,36 @@ State: 2
[!0] 2
--END--
EOF
cat >expected <<EOF
transitions: 2
edges: 2
states: 1
nondeterministic states: 0
EOF
../ikwiad -RS1 -kt -XH input.hoa > output
diff output expected
# At some point, this formula was correctly minimized, but
# the output was not marked as state-based.
ltl2tgba -BD -x sat-minimize "GF(a <-> XXb)" -H >out
grep 'properties:.*state-acc' out
grep 'properties:.*deterministic' out
ltl2tgba -BD -x 'sat-minimize=3,incr=-1' "GF(a <-> XXb)" -H >out
grep 'properties:.*state-acc' out
grep 'properties:.*deterministic' out
ltl2tgba -BD -x 'sat-minimize=3,incr=0' "GF(a <-> XXb)" -H >out
grep 'properties:.*state-acc' out
grep 'properties:.*deterministic' out
ltl2tgba -BD -x 'sat-minimize=3,incr=1' "GF(a <-> XXb)" -H >out
grep 'properties:.*state-acc' out
grep 'properties:.*deterministic' out
ltl2tgba -BD -x 'sat-minimize=3,incr=2' "GF(a <-> XXb)" -H >out
grep 'properties:.*state-acc' out
grep 'properties:.*deterministic' out
ltl2tgba -BD -x 'sat-minimize=3,incr=50' "GF(a <-> XXb)" -H >out
grep 'properties:.*state-acc' out
grep 'properties:.*deterministic' out
# DRA produced by ltl2dstar for GFp0 -> GFp1
@ -96,18 +110,48 @@ State: 3 {1 3}
2
--END--
EOF
# Let's try to find a smaller transition-based Streett automaton We
# easily really check the expected automaton, because different SAT
# solver (even different versions of glucose) can return different
# automata.
$autfilt --sat-minimize='acc="Fin(0)|Inf(1)"' test.hoa --stats=%s >output
test `cat output` = 1
$autfilt --sat-minimize='acc="Fin(0)|Inf(1)",incr=-1' test.hoa \
--stats=%s >output
test `cat output` = 1
$autfilt --sat-minimize='acc="Fin(0)|Inf(1)",incr=0' test.hoa \
--stats=%s >output
test `cat output` = 1
$autfilt --sat-minimize='acc="Fin(0)|Inf(1)",incr=1' test.hoa \
--stats=%s >output
test `cat output` = 1
$autfilt --sat-minimize='acc="Fin(0)|Inf(1)",incr=2' test.hoa \
--stats=%s >output
test `cat output` = 1
$autfilt --sat-minimize='acc="Fin(0)|Inf(1)",incr=50' test.hoa \
--stats=%s >output
test `cat output` = 1
# How about a state-based DSA?
$autfilt -S --sat-minimize='acc="Fin(0)|Inf(1)"' test.hoa \
--stats=%s > output
test `cat output` = 3
$autfilt -S --sat-minimize='acc="Fin(0)|Inf(1)",incr=-1' test.hoa \
--stats=%s > output
test `cat output` = 3
$autfilt -S --sat-minimize='acc="Fin(0)|Inf(1)",incr=0' test.hoa \
--stats=%s > output
test `cat output` = 3
$autfilt -S --sat-minimize='acc="Fin(0)|Inf(1)",incr=1' test.hoa \
--stats=%s > output
test `cat output` = 3
$autfilt -S --sat-minimize='acc="Fin(0)|Inf(1)",incr=2' test.hoa \
--stats=%s > output
test `cat output` = 3
$autfilt -S --sat-minimize='acc="Fin(0)|Inf(1)",incr=50' test.hoa \
--stats=%s > output
test `cat output` = 3
# How about a state-based DPA?
$autfilt -S --sat-minimize='acc="parity max even 3",colored' -H test.hoa \
@ -118,6 +162,47 @@ grep 'States: 3' output
grep 'acc-name: parity max even 3' output
grep 'Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))' output
test 3 = `grep -c 'State: [012] {[012]}' output`
$autfilt -S --sat-minimize='acc="parity max even 3",colored,incr=-1' \
-H test.hoa > output
cat output
grep 'properties:.*colored' output
grep 'States: 3' output
grep 'acc-name: parity max even 3' output
grep 'Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))' output
test 3 = `grep -c 'State: [012] {[012]}' output`
$autfilt -S --sat-minimize='acc="parity max even 3",colored,incr=0' \
-H test.hoa > output
cat output
grep 'properties:.*colored' output
grep 'States: 3' output
grep 'acc-name: parity max even 3' output
grep 'Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))' output
test 3 = `grep -c 'State: [012] {[012]}' output`
$autfilt -S --sat-minimize='acc="parity max even 3",colored,incr=1' \
-H test.hoa > output
cat output
grep 'properties:.*colored' output
grep 'States: 3' output
grep 'acc-name: parity max even 3' output
grep 'Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))' output
test 3 = `grep -c 'State: [012] {[012]}' output`
$autfilt -S --sat-minimize='acc="parity max even 3",colored,incr=2' \
-H test.hoa > output
cat output
grep 'properties:.*colored' output
grep 'States: 3' output
grep 'acc-name: parity max even 3' output
grep 'Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))' output
test 3 = `grep -c 'State: [012] {[012]}' output`
$autfilt -S --sat-minimize='acc="parity max even 3",colored,incr=50' \
-H test.hoa > output
cat output
grep 'properties:.*colored' output
grep 'States: 3' output
grep 'acc-name: parity max even 3' output
grep 'Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))' output
test 3 = `grep -c 'State: [012] {[012]}' output`
# I get headaches whenever I think about this acceptance condition, so
# it should be a good test case.
@ -136,9 +221,6 @@ State: 1
[!0] 1 {1}
--END--
EOF
$autfilt -H --sat-minimize special.hoa > output
cat >expected <<EOF
HOA: v1
States: 1
@ -153,8 +235,19 @@ State: 0
[!0] 0 {1}
--END--
EOF
$autfilt -H --sat-minimize special.hoa > output
diff output expected
$autfilt -H --sat-minimize='incr=-1' special.hoa > output
diff output expected
$autfilt -H --sat-minimize='incr=0' special.hoa > output
diff output expected
$autfilt -H --sat-minimize='incr=1' special.hoa > output
diff output expected
$autfilt -H --sat-minimize='incr=2' special.hoa > output
diff output expected
$autfilt -H --sat-minimize='incr=50' special.hoa > output
diff output expected
cat >foo.hoa <<EOF
HOA: v1
@ -170,15 +263,61 @@ State: 0
0 {2 1} /*{b, a}*/
--END--
EOF
$autfilt --sat-minimize='acc="Streett 1",max-states=2' foo.hoa \
--stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Streett 1",max-states=2,incr=-1' foo.hoa \
--stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Streett 1",max-states=2,incr=0' foo.hoa \
--stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Streett 1",max-states=2,incr=1' foo.hoa \
--stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Streett 1",max-states=2,incr=2' foo.hoa \
--stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Streett 1",max-states=2,incr=50' foo.hoa \
--stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Rabin 1",max-states=4' foo.hoa \
--stats=%s >out && exit 1
test -z "`cat out`"
$autfilt --sat-minimize='acc="Rabin 1",max-states=4,incr=-1' foo.hoa \
--stats=%s >out && exit 1
test -z "`cat out`"
$autfilt --sat-minimize='acc="Rabin 1",max-states=4,incr=0' foo.hoa \
--stats=%s >out && exit 1
test -z "`cat out`"
$autfilt --sat-minimize='acc="Rabin 1",max-states=4,incr=1' foo.hoa \
--stats=%s >out && exit 1
test -z "`cat out`"
$autfilt --sat-minimize='acc="Rabin 1",max-states=4,incr=2' foo.hoa \
--stats=%s >out && exit 1
test -z "`cat out`"
$autfilt --sat-minimize='acc="Rabin 1",max-states=4,incr=50' foo.hoa \
--stats=%s >out && exit 1
test -z "`cat out`"
$autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1' foo.hoa \
--stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1,incr=-1' \
foo.hoa --stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1,incr=0' \
foo.hoa --stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1,incr=1' \
foo.hoa --stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1,incr=2' \
foo.hoa --stats=%s >out
test "`cat out`" = 1
$autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1,incr=50' \
foo.hoa --stats=%s >out
test "`cat out`" = 1