Fix parity solver if edgevector is not contiguous

Validity of strategies was tested relying on
num_edges() which might be smaller than the edge_number

* spot/twaalgos/game.cc: Fix here
* tests/python/game.py: Test here
This commit is contained in:
Philipp Schlehuber-Caissier 2023-03-30 14:32:26 +02:00
parent 0c34152a33
commit d152b3a316
2 changed files with 143 additions and 2 deletions

View file

@ -272,12 +272,16 @@ namespace spot
// Only the states owned by the winner need a strategy
assert([&]()
{
std::unordered_set<unsigned> valid_strat;
for (const auto& e : arena_->edges())
valid_strat.insert(arena_->edge_number(e));
for (unsigned v = 0; v < arena_->num_states(); ++v)
{
if (!solve_globally && (info_->scc_of(v) == -1u))
continue;
if (((*owner_ptr_)[v] == w_.winner(v))
&& ((s_[v] <= 0) || (s_[v] > arena_->num_edges())))
&& (valid_strat.count(s_.at(v)) == 0))
return false;
}
return true;