partial_degeneralize: handle original-state correctly
Reported by Florian Renkin * spot/twaalgos/degen.cc (partial_degeneralize): Update original-state when partial_degeneralize is executed more than once in a loop. * tests/python/pdegen.py: Add test case.
This commit is contained in:
parent
febbe5c2e3
commit
71f1f2fb96
2 changed files with 61 additions and 1 deletions
|
|
@ -1082,8 +1082,28 @@ namespace spot
|
|||
twa_graph_ptr
|
||||
partial_degeneralize(twa_graph_ptr a)
|
||||
{
|
||||
bool composeorig = false;
|
||||
while (acc_cond::mark_t m = is_partially_degeneralizable(a))
|
||||
a = partial_degeneralize(a, m);
|
||||
{
|
||||
twa_graph_ptr b = partial_degeneralize(a, m);
|
||||
// After the first partial degeneralization, we need to compose
|
||||
// the original-states, so that original-states still appear
|
||||
// to reference the original automaton.
|
||||
if (composeorig)
|
||||
{
|
||||
auto origa =
|
||||
a->get_named_prop<std::vector<unsigned>>("original-states");
|
||||
auto origb =
|
||||
b->get_named_prop<std::vector<unsigned>>("original-states");
|
||||
for (auto& s: *origb)
|
||||
s = (*origa)[s];
|
||||
}
|
||||
else
|
||||
{
|
||||
composeorig = true;
|
||||
}
|
||||
a = b;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue