parity: merge states having same cleaned matrices in parity_product

Some states can become identical once their history matrix are
cleaned. These states are merged and only store the cleaned matrix.

* spot/twaalgos/parity.cc: Here.
This commit is contained in:
Laurent XU 2017-03-29 00:49:22 +02:00
parent cb7e43cb7d
commit 192fb6c1e7

View file

@ -359,18 +359,18 @@ namespace spot
return 0; return 0;
} }
state_history make_succ(value_t left_acc_set, value_t right_acc_set) const state_history make_succ(value_t left_acc_set,
value_t right_acc_set) const
{ {
auto mat = state_history(*this); auto mat = state_history(left_num_sets_, right_num_sets_);
mat.clean_here();
for (unsigned i = 0; i < right_num_sets_; ++i) for (unsigned i = 0; i < right_num_sets_; ++i)
{ {
auto old = mat.get_left(i); auto old = get_left(i);
mat.set_left(i, std::max(left_acc_set, old)); mat.set_left(i, std::max(left_acc_set, old));
} }
for (unsigned i = 0; i < left_num_sets_; ++i) for (unsigned i = 0; i < left_num_sets_; ++i)
{ {
auto old = mat.get_right(i); auto old = get_right(i);
mat.set_right(i, std::max(right_acc_set, old)); mat.set_right(i, std::max(right_acc_set, old));
} }
return mat; return mat;
@ -453,18 +453,19 @@ namespace spot
} }
std::pair<sh_label_t, value_t> std::pair<sh_label_t, value_t>
push_state_history(sh_label_t label, push_state_history(sh_label_t label, value_t left_acc_set,
value_t left_acc_set, value_t right_acc_set) value_t right_acc_set)
{ {
state_history new_sh = l2sh_[label]->first; state_history new_sh = l2sh_[label]->first;
auto succ = new_sh.make_succ(left_acc_set, right_acc_set); auto succ = new_sh.make_succ(left_acc_set, right_acc_set);
auto max_acc_set = succ.get_max_acc_set(); auto max_acc_set = succ.get_max_acc_set();
succ.clean_here();
return std::make_pair(push_state_history(succ), max_acc_set); return std::make_pair(push_state_history(succ), max_acc_set);
} }
std::pair<sh_label_t, value_t> std::pair<sh_label_t, value_t>
get_succ(sh_label_t current_sh, get_succ(sh_label_t current_sh, value_t left_acc_set,
value_t left_acc_set, value_t right_acc_set) value_t right_acc_set)
{ {
auto f_args = std::make_tuple(current_sh, left_acc_set, right_acc_set); auto f_args = std::make_tuple(current_sh, left_acc_set, right_acc_set);
auto p = succ_.emplace(f_args, std::make_pair(0, 0)); auto p = succ_.emplace(f_args, std::make_pair(0, 0));