translator: add tls-max-states option

This restricts the time spent in translating sub-formulas for
implication tests by limiting the associated automata to 64 states by
default.  Doing so this does worsen any test case, and actually remove
all calls the BuDDy's GC in bdd.test.

* spot/twaalgos/translate.cc, spot/twaalgos/translate.hh,
spot/tl/simplify.cc, spot/tl/simplify.hh, spot/tl/contain.hh,
spot/tl/contain.cc, spot/twaalgos/ltl2tgba_fm.cc,
spot/twaalgos/ltl2tgba_fm.hh: Add support for the option or
its constraint via an output_aborter.
* bin/spot-x.cc, NEWS: Document it.
* tests/core/bdd.test: Adjust and augment test case.
This commit is contained in:
Alexandre Duret-Lutz 2020-09-17 20:49:23 +02:00
parent 9d7e6386e4
commit f5965966e9
11 changed files with 66 additions and 11 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009-2012, 2014-2016, 2018, 2019 Laboratoire de Recherche
// Copyright (C) 2009-2012, 2014-2016, 2018-2020 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// Copyright (C) 2006, 2007 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -52,12 +52,15 @@ namespace spot
language_containment_checker::language_containment_checker
(bdd_dict_ptr dict, bool exprop, bool symb_merge,
bool branching_postponement, bool fair_loop_approx)
bool branching_postponement, bool fair_loop_approx,
unsigned max_states)
: dict_(dict), exprop_(exprop), symb_merge_(symb_merge),
branching_postponement_(branching_postponement),
fair_loop_approx_(fair_loop_approx),
translated_(new trans_map_)
{
if (max_states)
aborter_ = std::make_unique<output_aborter>(max_states);
}
language_containment_checker::~language_containment_checker()
@ -104,7 +107,11 @@ namespace spot
return false;
trim_common_Xs(l, g);
record_* rl = register_formula_(l);
if (!rl->translation)
return false;
record_* rg = register_formula_(g);
if (!rg->translation)
return false;
return incompatible_(rl, rg);
}
@ -139,7 +146,11 @@ namespace spot
if (l == g)
return true;
record_* rl = register_formula_(l);
if (!rl->translation)
return false;
record_* rg = register_formula_(g);
if (!rg->translation)
return false;
if (isomorphism_checker::are_isomorphic(rl->translation, rg->translation))
return true;
return contained(l, g) && contained(g, l);
@ -153,7 +164,8 @@ namespace spot
return &i->second;
auto e = ltl_to_tgba_fm(f, dict_, exprop_, symb_merge_,
branching_postponement_, fair_loop_approx_);
branching_postponement_, fair_loop_approx_,
nullptr, nullptr, false, aborter_.get());
return &translated_->emplace(f, std::move(e)).first->second;
}
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011-2016, 2019 Laboratoire de Recherche
// Copyright (C) 2011-2016, 2019, 2020 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// Copyright (C) 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -24,6 +24,7 @@
#include <spot/tl/formula.hh>
#include <spot/twa/bdddict.hh>
#include <spot/twaalgos/powerset.hh>
namespace spot
{
@ -41,7 +42,8 @@ namespace spot
bool exprop = false,
bool symb_merge = true,
bool branching_postponement = false,
bool fair_loop_approx = false);
bool fair_loop_approx = false,
unsigned max_states = 0U);
~language_containment_checker();
@ -72,5 +74,6 @@ namespace spot
/* Translation Maps */
trans_map_* translated_;
tl_simplifier_cache* c_;
std::unique_ptr<const output_aborter> aborter_ = nullptr;
};
}

View file

@ -70,7 +70,8 @@ namespace spot
tl_simplifier_cache(const bdd_dict_ptr& d,
const tl_simplifier_options& opt)
: dict(d), options(opt), lcc(d, true, true, false, false)
: dict(d), options(opt),
lcc(d, true, true, false, false, opt.containment_max_states)
{
options.containment_checks |= options.containment_checks_stronger;
options.event_univ |= options.favor_event_univ;

View file

@ -93,6 +93,9 @@ namespace spot
// &,|, and X operators. Only rewrite Xor and Equiv under
// temporal operators.
bool keep_top_xor;
// If greater than 0, bound the number of states used by automata
// in containment checks.
unsigned containment_max_states = 0;
};
// fwd declaration to hide technical details.