Modify the powerset algorithm to keep track of accepting states

from the initial automaton.

* src/tgba/tgbaexplicit.cc, src/tgba/tgbaexplicit.hh:
Added class tgba_explicit_number, a tgba_explicit where states are
labelled by integers.
* src/tgbaalgos/powerset.hh, src/tgbaalgos/powerset.cc:
When building the deterministic automaton, keep track of which states
were created from an accepting state in the initial automaton.
The states are added to the new optional parameter (if not 0),
acc_list.
Use tgba_explicit_number instead of tgba_explicit_string to build
the result.
* src/tgbaalgos/scc.cc (spot): Small fix.
Print everything on std::cout.
This commit is contained in:
Felix Abecassis 2010-03-20 14:01:10 +01:00 committed by Alexandre Duret-Lutz
parent bd742ef6a4
commit e2e138f6e6
6 changed files with 95 additions and 18 deletions

View file

@ -21,6 +21,7 @@
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include <sstream>
#include "ltlast/atomic_prop.hh"
#include "ltlast/constant.hh"
#include "tgbaexplicit.hh"
@ -349,4 +350,34 @@ namespace spot
return ltl::to_string(i->second);
}
tgba_explicit_number::~tgba_explicit_number()
{
ns_map::iterator i = name_state_map_.begin();
while (i != name_state_map_.end())
{
tgba_explicit::state::iterator i2;
for (i2 = i->second->begin(); i2 != i->second->end(); ++i2)
delete *i2;
// Advance the iterator before deleting the formula.
delete i->second;
++i;
}
}
tgba_explicit::state* tgba_explicit_number::add_default_init()
{
return add_state(0);
}
std::string
tgba_explicit_number::format_state(const spot::state* s) const
{
const state_explicit* se = dynamic_cast<const state_explicit*>(s);
assert(se);
sn_map::const_iterator i = state_name_map_.find(se->get_state());
assert(i != state_name_map_.end());
std::stringstream ss;
ss << i->second;
return ss.str();
}
}

View file

@ -345,6 +345,18 @@ namespace spot
virtual state* add_default_init();
virtual std::string format_state(const spot::state* s) const;
};
class tgba_explicit_number:
public tgba_explicit_labelled<int, std::tr1::hash<int> >
{
public:
tgba_explicit_number(bdd_dict* dict):
tgba_explicit_labelled<int, std::tr1::hash<int> >(dict)
{};
virtual ~tgba_explicit_number();
virtual state* add_default_init();
virtual std::string format_state(const spot::state* s) const;
};
}
#endif // SPOT_TGBA_TGBAEXPLICIT_HH