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

@ -1947,7 +1947,8 @@ namespace spot
ltl_to_tgba_fm(formula f2, const bdd_dict_ptr& dict,
bool exprop, bool symb_merge, bool branching_postponement,
bool fair_loop_approx, const atomic_prop_set* unobs,
tl_simplifier* simplifier, bool unambiguous)
tl_simplifier* simplifier, bool unambiguous,
const output_aborter* aborter)
{
tl_simplifier* s = simplifier;
@ -2051,6 +2052,13 @@ namespace spot
dest_map dests;
while (!formulae_to_translate.empty())
{
if (aborter && aborter->too_large(a))
{
if (!simplifier)
delete s;
return nullptr;
}
// Pick one formula.
formula now = *formulae_to_translate.begin();
formulae_to_translate.erase(formulae_to_translate.begin());

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2017, 2019 Laboratoire de
// Copyright (C) 2010-2015, 2017, 2019-2020 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
@ -26,6 +26,7 @@
#include <spot/twa/twagraph.hh>
#include <spot/tl/apcollect.hh>
#include <spot/tl/simplify.hh>
#include <spot/twaalgos/powerset.hh>
namespace spot
{
@ -73,6 +74,10 @@ namespace spot
/// \param unambiguous When true, unambigous TGBA will be produced
/// using the trick described in \cite benedikt.13.tacas .
///
/// \param aborter When given, aborts the construction whenever the
/// constructed automaton would become larger than specified by the
/// output_aborter.
///
/// \return A spot::twa_graph that recognizes the language of \a f.
SPOT_API twa_graph_ptr
ltl_to_tgba_fm(formula f, const bdd_dict_ptr& dict,
@ -81,5 +86,6 @@ namespace spot
bool fair_loop_approx = false,
const atomic_prop_set* unobs = nullptr,
tl_simplifier* simplifier = nullptr,
bool unambiguous = false);
bool unambiguous = false,
const output_aborter* aborter = nullptr);
}

View file

@ -60,11 +60,14 @@ namespace spot
gf_guarantee_set_ = true;
}
ltl_split_ = opt->get("ltl-split", 1);
int tls_max_states = opt->get("tls-max-states", 64);
tls_max_states_ = std::max(0, tls_max_states);
}
void translator::build_simplifier(const bdd_dict_ptr& dict)
{
tl_simplifier_options options(false, false, false);
options.containment_max_states = tls_max_states_;
switch (level_)
{
case High:

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013-2018 Laboratoire de Recherche et Développement
// Copyright (C) 2013-2018, 2020 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -154,6 +154,7 @@ namespace spot
bool gf_guarantee_ = true;
bool gf_guarantee_set_ = false;
bool ltl_split_;
unsigned tls_max_states_ = 0;
const option_map* opt_;
};
/// @}