postproc: Add option to output Complete automata.
* src/tgbaalgos/postproc.cc, src/tgbaalgos/postproc.hh: Tweak set_pref() to also accept Any|Complete, Small|Complete, or Deterministic|Complete. * src/bin/common_post.hh, src/bin/common_post.cc: Add option --complete and set comp. * src/bin/dstar2tgba.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc: Pass comp to set_pref(). * src/tgbaalgos/complete.cc: Preserve state-based acceptance. * src/tgbatest/dstar.test, src/tgbatest/ltlcross2.test, src/tgbatest/nondet.test: Augment tests. * doc/org/dstar2tgba.org, doc/org/ltl2tgba.org, NEWS: Document.
This commit is contained in:
parent
b31facffb1
commit
1ab46b0864
14 changed files with 139 additions and 49 deletions
|
|
@ -80,12 +80,19 @@ namespace spot
|
|||
{
|
||||
// add a transition to a sink state if the state is not complete.
|
||||
bdd all = bddtrue;
|
||||
for (i->first(); !i->done(); i->next())
|
||||
bdd acc = bddfalse;
|
||||
i->first();
|
||||
// In case the automaton use state-based acceptance, propagate
|
||||
// the acceptance of the first transition to the one we add.
|
||||
if (!i->done())
|
||||
acc = i->current_acceptance_conditions();
|
||||
for (; !i->done(); i->next())
|
||||
all -= i->current_condition();
|
||||
if (all != bddfalse)
|
||||
{
|
||||
trans* t = out_->create_transition(n, 0);
|
||||
t->condition = all;
|
||||
t->acceptance_conditions = acc | addacc_;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,9 +126,12 @@ namespace spot
|
|||
return s;
|
||||
}
|
||||
|
||||
#define PREF_ (pref_ & (Small | Deterministic))
|
||||
#define COMP_ (pref_ & Complete)
|
||||
|
||||
const tgba* postprocessor::run(const tgba* a, const ltl::formula* f)
|
||||
{
|
||||
if (type_ == TGBA && pref_ == Any && level_ == Low)
|
||||
if (type_ == TGBA && PREF_ == Any && level_ == Low)
|
||||
return a;
|
||||
|
||||
if (simul_ < 0)
|
||||
|
|
@ -143,7 +146,7 @@ namespace spot
|
|||
// Remove useless SCCs.
|
||||
if (type_ == Monitor)
|
||||
{
|
||||
// Do not bother about acceptance conditions, they we be
|
||||
// Do not bother about acceptance conditions, they will be
|
||||
// ignored.
|
||||
const tgba* s = scc_filter_states(a);
|
||||
delete a;
|
||||
|
|
@ -158,7 +161,7 @@ namespace spot
|
|||
|
||||
if (type_ == Monitor)
|
||||
{
|
||||
if (pref_ == Deterministic)
|
||||
if (PREF_ == Deterministic)
|
||||
{
|
||||
const tgba* m = minimize_monitor(a);
|
||||
delete a;
|
||||
|
|
@ -170,7 +173,7 @@ namespace spot
|
|||
delete a;
|
||||
a = m;
|
||||
}
|
||||
if (pref_ == Any)
|
||||
if (PREF_ == Any)
|
||||
return a;
|
||||
|
||||
const tgba* sim = do_simul(a, simul_);
|
||||
|
|
@ -189,16 +192,22 @@ namespace spot
|
|||
if (count_states(m) > count_states(sim))
|
||||
{
|
||||
delete m;
|
||||
return sim;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete sim;
|
||||
return m;
|
||||
sim = m;
|
||||
}
|
||||
if (COMP_ == Complete)
|
||||
{
|
||||
const tgba* s = tgba_complete(sim);
|
||||
delete sim;
|
||||
sim = s;
|
||||
}
|
||||
return sim;
|
||||
}
|
||||
|
||||
if (pref_ == Any)
|
||||
if (PREF_ == Any)
|
||||
{
|
||||
if (type_ == BA)
|
||||
a = do_degen(a);
|
||||
|
|
@ -213,9 +222,9 @@ namespace spot
|
|||
|
||||
// (Small,Low) is the only configuration where we do not run
|
||||
// WDBA-minimization.
|
||||
if ((pref_ != Small || level_ != Low) && wdba_minimize_)
|
||||
if ((PREF_ != Small || level_ != Low) && wdba_minimize_)
|
||||
{
|
||||
bool reject_bigger = (pref_ == Small) && (level_ == Medium);
|
||||
bool reject_bigger = (PREF_ == Small) && (level_ == Medium);
|
||||
dba = minimize_obligation(a, f, 0, reject_bigger);
|
||||
if (dba == a) // Minimization failed.
|
||||
dba = 0;
|
||||
|
|
@ -226,7 +235,7 @@ namespace spot
|
|||
|
||||
// Run a simulation when wdba failed (or was not run), or
|
||||
// at hard levels if we want a small output.
|
||||
if (!dba || (level_ == High && pref_ == Small))
|
||||
if (!dba || (level_ == High && PREF_ == Small))
|
||||
{
|
||||
sim = do_simul(a, simul_);
|
||||
|
||||
|
|
@ -254,7 +263,7 @@ namespace spot
|
|||
if (tba_determinisation_ && !dba)
|
||||
{
|
||||
const tgba* tmpd = 0;
|
||||
if (pref_ == Deterministic
|
||||
if (PREF_ == Deterministic
|
||||
&& f
|
||||
&& f->is_syntactic_recurrence()
|
||||
&& sim->number_of_acceptance_conditions() > 1)
|
||||
|
|
@ -275,8 +284,8 @@ namespace spot
|
|||
// may up it if you want to try producing larger automata.
|
||||
const tgba* tmp =
|
||||
tba_determinize_check(in,
|
||||
(pref_ == Small) ? 2 : 8,
|
||||
1 << ((pref_ == Small) ? 13 : 15),
|
||||
(PREF_ == Small) ? 2 : 8,
|
||||
1 << ((PREF_ == Small) ? 13 : 15),
|
||||
f);
|
||||
if (tmp != 0 && tmp != in)
|
||||
{
|
||||
|
|
@ -287,7 +296,7 @@ namespace spot
|
|||
delete tmp;
|
||||
}
|
||||
delete tmpd;
|
||||
if (dba && pref_ == Deterministic)
|
||||
if (dba && PREF_ == Deterministic)
|
||||
{
|
||||
// disregard the result of the simulation.
|
||||
delete sim;
|
||||
|
|
@ -401,15 +410,26 @@ namespace spot
|
|||
{
|
||||
const tgba* s = scc_filter(dba, true);
|
||||
delete dba;
|
||||
return s;
|
||||
assert(!sim);
|
||||
dba = s;
|
||||
}
|
||||
else if (sim)
|
||||
{
|
||||
const tgba* s = scc_filter(sim, true);
|
||||
delete sim;
|
||||
return s;
|
||||
assert(!dba);
|
||||
sim = s;
|
||||
}
|
||||
}
|
||||
return dba ? dba : sim;
|
||||
|
||||
sim = dba ? dba : sim;
|
||||
|
||||
if (COMP_ == Complete)
|
||||
{
|
||||
const tgba* s = tgba_complete(sim);
|
||||
delete sim;
|
||||
sim = s;
|
||||
}
|
||||
return sim;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,17 @@ namespace spot
|
|||
type_ = type;
|
||||
}
|
||||
|
||||
enum output_pref { Any, Small, Deterministic };
|
||||
enum
|
||||
{
|
||||
Any = 0,
|
||||
Small = 1,
|
||||
Deterministic = 2,
|
||||
// 3 reserved for unambiguous
|
||||
// Combine Complete as 'Small | Complete' or 'Deterministic | Complete'
|
||||
Complete = 4
|
||||
};
|
||||
typedef int output_pref;
|
||||
|
||||
void
|
||||
set_pref(output_pref pref)
|
||||
{
|
||||
|
|
@ -95,7 +105,7 @@ namespace spot
|
|||
const tgba* do_degen(const tgba* input);
|
||||
|
||||
output_type type_;
|
||||
output_pref pref_;
|
||||
int pref_;
|
||||
optimization_level level_;
|
||||
// Fine-tuning options fetched from the option_map.
|
||||
bool degen_reset_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue