dba_determinize: Add a threshold argument.

* src/tgbaalgos/powerset.cc, src/tgbaalgos/powerset.hh
(dba_determinize, dba_determinize_check): Add a threshold
argument.
* src/tgbatest/ltl2tgba.cc (-O, -RQ): Accept a threshold
argument.
This commit is contained in:
Alexandre Duret-Lutz 2013-07-17 10:35:23 +02:00
parent 4ac6468bfc
commit 07ab225cc4
3 changed files with 42 additions and 10 deletions

View file

@ -303,13 +303,19 @@ namespace spot
}
tgba_explicit_number*
tba_determinize(const tgba* aut)
tba_determinize(const tgba* aut, unsigned threshold)
{
power_map pm;
// Do not merge transitions in the deterministic automaton. If we
// add two self-loops labeled by "a" and "!a", we do not want
// these to be merged as "1" before the acceptance has been fixed.
tgba_explicit_number* det = tgba_powerset(aut, pm, false);
if ((threshold > 0)
&& (pm.map_.size() > pm.states.size() * threshold))
{
delete det;
return 0;
}
fix_dba_acceptance(det, aut, pm);
det->merge_transitions();
return det;
@ -317,6 +323,7 @@ namespace spot
tgba*
tba_determinize_check(const tgba* aut,
unsigned threshold,
const ltl::formula* f,
const tgba* neg_aut)
{
@ -326,7 +333,10 @@ namespace spot
if (aut->number_of_acceptance_conditions() > 1)
return 0;
tgba_explicit_number* det = tba_determinize(aut);
tgba_explicit_number* det = tba_determinize(aut, threshold);
if (!det)
return 0;
if (neg_aut == 0)
{

View file

@ -122,8 +122,12 @@ namespace spot
/// }
/// \endverbatim
/// only adapted to work on TBA rather than BA.
///
/// If \a threshold is non null, abort the construction whenever it
/// would build an automaton that is more than \a threshold time
/// bigger (in term of states) than the original automaton.
SPOT_API tgba_explicit_number*
tba_determinize(const tgba* aut);
tba_determinize(const tgba* aut, unsigned threshold = 0);
/// \brief Determinize a TBA and make sure it is correct.
///
@ -134,15 +138,22 @@ namespace spot
/// \a neg_aut is not given, it will be built from \a f.
///
/// \param aut the automaton to minimize
///
/// \param threshold if non null, abort the construction whenever it
/// would build an automaton that is more than \a threshold time
/// bigger (in term of states) than the original automaton.
///
/// \param f the formula represented by the original automaton
///
/// \param neg_aut an automaton representing the negation of \a aut
///
/// \return a new tgba if the automaton could be determinized, \a aut if
/// the automaton cannot be determinized, 0 if we do not know if the
/// determinization is correct because neither \a f nor \a neg_aut
/// were supplied.
tgba*
SPOT_API tgba*
tba_determinize_check(const tgba* aut,
unsigned threshold = 0,
const ltl::formula* f = 0,
const tgba* neg_aut = 0);