add a newer version of the generic emptiness check
As discussed with Jan Strejček. * spot/twa/acc.cc, spot/twa/acc.hh (fin_unit_one_split): New function. (fin_one_extract): Return the simplified acceptance condition as an optimization. * python/spot/impl.i: Bind this new function. * tests/python/acc.py: New file, to test it. * tests/Makefile.am: Add acc.py. * spot/twaalgos/genem.cc, spot/twaalgos/genem.hh: Implement the spot211 variant of the emptiness check. * tests/python/genem.py: Test it. * tests/python/acc_cond.ipynb: Adjust test for fin_one_extract.
This commit is contained in:
parent
aca6bd9042
commit
721d5695ec
9 changed files with 308 additions and 30 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2017-2021 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2017-2022 Laboratoire de Recherche et Developpement
|
||||
// de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -25,7 +25,7 @@ namespace spot
|
|||
{
|
||||
namespace
|
||||
{
|
||||
enum genem_version_t { spot28, atva19, spot29, spot210 };
|
||||
enum genem_version_t { spot28, atva19, spot29, spot210, spot211 };
|
||||
static genem_version_t genem_version = spot29;
|
||||
}
|
||||
|
||||
|
|
@ -33,6 +33,8 @@ namespace spot
|
|||
{
|
||||
if (emversion == nullptr || !strcasecmp(emversion, "spot29"))
|
||||
genem_version = spot29;
|
||||
else if (!strcasecmp(emversion, "spot211"))
|
||||
genem_version = spot211;
|
||||
else if (!strcasecmp(emversion, "spot210"))
|
||||
genem_version = spot210;
|
||||
else if (!strcasecmp(emversion, "spot28"))
|
||||
|
|
@ -41,7 +43,8 @@ namespace spot
|
|||
genem_version = atva19;
|
||||
else
|
||||
throw std::invalid_argument("generic_emptiness_check version should be "
|
||||
"one of {spot28, atva19, spot29, spot210}");
|
||||
"one of {spot28, atva19, spot29, spot210, "
|
||||
"spot211}");
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
@ -84,6 +87,8 @@ namespace spot
|
|||
scc_split_check(const scc_info& si, unsigned scc, const acc_cond& acc,
|
||||
Extra extra, acc_cond::mark_t tocut)
|
||||
{
|
||||
if (genem_version == spot211 || genem_version == spot210)
|
||||
tocut |= acc.fin_unit();
|
||||
scc_and_mark_filter filt(si, scc, tocut);
|
||||
filt.override_acceptance(acc);
|
||||
scc_info upper_si(filt, EarlyStop
|
||||
|
|
@ -118,13 +123,27 @@ namespace spot
|
|||
// Try to accept when Fin(fo) == true
|
||||
acc_cond::mark_t fo_m = {(unsigned) fo};
|
||||
if (!scc_split_check<EarlyStop, Extra>
|
||||
(si, scc, fpart.remove(fo_m, true), extra, fo_m))
|
||||
(si, scc, fpart, extra, fo_m))
|
||||
if constexpr (EarlyStop)
|
||||
return false;
|
||||
// Try to accept when Fin(fo) == false
|
||||
acc = acc.force_inf(fo_m);
|
||||
}
|
||||
while (!acc.is_f());
|
||||
else if (genem_version == spot211)
|
||||
{
|
||||
do
|
||||
{
|
||||
auto [fo, fpart, rest] = acc.fin_unit_one_split();
|
||||
acc_cond::mark_t fo_m = {(unsigned) fo};
|
||||
if (!scc_split_check<EarlyStop, Extra>
|
||||
(si, scc, fpart, extra, fo_m))
|
||||
if constexpr (EarlyStop)
|
||||
return false;
|
||||
acc = rest;
|
||||
}
|
||||
while (!acc.is_f());
|
||||
}
|
||||
else if (genem_version == spot29)
|
||||
do
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2017-2021 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2017-2022 Laboratoire de Recherche et Developpement
|
||||
// de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -100,7 +100,13 @@ namespace spot
|
|||
/// - "spot29" improves upon the worst case of atva19. This is
|
||||
/// the default.
|
||||
/// - "spot210" improves upon "spot29" in a few cases where a Fin
|
||||
/// is shared by multiple disjuncts.
|
||||
/// is shared by multiple disjuncts. This improve the worst
|
||||
/// case complexity of EL-automata in the general case, but worsen
|
||||
/// the complexity of Hyper-Rabin in particular.
|
||||
/// - "spot211" is another attempt at fixing worst case complexities.
|
||||
/// Compared to atva19, this improves the complexities for Rabin,
|
||||
/// GeneralizedRabin, and EL without worsening the complexity of
|
||||
/// Hyper-Rabin.
|
||||
SPOT_API void
|
||||
generic_emptiness_check_select_version(const char* emversion = nullptr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue