Add several options to CAR

* spot/twa/acc.hh: Remove useless comment.
* spot/twaalgos/car.cc: Rewrite the implementation to try
  multiple algorithms and choose the best, add the possibility
  to force the order of the colors/pairs in LAR and use
  propagate_marks_here.
* spot/twaalgos/car.hh, tests/python/car.py: Create a new system of
  options for CAR.
* spot/twaalgos/degen.cc, spot/twaalgos/degen.hh: Add the possibility
  to forbid some marks in is_partially_degeneralizable.
This commit is contained in:
Florian Renkin 2020-03-13 16:31:16 +01:00
parent 6489d6c091
commit dddc7920e4
6 changed files with 1165 additions and 866 deletions

View file

@ -592,7 +592,6 @@ namespace spot
}
if (elements.size() == 2)
{
// Vaut 1 si si c'est le 2e qui est bon
unsigned pos = elements[1].back().sub.op == op
&& elements[1][0].mark.count() == 1;
if (!(elements[0].back().sub.op == op || pos))

File diff suppressed because it is too large Load diff

View file

@ -23,6 +23,23 @@
namespace spot
{
struct car_option
{
bool search_ex = true;
bool use_last = true;
bool force_order = true;
bool partial_degen = true;
bool acc_clean = true;
bool parity_equiv = true;
bool parity_prefix = true;
bool rabin_to_buchi = true;
bool reduce_col_deg = false;
bool propagate_col = true;
bool pretty_print = true;
};
/// \ingroup twa_acc_transform
/// \brief Take an automaton with any acceptance condition and return an
/// equivalent parity automaton.
@ -43,17 +60,10 @@ namespace spot
/// If \a pretty_print is true, we give a name to the states describing the
// state of the aut_ and the permutation.
SPOT_API twa_graph_ptr
remove_false_transitions(const twa_graph_ptr a);
SPOT_API twa_graph_ptr
remove_false_transitions(const twa_graph_ptr a);
SPOT_API twa_graph_ptr
to_parity(const twa_graph_ptr &aut, const car_option options = car_option());
SPOT_API twa_graph_ptr
car(const twa_graph_ptr &aut,
bool search_ex = true,
bool partial_degen = true,
bool scc_acc_clean = true,
bool parity_equiv = true,
bool use_last = true,
bool parity_prefix = true,
bool rabin_to_buchi = true,
bool pretty_print = false);
} // namespace spot

View file

@ -846,7 +846,8 @@ namespace spot
acc_cond::mark_t
is_partially_degeneralizable(const const_twa_graph_ptr& aut,
bool allow_inf, bool allow_fin)
bool allow_inf, bool allow_fin,
std::vector<acc_cond::mark_t> forbid)
{
auto& code = aut->get_acceptance();
@ -881,15 +882,21 @@ namespace spot
case acc_cond::acc_op::FinNeg:
pos -= 2;
if (allow_fin)
if (update(code[pos].mark))
{
auto m = code[pos].mark;
if (!std::count(forbid.begin(), forbid.end(), m) && update(m))
return res;
}
break;
case acc_cond::acc_op::Inf:
case acc_cond::acc_op::InfNeg:
pos -= 2;
if (allow_inf)
if (update(code[pos].mark))
{
auto m = code[pos].mark;
if (!std::count(forbid.begin(), forbid.end(), m) && update(m))
return res;
}
break;
}
}

View file

@ -151,7 +151,8 @@ namespace spot
SPOT_API acc_cond::mark_t
is_partially_degeneralizable(const const_twa_graph_ptr& aut,
bool allow_inf = true,
bool allow_fin = true);
bool allow_fin = true,
std::vector<acc_cond::mark_t> forbid = {});
/// \ingroup twa_algorithms
/// \brief Propagate marks around the automaton