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:
philipp 2021-08-13 14:50:16 +02:00 committed by Florian Renkin
parent 786599ed20
commit 4260b17fba
12 changed files with 3163 additions and 305 deletions

View file

@ -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

View file

@ -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))

View file

@ -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:

View file

@ -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):