New game api
Introduce a new, uniform way to create and solve games. Games can now be created directly from specification using creat_game, uniformly solved using solve_game and transformed into a strategy using create_strategy. Strategy are mealy machines, which can be minimized. * bin/ltlsynt.cc: Minor adaption * spot/twaalgos/game.cc: solve_game, setters and getters for named properties * spot/twaalgos/game.hh: Here too * spot/twaalgos/mealy_machine.cc: Minor adaption * spot/twaalgos/synthesis.cc: create_game, create_strategy and minimize_strategy * spot/twaalgos/synthesis.hh: Here too * tests/core/ltlsynt.test: Adapting * tests/python/aiger.py , tests/python/games.ipynb , tests/python/mealy.py , tests/python/parity.py , tests/python/split.py: Adapting
This commit is contained in:
parent
786599ed20
commit
4260b17fba
12 changed files with 3163 additions and 305 deletions
|
|
@ -74,17 +74,11 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 9 1 2 1 6
|
||||
aag 3 1 1 1 1
|
||||
2
|
||||
4 16
|
||||
6 18
|
||||
14
|
||||
8 5 7
|
||||
10 4 6
|
||||
12 2 9
|
||||
14 11 12
|
||||
16 3 11
|
||||
18 2 11
|
||||
4 1
|
||||
6
|
||||
6 2 4
|
||||
i0 a
|
||||
o0 b
|
||||
EOF
|
||||
|
|
@ -93,14 +87,10 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 6 1 2 1 3
|
||||
aag 2 1 1 1 0
|
||||
2
|
||||
4 1
|
||||
2
|
||||
4 12
|
||||
6 10
|
||||
10
|
||||
8 4 6
|
||||
10 2 9
|
||||
12 3 9
|
||||
i0 a
|
||||
o0 b
|
||||
EOF
|
||||
|
|
@ -109,21 +99,11 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 13 1 2 1 10
|
||||
aag 3 1 1 1 1
|
||||
2
|
||||
4 23
|
||||
6 27
|
||||
17
|
||||
8 2 5
|
||||
10 6 8
|
||||
12 2 4
|
||||
14 7 12
|
||||
16 11 15
|
||||
18 3 5
|
||||
20 3 7
|
||||
22 19 21
|
||||
24 2 7
|
||||
26 9 25
|
||||
4 1
|
||||
6
|
||||
6 2 4
|
||||
i0 a
|
||||
o0 b
|
||||
EOF
|
||||
|
|
@ -132,17 +112,11 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 9 1 2 1 6
|
||||
aag 3 1 1 1 1
|
||||
2
|
||||
4 16
|
||||
6 18
|
||||
14
|
||||
8 5 7
|
||||
10 4 6
|
||||
12 2 9
|
||||
14 11 12
|
||||
16 3 11
|
||||
18 2 11
|
||||
4 1
|
||||
6
|
||||
6 2 4
|
||||
i0 a
|
||||
o0 b
|
||||
EOF
|
||||
|
|
@ -151,18 +125,11 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 10 1 2 1 7
|
||||
aag 3 1 1 1 1
|
||||
2
|
||||
4 18
|
||||
6 20
|
||||
14
|
||||
8 5 6
|
||||
10 4 7
|
||||
12 9 11
|
||||
14 2 13
|
||||
16 4 6
|
||||
18 3 17
|
||||
20 2 17
|
||||
4 1
|
||||
6
|
||||
6 2 4
|
||||
i0 a
|
||||
o0 b
|
||||
EOF
|
||||
|
|
@ -171,14 +138,10 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 6 1 2 1 3
|
||||
aag 2 1 1 1 0
|
||||
2
|
||||
4 1
|
||||
2
|
||||
4 12
|
||||
6 10
|
||||
10
|
||||
8 4 6
|
||||
10 2 9
|
||||
12 3 9
|
||||
i0 a
|
||||
o0 b
|
||||
EOF
|
||||
|
|
@ -187,18 +150,11 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 10 1 2 1 7
|
||||
aag 3 1 1 1 1
|
||||
2
|
||||
4 18
|
||||
6 20
|
||||
14
|
||||
8 4 7
|
||||
10 5 6
|
||||
12 11 9
|
||||
14 2 13
|
||||
16 4 9
|
||||
18 3 17
|
||||
20 2 17
|
||||
4 1
|
||||
6
|
||||
6 2 4
|
||||
i0 a
|
||||
o0 b
|
||||
EOF
|
||||
|
|
@ -207,15 +163,10 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 7 1 2 1 4
|
||||
aag 2 1 1 1 0
|
||||
2
|
||||
4 1
|
||||
2
|
||||
4 14
|
||||
6 12
|
||||
12
|
||||
8 4 7
|
||||
10 4 9
|
||||
12 2 11
|
||||
14 3 11
|
||||
i0 a
|
||||
o0 b
|
||||
EOF
|
||||
|
|
@ -224,18 +175,12 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 9 1 2 2 6
|
||||
aag 3 1 1 2 1
|
||||
2
|
||||
4 16
|
||||
6 18
|
||||
14
|
||||
14
|
||||
8 5 7
|
||||
10 4 6
|
||||
12 2 9
|
||||
14 11 12
|
||||
16 3 11
|
||||
18 2 11
|
||||
4 1
|
||||
6
|
||||
6
|
||||
6 2 4
|
||||
i0 a
|
||||
o0 b
|
||||
o1 c
|
||||
|
|
@ -245,15 +190,11 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 6 1 2 2 3
|
||||
aag 2 1 1 2 0
|
||||
2
|
||||
4 1
|
||||
2
|
||||
2
|
||||
4 12
|
||||
6 10
|
||||
10
|
||||
10
|
||||
8 4 6
|
||||
10 2 9
|
||||
12 3 9
|
||||
i0 a
|
||||
o0 b
|
||||
o1 c
|
||||
|
|
@ -263,19 +204,12 @@ diff out exp
|
|||
|
||||
cat >exp <<EOF
|
||||
REALIZABLE
|
||||
aag 10 1 2 2 7
|
||||
aag 3 1 1 2 1
|
||||
2
|
||||
4 18
|
||||
6 20
|
||||
14
|
||||
14
|
||||
8 4 7
|
||||
10 5 6
|
||||
12 11 9
|
||||
14 2 13
|
||||
16 4 9
|
||||
18 3 17
|
||||
20 2 17
|
||||
4 1
|
||||
6
|
||||
6
|
||||
6 4 2
|
||||
i0 a
|
||||
o0 b
|
||||
o1 c
|
||||
|
|
|
|||
|
|
@ -3333,7 +3333,7 @@ for strat_string, (ins_str, outs_str) in strats:
|
|||
outs &= buddy.bdd_ithvar(strat.register_ap(aout))
|
||||
|
||||
spot.set_synthesis_outputs(strat, outs)
|
||||
strat_s = spot.split_2step(strat, ins, outs, False, False)
|
||||
strat_s = spot.split_2step(strat, outs, False, False)
|
||||
|
||||
for m in ["isop", "ite", "both"]:
|
||||
for ss in [""] + [f"+sub{ii}" for ii in range(3)]:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -378,7 +378,7 @@ for (mealy_str, nenv_min) in test_auts:
|
|||
ins = ins & buddy.bdd_ithvar(mealy.register_ap(aap.ap_name()))
|
||||
else:
|
||||
assert("""Aps must start with either "i" or "o".""")
|
||||
mealy_min_us_s = spot.split_2step(mealy_min_us, ins, outs, False, False)
|
||||
mealy_min_us_s = spot.split_2step(mealy_min_us, outs, False, False)
|
||||
assert(spot.is_mealy_specialization(mealy, mealy_min_us_s, True))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -124,10 +124,16 @@ except RuntimeError as e:
|
|||
else:
|
||||
report_missing_exception()
|
||||
|
||||
spot.set_state_player(a, 1, 1)
|
||||
assert spot.get_state_players(a) == (False, True, False)
|
||||
assert spot.get_state_player(a, 0) == 0
|
||||
assert spot.get_state_player(a, 1) == 1
|
||||
try:
|
||||
spot.set_state_player(a, 1, True)
|
||||
except RuntimeError as e:
|
||||
assert "Can only" in str(e)
|
||||
else:
|
||||
report_missing__exception()
|
||||
spot.set_state_players(a, (False, True, False))
|
||||
assert spot.get_state_player(a, 0) == False
|
||||
assert spot.get_state_player(a, 1) == True
|
||||
assert spot.get_state_player(a, 2) == False
|
||||
|
||||
try:
|
||||
spot.set_state_players(a, [True, False, False, False])
|
||||
|
|
@ -144,7 +150,7 @@ else:
|
|||
report_missing_exception()
|
||||
|
||||
try:
|
||||
spot.set_state_player(a, 4, 1)
|
||||
spot.set_state_player(a, 4, True)
|
||||
except RuntimeError as e:
|
||||
assert "invalid state number" in str(e)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -43,13 +43,10 @@ def equiv(a, b):
|
|||
|
||||
def do_split(f, in_list, out_list):
|
||||
aut = spot.translate(f)
|
||||
inputs = spot.buddy.bddtrue
|
||||
for a in in_list:
|
||||
inputs &= spot.buddy.bdd_ithvar(aut.get_dict().varnum(spot.formula(a)))
|
||||
outputs = spot.buddy.bddtrue
|
||||
for a in out_list:
|
||||
outputs &= spot.buddy.bdd_ithvar(aut.get_dict().varnum(spot.formula(a)))
|
||||
s = spot.split_2step(aut, inputs, outputs, False, False)
|
||||
s = spot.split_2step(aut, outputs, False, False)
|
||||
return aut, s
|
||||
|
||||
def str_diff(expect, obtained):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue