pdegen: fix the place with original-states are composed
doing it too early breaks the "redirect all-accepting transitions" optimization * spot/twaalgos/degen.cc: move the original-states composition code. * tests/python/pdegen.py: Add test-case from Florian Renkin.
This commit is contained in:
parent
5b7961257d
commit
10f40041b1
2 changed files with 30 additions and 4 deletions
|
|
@ -915,8 +915,6 @@ namespace spot
|
|||
|
||||
// auto* names = new std::vector<std::string>;
|
||||
// res->set_named_prop("state-names", names);
|
||||
auto old_orig_states =
|
||||
a->get_named_prop<std::vector<unsigned>>("original-states");
|
||||
auto orig_states = new std::vector<unsigned>();
|
||||
auto levels = new std::vector<unsigned>();
|
||||
unsigned ns = a->num_states();
|
||||
|
|
@ -972,8 +970,6 @@ namespace spot
|
|||
// names->push_back(os.str());
|
||||
|
||||
unsigned orig = ds.first;
|
||||
if (old_orig_states)
|
||||
orig = (*old_orig_states)[orig];
|
||||
assert(ns == orig_states->size());
|
||||
orig_states->emplace_back(orig);
|
||||
levels->emplace_back(ds.second);
|
||||
|
|
@ -1071,6 +1067,14 @@ namespace spot
|
|||
force_purge = true;
|
||||
}
|
||||
}
|
||||
// compose original-states with the any previously existing one.
|
||||
// We do that now, because the above loop uses orig_states to
|
||||
// find the local source, but for the bottommost copy below, it's better
|
||||
// if we compose everything.
|
||||
if (auto old_orig_states =
|
||||
a->get_named_prop<std::vector<unsigned>>("original-states"))
|
||||
for (auto& s: *orig_states)
|
||||
s = (*old_orig_states)[s];
|
||||
//orders.print();
|
||||
res->merge_edges();
|
||||
keep_bottommost_copies(res, si_orig, orig_states, force_purge);
|
||||
|
|
|
|||
|
|
@ -391,3 +391,25 @@ State: 1
|
|||
aut13g = spot.partial_degeneralize(aut13)
|
||||
assert aut13g.equivalent_to(aut13)
|
||||
assert aut13g.num_states() == 3
|
||||
|
||||
|
||||
aut14 = spot.automaton("""HOA: v1
|
||||
States: 2
|
||||
Start: 0
|
||||
AP: 2 "p0" "p1"
|
||||
Acceptance: 5 (Inf(0)&Inf(1)) | ((Fin(2)|Fin(3)) & Fin(4))
|
||||
--BODY--
|
||||
State: 0
|
||||
[!0 & 1] 0 {2 3}
|
||||
[!0 & !1] 0 {3}
|
||||
[0] 1
|
||||
State: 1
|
||||
[0&1] 1 {1 2 4}
|
||||
[0&!1] 1 {4}
|
||||
[!0&1] 1 {0 1 2 3}
|
||||
[!0&!1] 1 {0 3}
|
||||
--END--
|
||||
""")
|
||||
aut14g = spot.partial_degeneralize(aut14)
|
||||
assert aut14g.equivalent_to(aut14)
|
||||
assert aut14g.num_states() == 3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue