Simplify copying of atomic propositions in new tgba_digraph.

* src/tgba/bdddict.cc, src/tgba/bdddict.hh
(register_all_propositions_of): New method.
* src/tgba/tgbagraph.hh (copy_ap_of): New method.
* src/dstarparse/dra2ba.cc, src/dstarparse/nra2nba.cc,
src/dstarparse/nsa2tgba.cc, src/tgbaalgos/degen.cc,
src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc,
src/tgbaalgos/dupexp.cc, src/tgbaalgos/emptiness.cc,
src/tgbaalgos/minimize.cc, src/tgbaalgos/powerset.cc,
src/tgbaalgos/sccfilter.cc, src/tgbaalgos/simulation.cc,
src/tgbaalgos/stripacc.cc: Simplify using copy_ap_of.
This commit is contained in:
Alexandre Duret-Lutz 2014-08-13 14:21:16 +02:00
parent 917f70073f
commit 10e5c62386
16 changed files with 65 additions and 61 deletions

View file

@ -260,14 +260,11 @@ namespace spot
// The result automaton is an SBA.
auto res = new tgba_digraph(dict);
res->copy_ap_of(a);
res->set_single_acceptance_set();
if (want_sba)
res->set_bprop(tgba_digraph::StateBasedAcc);
// We use the same BDD variables as the input, except for the
// acceptance.
dict->register_all_variables_of(a, res);
// Create an order of acceptance conditions. Each entry in this
// vector correspond to an acceptance set. Each index can
// be used as a level in degen_state to indicate the next expected

View file

@ -671,7 +671,7 @@ namespace spot
{
auto autdict = aut->get_dict();
auto a = new tgba_digraph(autdict);
autdict->register_all_variables_of(aut, a);
a->copy_ap_of(aut);
bdd acc = a->set_single_acceptance_set();
a->new_states(satdict.cand_size);

View file

@ -843,8 +843,7 @@ namespace spot
{
auto autdict = aut->get_dict();
auto a = new tgba_digraph(autdict);
autdict->register_all_variables_of(aut, a);
autdict->unregister_all_typed_variables(bdd_dict::acc, aut);
a->copy_ap_of(aut);
a->set_acceptance_conditions(satdict.all_cand_acc.back());
a->new_states(satdict.cand_size);

View file

@ -38,7 +38,7 @@ namespace spot
: T(a), out_(new tgba_digraph(a->get_dict()))
{
out_->copy_acceptance_conditions_of(a);
a->get_dict()->register_all_variables_of(a, out_);
out_->copy_ap_of(a);
}
tgba_digraph*

View file

@ -287,7 +287,8 @@ namespace spot
{
auto d = a->get_dict();
auto res = new tgba_digraph(d);
d->register_all_variables_of(a, res);
res->copy_ap_of(a);
res->copy_acceptance_conditions_of(a);
const state* s = a->get_init_state();
unsigned src;

View file

@ -119,8 +119,7 @@ namespace spot
{
auto dict = a->get_dict();
auto res = new tgba_digraph(dict);
dict->register_all_variables_of(a, res);
dict->unregister_all_typed_variables(bdd_dict::acc, res);
res->copy_ap_of(a);
res->set_bprop(tgba_digraph::StateBasedAcc);
// For each set, create a state in the resulting automaton.
@ -139,15 +138,9 @@ namespace spot
// For each transition in the initial automaton, add the corresponding
// transition in res.
bdd allacc = bddfalse;
if (!final->empty())
{
int accvar =
dict->register_acceptance_variable(ltl::constant::true_instance(),
res);
allacc = bdd_ithvar(accvar);
res->set_acceptance_conditions(allacc);
}
res->set_single_acceptance_set();
for (sit = sets.begin(); sit != sets.end(); ++sit)
{
@ -167,11 +160,8 @@ namespace spot
dst->destroy();
if (i == state_num.end()) // Ignore useless destinations.
continue;
bdd acc = bddfalse;
if (accepting)
acc = allacc;
res->new_transition(src_num, i->second,
succit->current_condition(), acc);
res->new_acc_transition(src_num, i->second,
succit->current_condition(), accepting);
}
}
res->merge_transitions();

View file

@ -51,10 +51,8 @@ namespace spot
power_set seen;
todo_list todo;
auto d = aut->get_dict();
auto res = new tgba_digraph(d);
d->register_all_variables_of(aut, res);
d->unregister_all_typed_variables(bdd_dict::acc, res);
auto res = new tgba_digraph(aut->get_dict());
res->copy_ap_of(aut);
{
power_state ps;

View file

@ -434,11 +434,11 @@ namespace spot
tgba_digraph* scc_filter_apply(const tgba_digraph* aut,
scc_info* given_si, Args&&... args)
{
bdd_dict* bd = aut->get_dict();
tgba_digraph* filtered = new tgba_digraph(bd);
tgba_digraph* filtered = new tgba_digraph(aut->get_dict());
unsigned in_n = aut->num_states(); // Number of input states.
if (in_n == 0) // Nothing to filter.
return filtered;
filtered->copy_ap_of(aut);
// Compute scc_info if not supplied.
scc_info* si = given_si;
@ -457,7 +457,6 @@ namespace spot
else
inout.push_back(-1U);
bd->register_all_variables_of(aut, filtered);
{
bdd all = aut->all_acceptance_conditions();
bdd neg = aut->neg_acceptance_conditions();

View file

@ -230,9 +230,8 @@ namespace spot
{
if (Cosimulation)
{
bdd_dict* bd = a_->get_dict();
a_ = new tgba_digraph(bd);
bd->register_all_variables_of(old_a_, a_);
a_ = new tgba_digraph(a_->get_dict());
a_->copy_ap_of(old_a_);
a_->copy_acceptance_conditions_of(old_a_);
}
unsigned ns = old_a_->num_states();
@ -546,9 +545,8 @@ namespace spot
acc_compl reverser(all_acceptance_conditions_,
a_->neg_acceptance_conditions());
bdd_dict* d = a_->get_dict();
tgba_digraph* res = new tgba_digraph(d);
d->register_all_variables_of(a_, res);
tgba_digraph* res = new tgba_digraph(a_->get_dict());
res->copy_ap_of(a_);
res->set_acceptance_conditions(all_acceptance_conditions_);
if (Sba)
res->set_bprop(tgba_digraph::StateBasedAcc);

View file

@ -29,6 +29,5 @@ namespace spot
for (auto& t: a->out(s))
t.acc = bddfalse;
a->set_acceptance_conditions(bddfalse);
a->get_dict()->unregister_all_typed_variables(bdd_dict::acc, a);
}
}