autfilt: complement of non-deterministic automata as well

* bin/autfilt.cc: Determinize automata before complementation
if needed.
* tests/core/complement.test: Adjust.
* NEWS: Mention the new feature.
This commit is contained in:
Alexandre Duret-Lutz 2016-02-12 17:00:20 +01:00
parent 6a662a6d8e
commit 9799a6455e
3 changed files with 42 additions and 15 deletions

View file

@ -562,17 +562,6 @@ namespace
if (opt_complement_acc)
aut->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().complement());
if (opt_complement)
{
if (!spot::is_deterministic(aut))
{
std::cerr << filename << ':'
<< haut->loc << (": --complement currently supports "
"only deterministic automata\n");
exit(2);
}
aut = spot::dtwa_complement(aut);
}
if (opt_rem_fin)
aut = remove_fin(aut);
if (opt_dnf_acc)
@ -658,6 +647,20 @@ namespace
return 0;
}
if (opt_complement)
{
if (!spot::is_deterministic(aut))
{
// let's determinize that automaton
spot::postprocessor p;
p.set_type(spot::postprocessor::Generic);
p.set_pref(spot::postprocessor::Deterministic);
p.set_level(level);
aut = p.run(aut);
}
aut = spot::dtwa_complement(aut);
}
aut = post.run(aut, nullptr);
if (randomize_st || randomize_tr)