Use the count_state() function instead of stats_reachable().

* src/tgbaalgos/postproc.cc: Move the count_state() function...
* src/priv/countstates.cc, src/priv/countstates.hh: ... in these
new files.
* src/priv/Makefile.am: Add them.
* src/saba/sabacomplementtgba.cc, src/tgba/tgbakvcomplement.cc,
src/tgbaalgos/minimize.cc: Use count_states() instead of
stats_reachable().
This commit is contained in:
Alexandre Duret-Lutz 2013-07-10 07:57:24 +02:00
parent 43b3df0ef0
commit f00d97b4ba
7 changed files with 87 additions and 33 deletions

View file

@ -1,5 +1,6 @@
// Copyright (C) 2010, 2011, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2012, 2013 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -45,7 +46,7 @@
#include "tgbaalgos/scc.hh"
#include "tgbaalgos/ltl2tgba_fm.hh"
#include "tgbaalgos/bfssteps.hh"
#include "tgbaalgos/stats.hh"
#include "priv/countstates.hh"
namespace spot
{
@ -535,7 +536,7 @@ namespace spot
// This corresponds to the algorithm in Fig. 1 of "Efficient
// minimization of deterministic weak omega-automata" written by
// Christof Löding and published in Information Processing
// Christof Löding and published in Information Processing
// Letters 79 (2001) pp 105--109.
// We also keep track of whether an SCC is useless
@ -554,7 +555,7 @@ namespace spot
unsigned k = (scc_count | 1) + 1;
// SCC are numbered in topological order
// (but in the reverse order as Löding's)
// (but in the reverse order as Löding's)
for (unsigned m = 0; m < scc_count; ++m)
{
bool is_useless = true;
@ -628,8 +629,8 @@ namespace spot
if (reject_bigger)
{
// Abort if min_aut_f has more states than aut_f.
tgba_statistics orig_size = stats_reachable(aut_f);
if (orig_size.states < min_aut_f->num_states())
unsigned orig_states = count_states(aut_f);
if (orig_states < min_aut_f->num_states())
{
delete min_aut_f;
return const_cast<tgba*>(aut_f);

View file

@ -22,26 +22,13 @@
#include "simulation.hh"
#include "sccfilter.hh"
#include "degen.hh"
#include "stats.hh"
#include "stripacc.hh"
#include <cstdlib>
#include "misc/optionmap.hh"
#include "priv/countstates.hh"
namespace spot
{
unsigned count_states(const tgba* a)
{
const sba_explicit_number* se =
dynamic_cast<const sba_explicit_number*>(a);
if (se)
return se->num_states();
const tgba_explicit_number* te =
dynamic_cast<const tgba_explicit_number*>(a);
if (te)
return te->num_states();
tgba_statistics st = stats_reachable(a);
return st.states;
}
postprocessor::postprocessor(const option_map* opt)
: type_(TGBA), pref_(Small), level_(High),