Add several options to CAR
* spot/twa/acc.hh: Remove useless comment. * spot/twaalgos/car.cc: Rewrite the implementation to try multiple algorithms and choose the best, add the possibility to force the order of the colors/pairs in LAR and use propagate_marks_here. * spot/twaalgos/car.hh, tests/python/car.py: Create a new system of options for CAR. * spot/twaalgos/degen.cc, spot/twaalgos/degen.hh: Add the possibility to forbid some marks in is_partially_degeneralizable.
This commit is contained in:
parent
6489d6c091
commit
dddc7920e4
6 changed files with 1165 additions and 866 deletions
|
|
@ -20,31 +20,83 @@
|
|||
|
||||
import spot
|
||||
|
||||
no_option = spot.car_option()
|
||||
no_option.search_ex = False
|
||||
no_option.use_last = False
|
||||
no_option.force_order = False
|
||||
no_option.partial_degen = False
|
||||
no_option.acc_clean = False
|
||||
no_option.parity_equiv = False
|
||||
no_option.parity_prefix = False
|
||||
no_option.rabin_to_buchi = False
|
||||
no_option.propagate_col = False
|
||||
|
||||
acc_clean_search_opt = spot.car_option()
|
||||
acc_clean_search_opt.force_order = False
|
||||
acc_clean_search_opt.partial_degen = False
|
||||
acc_clean_search_opt.parity_equiv = False
|
||||
acc_clean_search_opt.parity_prefix = False
|
||||
acc_clean_search_opt.rabin_to_buchi = False
|
||||
acc_clean_search_opt.propagate_col = False
|
||||
|
||||
partial_degen_opt = spot.car_option()
|
||||
partial_degen_opt.search_ex = False
|
||||
partial_degen_opt.force_order = False
|
||||
partial_degen_opt.parity_equiv = False
|
||||
partial_degen_opt.parity_prefix = False
|
||||
partial_degen_opt.rabin_to_buchi = False
|
||||
partial_degen_opt.propagate_col = False
|
||||
|
||||
parity_equiv_opt = spot.car_option()
|
||||
parity_equiv_opt.search_ex = False
|
||||
parity_equiv_opt.use_last = False
|
||||
parity_equiv_opt.force_order = False
|
||||
parity_equiv_opt.partial_degen = False
|
||||
parity_equiv_opt.parity_prefix = False
|
||||
parity_equiv_opt.rabin_to_buchi = False
|
||||
parity_equiv_opt.propagate_col = False
|
||||
|
||||
rab_to_buchi_opt = spot.car_option()
|
||||
rab_to_buchi_opt.use_last = False
|
||||
rab_to_buchi_opt.force_order = False
|
||||
rab_to_buchi_opt.partial_degen = False
|
||||
rab_to_buchi_opt.parity_equiv = False
|
||||
rab_to_buchi_opt.parity_prefix = False
|
||||
rab_to_buchi_opt.propagate_col = False
|
||||
|
||||
# Force to use CAR or IAR for each SCC
|
||||
use_car_opt = spot.car_option()
|
||||
use_car_opt.partial_degen = False
|
||||
use_car_opt.parity_equiv = False
|
||||
use_car_opt.parity_prefix = False
|
||||
use_car_opt.rabin_to_buchi = False
|
||||
use_car_opt.propagate_col = False
|
||||
|
||||
all_opt = spot.car_option()
|
||||
all_opt.pretty_print = True
|
||||
|
||||
|
||||
options = [
|
||||
# No option
|
||||
[False, False, False, False, False, False, False, False],
|
||||
# Only acc clean and …
|
||||
# … search last
|
||||
[True, False, True, False, True, False, False, False],
|
||||
# … partial degen
|
||||
[False, True, True, False, False, False, False, False],
|
||||
# … parity equiv
|
||||
[False, False, True, True, False, False, False, False],
|
||||
# … parity prefix
|
||||
[False, False, True, False, False, True, False, False],
|
||||
# … rabin to buchi
|
||||
[False, False, True, False, False, False, True, False],
|
||||
no_option,
|
||||
acc_clean_search_opt,
|
||||
partial_degen_opt,
|
||||
parity_equiv_opt,
|
||||
rab_to_buchi_opt,
|
||||
use_car_opt,
|
||||
spot.car_option(),
|
||||
]
|
||||
|
||||
i = 1
|
||||
|
||||
def test(aut):
|
||||
global i
|
||||
for se, par, cl, parity, last, pref, rab, pri in options:
|
||||
p = spot.car(aut, se, par, cl, parity, last, pref, rab, pri)
|
||||
assert(spot.are_equivalent(aut, p))
|
||||
print(f"OK {i}")
|
||||
i += 1
|
||||
for opt in options:
|
||||
try:
|
||||
p = spot.to_parity(aut, opt)
|
||||
assert(spot.are_equivalent(aut, p))
|
||||
except:
|
||||
# Are equivalent can raise exception
|
||||
assert(False)
|
||||
|
||||
|
||||
test(spot.automaton("""HOA: v1
|
||||
|
|
@ -154,10 +206,10 @@ explicit-labels trans-acc --BODY-- State: 0 [0&1] 2 {4 5} [0&1] 4 {0 4}
|
|||
4 [!0&!1] 1 {2 4} State: 5 [!0&1] 4 --END--
|
||||
"""))
|
||||
|
||||
for f in spot.randltl(15, 1000):
|
||||
for f in spot.randltl(15, 2000):
|
||||
test(spot.translate(f, "det", "G"))
|
||||
|
||||
for f in spot.randltl(5, 10000):
|
||||
for f in spot.randltl(5, 25000):
|
||||
test(spot.translate(f))
|
||||
|
||||
test(spot.translate('!(GFa -> (GFb & GF(!b & !Xb)))', 'gen', 'det'))
|
||||
|
|
@ -249,4 +301,4 @@ State: 1
|
|||
[0&!1] 1 {2 3}
|
||||
[0&1] 1 {1 2 4}
|
||||
--END--
|
||||
"""))
|
||||
"""))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue