Store membership to acceptance sets using bitsets, not BDDs.
This is a huge patch, that took over a month to complete. The bit sets are currently restricted to what 'unsigned can store', but it should be easy to extend it to 'uint64_t' should we need it. * NEWS: Update. * src/tgba/acc.hh: New file. * src/tgbatest/acc.cc, src/tgbatest/acc.test: Test it. * src/tgba/tgbakvcomplement.cc, src/tgba/tgbakvcomplement.hh, src/tgba/tgbasgba.cc, src/tgba/tgbasgba.hh: Delete. The KV complementation is too slow to be used in practice, and I somehow broke it during the conversion to bitsets. The tgba->sgba conversion was only used for the KV complementation, and should be better redone on tgba_digraph_ptr should it be needed again. * src/bin/ltlcross.cc, src/dstarparse/dra2ba.cc, src/dstarparse/nsa2tgba.cc, src/graphtest/tgbagraph.cc, src/graphtest/tgbagraph.test, src/kripke/fairkripke.cc, src/kripke/fairkripke.hh, src/kripke/kripke.cc, src/kripke/kripke.hh, src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh, src/misc/hash.hh, src/neverparse/neverclaimparse.yy, src/priv/accmap.hh, src/ta/ta.cc, src/ta/ta.hh, src/ta/taexplicit.cc, src/ta/taexplicit.hh, src/ta/taproduct.cc, src/ta/taproduct.hh, src/ta/tgta.cc, src/ta/tgta.hh, src/ta/tgtaexplicit.cc, src/ta/tgtaexplicit.hh, src/ta/tgtaproduct.cc, src/ta/tgtaproduct.hh, src/taalgos/dotty.cc, src/taalgos/emptinessta.cc, src/taalgos/minimize.cc, src/taalgos/tgba2ta.cc, src/tgba/Makefile.am, src/tgba/fwd.hh, src/tgba/taatgba.cc, src/tgba/taatgba.hh, src/tgba/tgba.cc, src/tgba/tgba.hh, src/tgba/tgbagraph.cc, src/tgba/tgbagraph.hh, src/tgba/tgbamask.cc, src/tgba/tgbamask.hh, src/tgba/tgbaproduct.cc, src/tgba/tgbaproduct.hh, src/tgba/tgbaproxy.cc, src/tgba/tgbaproxy.hh, src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh, src/tgbaalgos/bfssteps.cc, src/tgbaalgos/complete.cc, src/tgbaalgos/compsusp.cc, src/tgbaalgos/degen.cc, src/tgbaalgos/dotty.cc, src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbacomp.cc, src/tgbaalgos/dtgbasat.cc, src/tgbaalgos/dupexp.cc, src/tgbaalgos/emptiness.cc, src/tgbaalgos/emptiness.hh, src/tgbaalgos/gtec/ce.cc, src/tgbaalgos/gtec/gtec.cc, src/tgbaalgos/gtec/gtec.hh, src/tgbaalgos/gtec/sccstack.cc, src/tgbaalgos/gtec/sccstack.hh, src/tgbaalgos/gv04.cc, src/tgbaalgos/hoaf.cc, src/tgbaalgos/isweakscc.cc, src/tgbaalgos/lbtt.cc, src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/magic.cc, src/tgbaalgos/ndfs_result.hxx, src/tgbaalgos/neverclaim.cc, src/tgbaalgos/postproc.cc, src/tgbaalgos/powerset.cc, src/tgbaalgos/randomgraph.cc, src/tgbaalgos/randomgraph.hh, src/tgbaalgos/reducerun.cc, src/tgbaalgos/replayrun.cc, src/tgbaalgos/safety.cc, src/tgbaalgos/save.cc, src/tgbaalgos/scc.cc, src/tgbaalgos/scc.hh, src/tgbaalgos/sccfilter.cc, src/tgbaalgos/sccinfo.cc, src/tgbaalgos/sccinfo.hh, src/tgbaalgos/se05.cc, src/tgbaalgos/simulation.cc, src/tgbaalgos/simulation.hh, src/tgbaalgos/stats.cc, src/tgbaalgos/stripacc.cc, src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03opt.cc, src/tgbaalgos/weight.cc, src/tgbaalgos/weight.hh, src/tgbaparse/tgbaparse.yy, src/tgbatest/Makefile.am, src/tgbatest/complementation.cc, src/tgbatest/complementation.test, src/tgbatest/degenlskip.test, src/tgbatest/det.test, src/tgbatest/dstar.test, src/tgbatest/emptchk.cc, src/tgbatest/explpro2.test, src/tgbatest/explpro3.test, src/tgbatest/explpro4.test, src/tgbatest/explprod.test, src/tgbatest/ltl2tgba.cc, src/tgbatest/ltl2tgba.test, src/tgbatest/maskacc.cc, src/tgbatest/maskacc.test, src/tgbatest/neverclaimread.test, src/tgbatest/randtgba.cc, src/tgbatest/readsave.test, src/tgbatest/sim.test, src/tgbatest/sim2.test, src/tgbatest/spotlbtt.test, src/tgbatest/tgbaread.test, src/tgbatest/tripprod.test, iface/dve2/dve2.cc: Adjust or use to the new acceptance interface.
This commit is contained in:
parent
37ece2b878
commit
2c764fb3c7
125 changed files with 1950 additions and 3254 deletions
|
|
@ -141,7 +141,9 @@ namespace spot
|
|||
{
|
||||
public:
|
||||
|
||||
translate_dict(const bdd_dict_ptr& dict, ltl_simplifier* ls, bool exprop,
|
||||
translate_dict(const bdd_dict_ptr& dict,
|
||||
acc_cond& acc,
|
||||
ltl_simplifier* ls, bool exprop,
|
||||
bool single_acc)
|
||||
: dict(dict),
|
||||
ls(ls),
|
||||
|
|
@ -150,7 +152,8 @@ namespace spot
|
|||
next_set(bddtrue),
|
||||
transdfa(*this),
|
||||
exprop(exprop),
|
||||
single_acc(single_acc)
|
||||
single_acc(single_acc),
|
||||
acc(acc)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -184,6 +187,9 @@ namespace spot
|
|||
ratexp_to_dfa transdfa;
|
||||
bool exprop;
|
||||
bool single_acc;
|
||||
acc_cond& acc;
|
||||
// Map BDD variables to acceptance marks.
|
||||
std::map<int, unsigned> bm;
|
||||
|
||||
enum translate_flags
|
||||
{
|
||||
|
|
@ -231,6 +237,7 @@ namespace spot
|
|||
|
||||
public:
|
||||
|
||||
|
||||
int
|
||||
register_proposition(const formula* f)
|
||||
{
|
||||
|
|
@ -239,6 +246,30 @@ namespace spot
|
|||
return num;
|
||||
}
|
||||
|
||||
acc_cond::mark_t
|
||||
bdd_to_mark(bdd a)
|
||||
{
|
||||
bdd o = a;
|
||||
if (a == bddtrue)
|
||||
return 0U;
|
||||
assert(a != bddfalse);
|
||||
std::vector<unsigned> t;
|
||||
do
|
||||
{
|
||||
int v = bdd_var(a);
|
||||
bdd h = bdd_high(a);
|
||||
a = bdd_low(a);
|
||||
if (h != bddfalse)
|
||||
{
|
||||
t.push_back(bm[v]);
|
||||
if (a == bddfalse)
|
||||
a = h;
|
||||
}
|
||||
}
|
||||
while (a != bddtrue);
|
||||
return acc.marks(t.begin(), t.end());
|
||||
}
|
||||
|
||||
int
|
||||
register_a_variable(const formula* f)
|
||||
{
|
||||
|
|
@ -247,6 +278,10 @@ namespace spot
|
|||
int num = dict->register_acceptance_variable
|
||||
(ltl::constant::true_instance(), this);
|
||||
a_set &= bdd_ithvar(num);
|
||||
|
||||
auto p = bm.emplace(num, 0U);
|
||||
if (p.second)
|
||||
p.first->second = acc.add_set();
|
||||
return num;
|
||||
}
|
||||
// A promise of 'x', noted P(x) is pretty much like the F(x)
|
||||
|
|
@ -297,6 +332,11 @@ namespace spot
|
|||
int num = dict->register_acceptance_variable(g, this);
|
||||
a_set &= bdd_ithvar(num);
|
||||
g->destroy();
|
||||
|
||||
auto p = bm.emplace(num, 0U);
|
||||
if (p.second)
|
||||
p.first->second = acc.add_set();
|
||||
|
||||
return num;
|
||||
}
|
||||
else
|
||||
|
|
@ -316,6 +356,11 @@ namespace spot
|
|||
}
|
||||
int num = dict->register_acceptance_variable(f, this);
|
||||
a_set &= bdd_ithvar(num);
|
||||
|
||||
auto p = bm.emplace(num, 0U);
|
||||
if (p.second)
|
||||
p.first->second = acc.add_set();
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
|
@ -2105,7 +2150,10 @@ namespace spot
|
|||
|
||||
assert(dict == s->get_dict());
|
||||
|
||||
translate_dict d(dict, s, exprop, f->is_syntactic_persistence());
|
||||
tgba_digraph_ptr a = make_tgba_digraph(dict);
|
||||
auto namer = a->create_namer<const formula*, formula_ptr_hash>();
|
||||
|
||||
translate_dict d(dict, a->acc(), s, exprop, f->is_syntactic_persistence());
|
||||
|
||||
// Compute the set of all promises that can possibly occur
|
||||
// inside the formula.
|
||||
|
|
@ -2154,8 +2202,6 @@ namespace spot
|
|||
bdd all_events = observable_events | unobservable_events;
|
||||
|
||||
|
||||
tgba_digraph_ptr a = make_tgba_digraph(dict);
|
||||
auto namer = a->create_namer<const formula*, formula_ptr_hash>();
|
||||
|
||||
// This is in case the initial state is equivalent to true...
|
||||
if (symb_merge)
|
||||
|
|
@ -2341,7 +2387,7 @@ namespace spot
|
|||
formulae_to_translate.insert(truef);
|
||||
namer->new_state(truef);
|
||||
}
|
||||
namer->new_transition(now, truef, cond_for_true, bddtrue);
|
||||
namer->new_transition(now, truef, cond_for_true, 0U);
|
||||
}
|
||||
// Register other transitions.
|
||||
for (i = dests.begin(); i != dests.end(); ++i)
|
||||
|
|
@ -2365,7 +2411,7 @@ namespace spot
|
|||
if (!reachable && !seen)
|
||||
namer->new_state(dest);
|
||||
reachable = true;
|
||||
namer->new_transition(now, dest, cond, j.first);
|
||||
namer->new_transition(now, dest, cond, d.bdd_to_mark(j.first));
|
||||
}
|
||||
|
||||
if (reachable && !seen)
|
||||
|
|
@ -2380,21 +2426,15 @@ namespace spot
|
|||
delete namer;
|
||||
|
||||
dict->register_propositions(fc.used_vars(), a);
|
||||
a->set_acceptance_conditions(d.a_set);
|
||||
// Turn all promises into real acceptance conditions.
|
||||
acc_compl ac(a->all_acceptance_conditions(),
|
||||
a->neg_acceptance_conditions());
|
||||
|
||||
unsigned ns = a->num_states();
|
||||
for (unsigned s = 0; s < ns; ++s)
|
||||
for (auto& t: a->out(s))
|
||||
t.acc = ac.reverse_complement(t.acc);
|
||||
|
||||
t.acc = a->acc().comp(t.acc);
|
||||
|
||||
if (!simplifier)
|
||||
// This should not be deleted before we have registered all propositions.
|
||||
delete s;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue