Commit 573c593f authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

powerset: some clean up

* spot/twaalgos/powerset.cc: Remove some unnecessary code, as spotted
by Fanda.  Also fix some comments.
parent ff960ee3
Pipeline #5800 passed with stages
in 136 minutes and 23 seconds
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009-2011, 2013-2018 Laboratoire de Recherche et // Copyright (C) 2009-2011, 2013-2019 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
...@@ -73,14 +73,6 @@ namespace spot ...@@ -73,14 +73,6 @@ namespace spot
twa_graph_ptr twa_graph_ptr
tgba_powerset(const const_twa_graph_ptr& aut, power_map& pm, bool merge) tgba_powerset(const const_twa_graph_ptr& aut, power_map& pm, bool merge)
{ {
{
typedef std::set<bdd, bdd_less_than> sup_map;
sup_map sup;
// Record occurrences of all guards
for (auto& t: aut->edges())
sup.emplace(t.cond);
}
unsigned ns = aut->num_states(); unsigned ns = aut->num_states();
unsigned nap = aut->ap().size(); unsigned nap = aut->ap().size();
...@@ -105,7 +97,8 @@ namespace spot ...@@ -105,7 +97,8 @@ namespace spot
size_t nc = num2bdd.size(); // number of conditions size_t nc = num2bdd.size(); // number of conditions
assert(nc == (1UL << nap)); assert(nc == (1UL << nap));
// An array of bit vectors of size 'ns'. Each original state is // Conceptually, we represent the automaton as an array 'bv' of
// ns*nc bit vectors of size 'ns'. Each original state is
// represented by 'nc' consecutive bitvectors representing the // represented by 'nc' consecutive bitvectors representing the
// possible destinations for each condition. // possible destinations for each condition.
// //
...@@ -124,7 +117,7 @@ namespace spot ...@@ -124,7 +117,7 @@ namespace spot
// a&b [...bit vector of size ns...] // a&b [...bit vector of size ns...]
// ... // ...
// //
// since there are nc possible "cond" value, ans ns sources, the // Since there are nc possible "cond" value, and ns sources, the
// ns*nc bitvectors of ns bits each can take a lot of space. In // ns*nc bitvectors of ns bits each can take a lot of space. In
// issue #302, we had the case of an automaton with ns=8777 // issue #302, we had the case of an automaton with ns=8777
// states, and 8 atomic propositions (nc=256): this large array // states, and 8 atomic propositions (nc=256): this large array
...@@ -134,7 +127,7 @@ namespace spot ...@@ -134,7 +127,7 @@ namespace spot
// To work around this, we reduce the number of states we store in // To work around this, we reduce the number of states we store in
// this array to reduced_ns, which we currently limit to 512 // this array to reduced_ns, which we currently limit to 512
// (chosen arbitrarily), and use it as a least-recently-used // (chosen arbitrarily), and use it as a least-recently-used
// cache. A separate vector of size ns, contains pointer // cache. A separate vector of size ns, contains pointers
// (i.e. iterators) to a list cell that gives an index in this // (i.e. iterators) to a list cell that gives an index in this
// cache. The purpose of the list is to maintain the // cache. The purpose of the list is to maintain the
// least-recently-used order. // least-recently-used order.
...@@ -283,11 +276,11 @@ namespace spot ...@@ -283,11 +276,11 @@ namespace spot
protected: protected:
const_twa_graph_ptr ref_; const_twa_graph_ptr ref_;
power_map& refmap_; power_map& refmap_;
edge_set reject_; // set of rejecting edges edge_set reject_; // set of rejecting edges
set_set accept_; // set of cycles that are accepting set_set accept_; // set of cycles that are accepting
edge_set all_; // all non rejecting edges edge_set all_; // all non rejecting edges
unsigned threshold_; // maximum count of enumerated cycles unsigned threshold_; // maximum count of enumerated cycles
unsigned cycles_left_; // count of cycles left to explore unsigned cycles_left_; // count of cycles left to explore
public: public:
fix_scc_acceptance(const scc_info& sm, const_twa_graph_ptr ref, fix_scc_acceptance(const scc_info& sm, const_twa_graph_ptr ref,
...@@ -362,15 +355,15 @@ namespace spot ...@@ -362,15 +355,15 @@ namespace spot
return accepting; return accepting;
} }
std::ostream& // std::ostream&
print_set(std::ostream& o, const edge_set& s) const // print_set(std::ostream& o, const edge_set& s) const
{ // {
o << "{ "; // o << "{ ";
for (auto i: s) // for (auto i: s)
o << i << ' '; // o << i << ' ';
o << '}'; // o << '}';
return o; // return o;
} // }
virtual bool virtual bool
cycle_found(unsigned start) override cycle_found(unsigned start) override
...@@ -399,7 +392,7 @@ namespace spot ...@@ -399,7 +392,7 @@ namespace spot
} }
} }
// Abort this algorithm if we have seen too much cycles, i.e., // Abort this algorithm if we have seen too many cycles, i.e.,
// when cycle_left_ *reaches* 0. (If cycle_left_ == 0, that // when cycle_left_ *reaches* 0. (If cycle_left_ == 0, that
// means we had no limit.) // means we had no limit.)
return (cycles_left_ == 0) || --cycles_left_; return (cycles_left_ == 0) || --cycles_left_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment