Degeneralization keeps track of levels.

* NEWS: Document this.
* spot/twa/twagraph.cc: `copy_state_names_from` handles this new info.
* spot/twaalgos/degen.hh, spot/twaalgos/degen.cc: Implement it.
* tests/python/origstate.py, tests/python/simstate.py: Update tests to
  reflect the change.
This commit is contained in:
Maximilien Colange 2017-05-31 11:11:31 +02:00
parent 7b5ab54530
commit f7d14ab526
6 changed files with 48 additions and 16 deletions

View file

@ -240,8 +240,11 @@ namespace spot
res->prop_copy(a, { false, true, true, true, true, true });
auto orig_states = new std::vector<unsigned>();
auto levels = new std::vector<unsigned>();
orig_states->reserve(a->num_states()); // likely more are needed.
levels->reserve(a->num_states());
res->set_named_prop("original-states", orig_states);
res->set_named_prop("degen-levels", levels);
// Create an order of acceptance conditions. Each entry in this
// vector correspond to an acceptance set. Each index can
@ -328,6 +331,7 @@ namespace spot
assert(ns == orig_states->size());
orig_states->emplace_back(ds.first);
levels->emplace_back(ds.second);
// Level cache stores one encountered level for each state
// (the value of use_lvl_cache determinates which level

View file

@ -56,6 +56,9 @@ namespace spot
/// to retrieve it. Note that these functions may return the original
/// automaton as-is if it is already degeneralized; in this case
/// the "original-states" property is not defined.
/// Similarly, the property "degen-levels" keeps track of the degeneralization
/// levels. To retrieve it, call
/// `aut->get_named_prop<std::vector<unsigned>>("degen-levels")`.
/// \@{
SPOT_API twa_graph_ptr
degeneralize(const const_twa_graph_ptr& a, bool use_z_lvl = true,